CVE-2026-81725 — Vulnerability in nltk — CVE Details
NLTK: Pl196xCorpusReader has quadratic ReDoS on malformed TEI blocks
What Should I Do?
Address in Next Maintenance Window
Low exploitation probability (0.37%). Schedule for your next planned update.
Does your project use an affected nltk version?
Paste your requirements.txt to check it for CVE-2026-81725 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
Pl196xCorpusReader still parses whole TEI blocks with multiple lazy regexes over attacker-controlled text. A malformed file with many opening tags and no matching closing tags forces repeated rescans and produces quadratic CPU growth in public reader APIs.
Details
- Vulnerability type: Regular-expression denial of service
- Affected component:
nltk.corpus.reader.pl196x.TEICorpusView.read_blockandPl196xCorpusReaderpublic methods - Affected versions: Published
3.9.4and current sourcev3.10.0-rc2both reproduced. - Patched versions: Not yet patched
- Root cause: Lazy
.*?whole-block regexes rescan untrusted XML-like blocks from each opening-tag position.
The parser uses regexes for paragraphs, sentences, and word tags across the whole <text> block. When the attacker supplies many unmatched opening tags, each attempt scans toward the end of the block and fails, then restarts from the next opening tag. There is near four-times runtime growth each time the number of malformed <p> tags doubled, through normal public calls such as words() and tagged_words().
PoC
Preconditions
- The application parses attacker-influenced PL196X or TEI-like corpus files through public reader APIs.
Steps
- Create a corpus file with a valid header followed by a
<text>block that contains many opening tags and no matching closing tags. - Instantiate
Pl196xCorpusReaderon that corpus. - Call
words()ortagged_words()and measure elapsed time as the malformed tag count doubles. - Observe near quadratic growth instead of near-linear behavior.
Minimal reproducible excerpt
size=1000 0.014s
size=2000 0.057s
size=4000 0.231s
size=8000 0.927s
Impact
A consumer that accepts attacker-influenced corpus files can be forced into heavy CPU use and parser-thread stalling before the application concludes the input contains no valid content.
Remediation
Replace the whole-block lazy-regex parser with a linear parser or bounded tokenizer, and add regression tests that assert near-linear behavior on malformed inputs with many unmatched tags.
Advisory Timeline
- First published September 8, 2026 (79 days ago).
- Last revised September 8, 2026 — 0 days after initial publication.
Remediation
Upgrade to the fixed version using your package manager.
pip install "nltk>=3.10.3"
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 (+64 more) | 3.10.3 |
Vulnerability Classification
Common Weakness Enumeration (CWE) identifiers for this vulnerability type.
- CWE-1333
- CWE-400Uncontrolled Resource ConsumptionMITRE
CVSS Score Breakdown
What the CVSS (Common Vulnerability Scoring System) 3.7 score means for each attack dimension.
CVSS:4.0/AV:N/AC:H/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-8mpw-7fpc-4gqjWEB
- https://nvd.nist.gov/vuln/detail/CVE-2026-81725ADVISORY
- https://github.com/nltk/nltk/commit/7808692d451b962711005d954859bb83aabcf8faWEB
- https://github.com/nltk/nltkPACKAGE
- https://github.com/nltk/nltk/releases/tag/v3.10.3WEB
- https://github.com/pypa/advisory-database/tree/main/vulns/nltk/PYSEC-2026-3752.yamlWEB
- https://www.vulncheck.com/advisories/nltk-before-3.10.3-regular-expression-denial-of-service-via-pl196xcorpusreaderWEB
Frequently Asked Questions
- What is CVE-2026-81725?
- NLTK: Pl196xCorpusReader has quadratic ReDoS on malformed TEI blocks. This vulnerability has been assigned a severity rating of MEDIUM (CVSS score: 3.7/10).
- How do I check if my project is affected by CVE-2026-81725?
- CVE-2026-81725 affects nltk. It has a 0.4% probability of exploitation within 30 days (EPSS score). Use GeekWala's free vulnerability scanner to check your dependencies against CVE-2026-81725 and 200,000+ other known vulnerabilities.
Severity & Exploitability
Exploitation is difficult, or the impact is minor.
This is a below-median EPSS score — only 22.9% 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-0848CRITICAL
- CVE-2026-62388HIGH
- CVE-2026-63311HIGH
- CVE-2026-78682HIGH
NLTK: pathsec SSRF protection can be bypassed when a proxy is configured
- CVE-2026-128134HIGH
NLTK dot2img runs Graphviz 'dot' without the trusted-exec chokepoint, enabling local code execution via a writable PATH element
- CVE-2026-79676HIGH
NLTK: Corpus readers follow symlinks outside trusted roots despite pathsec enforcement
- CVE-2026-65915MEDIUM
NLTK: FileSystemPathPointer.open() sandbox check is dead code — arbitrary file read via file:// protocol
- CVE-2026-128140MEDIUM
NLTK: Downloader cyclic collection indices cause an infinite closure walk