CVE-2026-66393 — Vulnerability in nltk — CVE Details
Natural Language Toolkit (NLTK) has unbounded recursion in JSONTaggedDecoder.decode_obj() may cause DoS
What Should I Do?
Address in Next Maintenance Window
Low exploitation probability (0.52%). Schedule for your next planned update.
Does your project use an affected nltk version?
Paste your requirements.txt to check it for CVE-2026-66393 and every other known vulnerability, with CISA KEV and EPSS on each finding. Free with no signup for up to 10 packages, or up to 500 per scan with a free account, which also keeps up to 200 packages in saved projects.
Summary
Summary
JSONTaggedDecoder.decode_obj() in nltk/jsontags.py calls itself
recursively without any depth limit. A deeply nested JSON structure
exceeding sys.getrecursionlimit() (default: 1000) will raise an
unhandled RecursionError, crashing the Python process.
Affected code
File: nltk/jsontags.py, lines 47–52
@classmethod
def decode_obj(cls, obj):
if isinstance(obj, dict):
obj = {key: cls.decode_obj(val) for (key, val) in obj.items()}
elif isinstance(obj, list):
obj = list(cls.decode_obj(val) for val in obj)
Proof of Concept
import sys, json
from nltk.jsontags import JSONTaggedDecoder
depth = sys.getrecursionlimit() + 50 # e.g. 1050
payload = '{"x":' * depth + "null" + "}" * depth
# Raises RecursionError, crashing the process
json.loads(payload, cls=JSONTaggedDecoder)
Impact
Any code path that passes externally-supplied JSON to
JSONTaggedDecoder is vulnerable to denial of service.
The severity depends on whether such a path exists in the
calling code (e.g. nltk/data.py).
Suggested Fix
Add a depth parameter with a hard limit:
@classmethod
def decode_obj(cls, obj, _depth=0):
if _depth > 100:
raise ValueError("JSON nesting too deep")
if isinstance(obj, dict):
obj = {key: cls.decode_obj(val, _depth + 1)
for (key, val) in obj.items()}
elif isinstance(obj, list):
obj = list(cls.decode_obj(val, _depth + 1) for val in obj)
Advisory Timeline
- First published March 18, 2026 (253 days ago).
- Last revised September 10, 2026 — 175 days after initial publication.
Remediation
Upgrade to the fixed version using your package manager.
pip install "nltk>=3.9.4"
After upgrading, scan your dependencies again to confirm the vulnerability is resolved.
Affected Packages (1)
Affects 1 ecosystem: PyPI (1).
| Package | Fixed In |
|---|---|
| nltk PyPI · Affected: 0.8, 0.9, 0.9.3, 0.9.4 (+60 more) | 3.9.4 |
Vulnerability Classification
Common Weakness Enumeration (CWE) identifiers for this vulnerability type.
- CWE-674
CVSS Score Breakdown
What the CVSS (Common Vulnerability Scoring System) 4.0 score means for each attack dimension.
CVSS:4.0/AV:L/AC:L/AT:N/PR:N/UI:N/VC:N/VI:N/VA:L/SC:N/SI:N/SA:N
References
- https://github.com/nltk/nltk/security/advisories/GHSA-rf74-v2fm-23pwWEB
- https://nvd.nist.gov/vuln/detail/CVE-2026-66393ADVISORY
- https://github.com/nltk/nltk/commit/00cdcd392142e6c745e7120c8d50a24127df5fadWEB
- https://github.com/nltk/nltkPACKAGE
- https://github.com/pypa/advisory-database/tree/main/vulns/nltk/PYSEC-2026-3724.yamlWEB
- https://www.vulncheck.com/advisories/nltk-before-denial-of-service-via-jsontaggeddecoderWEB
Frequently Asked Questions
- What is CVE-2026-66393?
- Natural Language Toolkit (NLTK) has unbounded recursion in JSONTaggedDecoder.decode_obj() may cause DoS. This vulnerability has been assigned a severity rating of MEDIUM (CVSS score: 4.0/10).
- How do I check if my project is affected by CVE-2026-66393?
- CVE-2026-66393 affects nltk. It has a 0.5% probability of exploitation within 30 days (EPSS score). Use GeekWala's free vulnerability scanner to check your dependencies against CVE-2026-66393 and 200,000+ other known vulnerabilities.
Severity & Exploitability
Exploitation requires specific conditions, or the impact is limited.
This is a below-median EPSS score — only 37.6% of tracked vulnerabilities score at or below it, so most tracked vulnerabilities are considered more likely to be exploited than this one.
Also Known As
Related CVEs
- CVE-2026-81722HIGH
- CVE-2026-12252HIGH
NLTK Stanford wrapper classes execute untrusted JAR files without verification
- CVE-2026-129234HIGH
NLTK: Untrusted search path in prover9/mace4 config allows local code execution via relative binary_location
- CVE-2024-39705HIGH
ntlk unsafe deserialization vulnerability
- CVE-2026-81724MEDIUM
- CVE-2026-81726MEDIUM
- CVE-2026-81723MEDIUM
NLTK: Quadratic CPU Exhaustion in `XMLCorpusView._read_xml_fragment()`
- CVE-2026-129226MEDIUM
NLTK: Uncontrolled recursion in semantic-logic type parser causes denial of service via nested type strings