Junglewise Threat Intelligence

CVE-2026-81725: NLTK Pl196xCorpusReader quadratic ReDoS on malformed TEI blocks

CVE-2026-81725 · Severity: medium · CVSS 6.3 · Published 2026-09-08

Executive brief

NLTK's Pl196xCorpusReader is a component used to parse linguistic corpus files in TEI (Text Encoding Initiative) format. When processing malformed corpus files with many unmatched XML tags, an attacker can cause the parser to enter a denial-of-service condition where CPU usage grows quadratically—doubling the malformed tags roughly quadruples the parsing time. This allows an attacker to consume significant server resources and stall legitimate application processing by supplying a specially crafted corpus file.

Technical details

The vulnerability is a regular-expression denial of service (ReDoS) affecting nltk.corpus.reader.pl196x.TEICorpusView.read_block and Pl196xCorpusReader public methods (words(), tagged_words()). The root cause is the use of lazy regex quantifiers (.*?) that scan entire TEI blocks without bounds. When processing malformed XML-like content with many unmatched opening tags but no closing tags, the regex engine rescans from each opening-tag position toward the end of the block, failing repeatedly and restarting. This creates quadratic time complexity—approximately four-fold runtime increase per doubling of malformed tags. An attacker can exploit this by supplying a corpus file with a valid header followed by a text block containing many unclosed opening tags. No authentication or special privileges are required; the application need only parse attacker-controlled corpus files through public APIs. The patch (v3.10.3+) replaces the whole-block lazy-regex parser with a linear parser or bounded tokenizer.

Affected products

  • NLTK NLTK <= 3.10.2

Timeline

  • 2026-08-12: disclosed: Initial GitHub advisory publication
  • 2026-09-08: advisory: Advisory published to GitHub Advisory Database
  • 2026-08-12: patched: Fix committed (v3.10.3+)

References

Related threats