Skip to content
Fencer Vulns
high 7.5

CVE-2021-43854 json

Inefficient Regular Expression Complexity in nltk

published 2021-12-23 4 y ago modified 2026-07-08 4 mo ago also GHSA-f8m6-h2c7-8h9x , PYSEC-2021-859 , EUVD-2021-0148

cvss
7.5
version 3.1, CNA
cisa kev
Not listed
not in CISA's catalog
epss
2.8%
EPSS 2.8% chance of exploitation in 30 days, percentile 86%
public exploits
0
none known

Summary

NLTK (Natural Language Toolkit) is a suite of open source Python modules, data sets, and tutorials supporting research and development in Natural Language Processing. Versions prior to 3.6.5 are vulnerable to regular expression denial of service (ReDoS) attacks. The vulnerability is present in PunktSentenceTokenizer, sent_tokenize and word_tokenize. Any users of this class, or these two functions, are vulnerable to the ReDoS attack. In short, a specifically crafted long input to any of these vulnerable functions will cause them to take a significant amount of execution time. If your program relies on any of the vulnerable functions for tokenizing unpredictable user input, then we would strongly recommend upgrading to a version of NLTK without the vulnerability. For users unable to upgrade the execution time can be bounded by limiting the maximum length of an input to any of the vulnerable functions. Our recommendation is to implement such a limit.

Patch / fix

  • pypi nltk 3.6.5, 3.6.6
  • nltk nltk 3.6.5
  • nltk Debian 14, Debian 13, Debian 12 3.6.7-1

debian advisories DEBIAN-CVE-2021-43854

  • nltk Ubuntu Pro 14.04 LTS 2.0~b9-0ubuntu4.1~esm4
  • nltk Ubuntu Pro 16.04 LTS 3.1-1ubuntu0.1+esm2
  • nltk Ubuntu Pro 18.04 LTS 3.2.5-1ubuntu0.1+esm2
  • nltk Ubuntu Pro 20.04 LTS 3.4.5-2ubuntu0.1~esm2

ubuntu advisories UBUNTU-CVE-2021-43854

Ubuntu security data © Canonical Ltd., from https://github.com/canonical/ubuntu-security-notices via OSV; changed: normalised to fixed package versions per release. CC BY-SA 4.0

Exploit prediction

2.79% chance of exploitation in the next 30 days, higher than 86% of all scored CVEs (FIRST EPSS, 2026-11-08).

Exploits and checks

  • github.com https://github.com/nltk/nltk/pull/2869 referenced PoC, tagged "exploit" by a source, unverified
  • github.com https://github.com/nltk/nltk/security/advisories/GHSA-f8m6-h2c7-8h9x referenced PoC, tagged "exploit" by a source, unverified
  • github.com https://github.com/nltk/nltk/issues/2866 referenced PoC, tagged "exploit" by a source, unverified

CVSS scores

assigned by version score vector
CNA 3.1 7.5 CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H
NVD 2.0 5.0 AV:N/AC:L/Au:N/C:N/I:N/A:P
GitHub 3.1 7.5 CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H

Affected packages

ecosystem package affected fixed in
pypi nltk
<3.6.6
<3.6.5
3.6.6
3.6.5

Affected products

  • nltk nltk

Classification

Weakness
  • CWE-400 Uncontrolled Resource Consumption

References

Sources

Fencer Vulns keeps one entry per vulnerability: the CVE id wins, then GHSA, and records that alias each other are merged, except that two CVEs always keep separate entries. The same data is available as JSON.