CVE-2021-43854
HIGH 7.5CVSS 3.1Inefficient Regular Expression Complexity in nltk (word_tokenize, sent_tokenize)
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.
- Published
- 23 Dec 2021
- Last modified
- 8 Jul 2026
- Assigned by
- security-advisories@github.com
- NVD status
- Modified
- Weakness
- CWE-400
- Also known as
- GHSA-f8m6-h2c7-8h9xPYSEC-2021-859
- Sources
- NVDJSONOSV GHSA-f8m6-h2c7-8h9xJSONOSV PYSEC-2021-859JSON
Scores
| Source | Scored by | Version | Score | Vector / decision |
|---|---|---|---|---|
| OSV | GitHub | CVSS 4.0 | CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:N/VI:N/VA:H/SC:N/SI:N/SA:N | |
| NVD | security-advisories@github.com (Secondary) | CVSS 3.1 | HIGH 7.5 | CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H |
| OSV | GitHub | CVSS 3.1 | HIGH 7.5 | CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H |
| NVD | nvd@nist.gov (Primary) | CVSS 2.0 | MEDIUM 5.0 | AV:N/AC:L/Au:N/C:N/I:N/A:P |
Affected
| Source | Vendor / ecosystem | Product / package | Affected versions | Fixed in |
|---|---|---|---|---|
| NVD | nltk | nltkcpe:2.3:a:nltk:nltk:*:*:*:*:*:*:*:* |
< 3.6.5 | 3.6.5 |
| OSV | PyPI | nltk | < 3.6.6 | 3.6.6 |
| OSV | PyPI | nltk | < 3.6.5 | 3.6.5 |
References
- https://github.com/nltk/nltk/commit/1405aad979c6b8080dbbc8e0858f89b2e3690341 · Patch, Third Party Advisory, WEB, FIX
- https://github.com/nltk/nltk/issues/2866 · Exploit, Issue Tracking, Patch, Third Party Advisory, WEB, REPORT
- https://github.com/nltk/nltk/pull/2869 · Exploit, Patch, Third Party Advisory, WEB
- https://github.com/nltk/nltk/security/advisories/GHSA-f8m6-h2c7-8h9x · Exploit, Patch, Third Party Advisory, WEB, ADVISORY
- https://nvd.nist.gov/vuln/detail/CVE-2021-43854 · ADVISORY
- https://github.com/nltk/nltk · PACKAGE
- https://github.com/pypa/advisory-database/tree/main/vulns/nltk/PYSEC-2021-859.yaml · WEB
History
- 25 Nov 2026 20:33 UTC · NVD: first stored (published 23 Dec 2021)
- 25 Nov 2026 20:12 UTC · OSV: first stored (published 23 Dec 2021)
- 25 Nov 2026 20:11 UTC · OSV: first stored (published 6 Jan 2022)