Attack ChainAIDerived
Hypothetical attack flow derived from CVE metadata – not a confirmed exploit chain
-
ReconIdentify externally exposed tgrep API endpoint
-
DeliveryCraft tgrep pattern with malicious /regex/ node
-
ExploitSubmit pattern to tgrep_positions() or tgrep_compile()
-
Install_tgrep_node_action compiles and executes unvalidated regex
-
C2Catastrophic backtracking saturates CPU
-
ExecutePython process blocked indefinitely
-
ImpactService denial for all endpoint users
Vulnerability Assessment
| Weakness |
CWE
ASVS 5.0
V2 - Validation and Business Logic Regex complexity limits
MITRE ATT&CK
1 technique across 1 tactic: Impact The technique list with ATT&CK links and the kill-chain view is part of the Basic plan and up. |
| Exploitation Conditions | Exploitation requires the application to pass attacker-controlled strings as the tgrep pattern argument to tgrep_positions() or tgrep_compile() - specifically, the attacker must control the pattern itself (not merely the tree being searched). The /regex/ node syntax must survive to the _tgrep_node_action function with a malicious payload intact. Deployments using NLTK tgrep exclusively with hardcoded or internally generated patterns are not exploitable regardless of network exposure. The CVSS 4.0 AT:P (attack requirement: present) and AC:H metrics formally capture this dependency on a non-default, explicitly exposed API configuration. Exploitation is limited to availability impact only - there is no code execution, data exfiltration, or integrity violation possible through this path. Authentication requirements are not confirmed from the available data; the PR:N CVSS metric implies no authentication is required once the tgrep API endpoint is reached. |
| Impact | The CVSS 4.0 score of 8.2 reflects High availability impact (VA:H) with zero confidentiality or integrity exposure. The vector AV:N/AC:H/AT:P confirms network reachability but flags two important mitigators: High attack complexity and a specific attack prerequisite requiring the tgrep API to be exposed to external, attacker-controlled input. EPSS data was not provided, limiting probabilistic exploitation assessment, and no CISA KEV listing exists. The absence of both KEV and public POC suggests this has not seen opportunistic or widespread exploitation. Real-world risk is highly deployment-dependent: organizations running web-facing NLP services that pass user input directly to tgrep functions face genuine denial-of-service risk, while the far more common offline batch-processing use of NLTK is not exploitable via this vector. The CVSS 4.0 score appropriately captures the High potential impact, but the AT:P requirement means security teams should audit their actual tgrep exposure before escalating priority - this is not a broad network-sweep risk. |
| Exploit ScenarioDerived | An attacker identifies a web API endpoint that accepts tgrep search patterns and passes them without sanitization to NLTK's tgrep_positions() function. The attacker submits a crafted tgrep pattern containing a /regex/ node with a polynomial backtracking expression (e.g., a nested quantifier pattern like /(a+)+$/) as the node label matcher. Python's re.search engine processes the pattern against each tree node label, entering catastrophic backtracking that saturates a CPU core and blocks the Python worker process, rendering the service unavailable to all concurrent users. |
Get an e-mail when this CVE is exploited, patched or re-scored. Free account.
Alert meAnalysisAIv1 – Aug 26, 2026
ReDoS in NLTK's tgrep module exposes applications to indefinite CPU saturation when user-controlled tgrep patterns containing /regex/ nodes reach the _tgrep_node_action function, which compiles and executes them via Python's re.search without validation or timeout. All NLTK versions before 3.10.3 are affected when tgrep_positions() or tgrep_compile() accept external input. No public exploit code or active exploitation (CISA KEV) has been identified at time of analysis; exploitation is conditional on a non-default, externally-exposed API configuration.
RemediationAI
Upgrade NLTK to version 3.10.3 or later, which addresses the unsafe regex handling in the tgrep module. The GitHub security advisory at https://github.com/nltk/nltk/security/advisories/GHSA-w3v8-gmh9-3wv7 provides authoritative fix details; the VulnCheck advisory at https://www.vulncheck.com/advisories/nltk-3.10.2-regular-expression-denial-of-service-via-tgrep provides additional context. If immediate upgrading is not feasible, apply one or more of these compensating controls: (1) Reject or strip /regex/ nodes from tgrep patterns at the application boundary before they reach NLTK - this eliminates the attack surface entirely but may break legitimate regex-based queries. (2) Run tgrep processing in a subprocess with a strict wall-clock timeout (e.g., Python's subprocess.run with timeout=N), isolating the Python process from indefinite blocking at the cost of added latency and process-management complexity. (3) Restrict tgrep pattern input to authenticated, trusted users only, reducing the exposed attack surface without eliminating it.
Affected VersionsENISA
Affected Packages
Source: OSV (Open Source Vulnerabilities)
Affects your stack
Affects 1 package in pypi
Checking this CVE against your own stacks and servers is part of the Basic plan and up.
Technical ContextAI · show details
NLTK (Natural Language Toolkit) is a Python library for computational linguistics and NLP. Its tgrep module implements tree-search grammar that allows querying parse tree structures. The _tgrep_node_action function handles /regex/ pattern nodes by extracting the embedded regex, compiling it with Python's re module, and executing re.search against tree node labels. CWE-1333 (Uncontrolled Regular Expression Complexity) describes the root cause: the library performs no sanitization, complexity bounding, or timeout enforcement on these user-supplied patterns, enabling catastrophic backtracking attacks. The affected CPE cpe:2.3:a:nltk:nltk:*:*:*:*:*:*:*:* covers all NLTK versions prior to the 3.10.3 fix. The Python re engine is vulnerable to polynomial and exponential backtracking on pathological inputs, making it an unsuitable executor of untrusted regex without external safeguards.
Know when Nltk gets its next vulnerability
- Watch products and get an email when something new is published
- Check this CVE against your own stack and servers
- Exploit and PoC references, threat intelligence from 22 sources
No credit card · 7-day full trial
Severity by source
CVSS:4.0/AV:N/AC:H/AT:P/PR:N/UI:N/VC:N/VI:N/VA:H/SC:N/SI:N/SA:N
Network vector applies when tgrep API is exposed; AC:H captures the non-default exposed-input prerequisite; PR:N because no authentication is implied; A:H for indefinite CPU saturation; no C or I impact.
Primary rating from Vendor (VulnCheck).
CVSS VectorVendor: VulnCheck
Lifecycle Timeline
2DescriptionCVE.org
NLTK before 3.10.3 contains a regular expression denial of service (ReDoS) vulnerability in the tgrep module. The _tgrep_node_action function compiles user-supplied regular expressions embedded in /regex/ pattern nodes and executes them via re.search against tree node labels without any validation or timeout. An attacker who controls the tgrep pattern (e.g., via tgrep_positions() or tgrep_compile() exposed to external input) can supply a pattern that triggers catastrophic backtracking, causing indefinite CPU saturation that blocks the Python process.
Executive ViewAI
NLTK versions before 3.10.3 contain a regular expression denial-of-service (ReDoS) vulnerability in the tgrep module (CVSS 8.2) that allows attackers to saturate CPU resources through malicious regex patterns. Organizations using NLTK should assess whether tgrep APIs are exposed to external or untrusted input, as successful exploitation would cause application unavailability and operational disruption.
No vendor-released patch identified at time of analysis. Interim mitigations: strict input validation with maximum pattern length enforcement, CPU-execution timeouts on regex compilation and matching operations, network isolation or disabling of externally-accessible tgrep APIs if not operationally required, and real-time CPU utilization monitoring on systems accepting user-supplied tgrep input.
Threat Intelligence Overview
How this decision was reached
The engine reads each signal below and applies a fixed list of rules from top to bottom. The first rule that matches sets the recommended action – like a statement, every line is shown.
What every action level means
SSVC AssessmentENISA
Priority Score
Attack Technique
Denial of Service attacks render applications or systems unavailable by overwhelming resources or triggering failure conditions.
Arbitrary code execution in the Natural Language Toolkit (NLTK) before 3.10.3 allows attackers to bypass the library's p
Arbitrary code execution in NLTK (Natural Language Toolkit) through 3.9.4 allows attackers to run Python code when a vic
Arbitrary code execution in the NLTK (Natural Language Toolkit) Python library affects all versions through its data dow
StreamBackedCorpusView in NLTK before 3.10.0 allows arbitrary local file reads by calling Python's builtins.open() direc
Symlink-based path traversal in NLTK's FramenetCorpusReader before version 3.10.2 permits attackers with write access to
Unbounded recursion in NLTK's JSONTaggedDecoder.decode_obj() (nltk/jsontags.py) allows unauthenticated remote attackers
Path traversal and pickle deserialization protections in NLTK before 3.10.0 are effectively disabled by default - pathse
XML Entity Expansion (Billion Laughs) in NLTK before 3.10.3 allows unauthenticated remote attackers to cause denial of s
Server-side request forgery in NLTK before 3.10.3 allows unauthenticated remote attackers to reach internal HTTP service
Symlink escape in NLTK's CorpusReader.open() allows local attackers to read arbitrary files outside the designated corpu
Path traversal in NLTK's FramenetCorpusReader and NKJPCorpusReader (all versions before 3.10.0) enables unauthenticated
NLTK (Natural Language Toolkit) is a suite of open source Python modules, data sets, and tutorials supporting research a
EUVD-2026-66397
GHSA-vf76-f5cp-9846
NVD
CVE.org
EPSS
Vulnrichment
VulDB
Exploit-DB