CVE-2021-43854

Inefficient Regular Expression Complexity in nltk

HIGH
7.5
CVSS Score
Published: December 23, 2021 at 05:55 PM UTC
Updated: June 17, 2026 at 04:11 AM UTC
1 product affected across 1 vendorNltk

Using nltk by nltk?

Get instant alerts when new vulnerabilities affect nltk - before attackers find them.

Real-time alertsTrack your software stackFree plan available
Severity
HIGH7.5
Exploit prediction
EPSS 3%

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.

Affected

Our own answer: ranges merged, affected separated from platform-only, with confidence and review flags.

v < 3.6.5
Affected range stops below 3.6.5, so it looks safe — our inference, not a vendor statement

References (4)

x_refsource_MISCExploitIssue TrackingPatchThird Party Advisory
https://github.com/nltk/nltk/issues/2866
x_refsource_MISCExploitPatchThird Party Advisory
https://github.com/nltk/nltk/pull/2869
x_refsource_CONFIRMExploitPatchThird Party Advisory
https://github.com/nltk/nltk/security/advisories/GHSA-f8m6-h2c7-8h9x

CVSS

7.5HIGHGitHub_M
Attack Vector
NETWORK
Complexity
LOW
Privileges
NONE
User Interaction
NONE
Scope
UNCHANGED
Confidentiality
NONE
Integrity
NONE
Availability
HIGH
Vector?

Quick Info

StatusMODIFIED
CWE
CWE-400

Get alerted

Stop reading CVE feeds looking for your own stack

Track the products you run and VulnTracker tells you when a new CVE affects them — with what is known about fixing it, and nothing about the rest.

Free plan, no card