CVE-2021-43854

Public Exploit
Inefficient Regular Expression Complexity in nltk

Description

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.

Category

7.5
CVSS
Severity: High
CVSS 3.1 •
CVSS 2.0 •
EPSS 1.37% Top 25%
Third-Party Advisory github.com Third-Party Advisory github.com Third-Party Advisory github.com Third-Party Advisory github.com
Affected: nltk nltk
Published at:
Updated at:

References

Link Tags
https://github.com/nltk/nltk/security/advisories/GHSA-f8m6-h2c7-8h9x patch third party advisory exploit
https://github.com/nltk/nltk/issues/2866 patch exploit third party advisory issue tracking
https://github.com/nltk/nltk/pull/2869 patch third party advisory exploit
https://github.com/nltk/nltk/commit/1405aad979c6b8080dbbc8e0858f89b2e3690341 third party advisory patch

Frequently Asked Questions

What is the severity of CVE-2021-43854?
CVE-2021-43854 has been scored as a high severity vulnerability.
How to fix CVE-2021-43854?
To fix CVE-2021-43854, make sure you are using an up-to-date version of the affected component(s) by checking the vendor release notes. As for now, there are no other specific guidelines available.
Is CVE-2021-43854 being actively exploited in the wild?
It is possible that CVE-2021-43854 is being exploited or will be exploited in a near future based on public information. According to its EPSS score, there is a ~1% probability that this vulnerability will be exploited by malicious actors in the next 30 days.
What software or system is affected by CVE-2021-43854?
CVE-2021-43854 affects nltk nltk.
This platform uses data from the NIST NVD, MITRE CVE, MITRE CWE, First.org and CISA KEV but is not endorsed or certified by these entities. CVE is a registred trademark of the MITRE Corporation and the authoritative source of CVE content is MITRE's CVE web site. CWE is a registred trademark of the MITRE Corporation and the authoritative source of CWE content is MITRE's CWE web site.
© 2025 Under My Watch. All Rights Reserved.