Skip to main content

CVE-2026-81725 — Vulnerability in nltk — CVE Details

MEDIUM

NLTK: Pl196xCorpusReader has quadratic ReDoS on malformed TEI blocks

Published September 8, 2026Updated September 8, 2026Source: OSV

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.

Check my requirements.txt

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_block and Pl196xCorpusReader public methods
  • Affected versions: Published 3.9.4 and current source v3.10.0-rc2 both 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

  1. Create a corpus file with a valid header followed by a <text> block that contains many opening tags and no matching closing tags.
  2. Instantiate Pl196xCorpusReader on that corpus.
  3. Call words() or tagged_words() and measure elapsed time as the malformed tag count doubles.
  4. 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
Update nltk to 3.10.3 or later
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).

PackageFixed 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.

CVSS Score Breakdown

What the CVSS (Common Vulnerability Scoring System) 3.7 score means for each attack dimension.

Attack Vector
Network
Attack Complexity
High
Privileges Required
None
User Interaction
None
Scope
—
Confidentiality
—
Integrity
—
Availability
—

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

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

CVSS Score
3.7

Exploitation is difficult, or the impact is minor.

EPSS Score (30-day exploit probability)
0.37%
EPSS percentile: 22.9

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

GHSA-8mpw-7fpc-4gqj
PYSEC-2026-3752

Related CVEs

Check your own dependencies

Free, with no signup for up to 10 packages.

Check my requirements.txt