CVE-2021-43854Nltk
High 7.5 No auth needed
Follow: this CVE · Nltk · Nltk We alert you by email or Slack (account required).
- Priority
- 60
- CVSS 3.1
- 7.5
- EPSS
- 2.8% probability of exploitation in 30 days · percentile 87
- Auth required
- No
- Published
- Dec 23, 2021
- Updated
- Jun 17, 2026
- Category
- Application · Cross-platform
- Weakness (CWE)
- CWE-400
- Vector
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H
What happens
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.
What to do
- Apply the vendor's security update for Nltk.
- It can be exploited without authentication: if you cannot patch now, restrict Internet access to the affected service.
Affected packages
| Ecosystem | Package | Affected versions | Fixed in | How to upgrade |
|---|---|---|---|---|
| PyPI | nltk |
< 3.6.6 |
3.6.6 |
pip install "nltk>=3.6.6" |
| PyPI | nltk |
< 3.6.5 |
3.6.5 |
pip install "nltk>=3.6.5" |
Per OSV / GitHub Advisories (GHSA-f8m6-h2c7-8h9x, PYSEC-2021-859). Check the version in your lockfile before upgrading.
Affected products (CPE)
| Vendor | Product | Versions |
|---|---|---|
| nltk | nltk | < 3.6.5 |
Official sources
References
Links published by the sources. Open them with care.
- github.com Patch Third Party Advisory
- github.com Exploit Issue Tracking Patch
- github.com Exploit Patch Third Party Advisory
- github.com Exploit Patch Third Party Advisory