# NLTK Pl196xCorpusReader quadratic ReDoS on malformed TEI blocks

Source: https://junglewise.ai/threats/nltk-pl196xcorpusreader-quadratic-redos-on-malformed-tei-blocks-8473e6ef  
Publisher: Junglewise Threat Intelligence, https://junglewise.ai/threats  
Published: 2026-08-27. Updated: 2026-09-25  
License: CC BY 4.0 with a link back

Severity: low · CVSS 3.7 · Published 2026-08-27

NLTK is a popular Python library for natural language processing that includes corpus readers for parsing various text formats. The Pl196xCorpusReader component contains a regular expression denial of service vulnerability that can be triggered by processing specially crafted corpus files with malformed XML-like TEI blocks. An attacker can supply a corpus file with many unmatched opening tags, causing the parser to repeatedly rescan the text and consume CPU resources quadratically, potentially stalling parser threads and degrading application performance.

Technologies: [nltk (PyPI)](https://junglewise.ai/threats/technologies/nltk). Vendors: [PyPI](https://junglewise.ai/threats/vendors/pypi).

## Quick answers

**Is This vulnerability exploited in the wild?** No. Junglewise Threat Intelligence has no report of This vulnerability being exploited in the wild.

**How severe is This vulnerability?** Low severity, with a CVSS score of 3.7, published 27 August 2026.

**Which products and versions are affected?** nltk (PyPI) <= 3.10.2.

**Is there a fix for This vulnerability?** A patch was published on 2026-08-12: Fix released in NLTK version 3.10.3 Junglewise finds every place you run it, drafts the upgrade and applies it once you approve.

**How is This vulnerability attacked?** It is attacked over the network, in a software library.

**Am I affected?** Check whether you run nltk (PyPI) at an affected version. Junglewise does that check for you around the clock: connect your code, cloud and domains, and it matches new vulnerabilities like this one against what you actually run and tells you when one reaches you.

## Technical details

The vulnerability is a ReDoS (Regular Expression Denial of Service) in the TEICorpusView.read_block method and related Pl196xCorpusReader public APIs. The root cause is the use of lazy quantifier regexes (.*?) that process entire TEI blocks from attacker-controlled corpus files. When a malformed file contains many opening XML-like tags without corresponding closing tags, each regex attempt scans toward the end of the block before failing, then restarts from the next opening tag position. This creates O(n²) behavior rather than linear parsing. The vulnerability is exploitable through public APIs like words() and tagged_words() without requiring authentication or special privileges. Attack complexity is high (requires malformed corpus files), but the attack vector is network-accessible if the application processes untrusted corpus files. The impact is availability degradation through CPU exhaustion. The fix was released in NLTK version 3.10.3, which replaced the whole-block lazy-regex parser with a linear parser or bounded tokenizer.

## Affected products

- NLTK NLTK <= 3.10.2

## Timeline

- 2026-08-27: disclosed: Advisory published to GitHub Advisory Database
- 2026-08-12: patched: Fix released in NLTK version 3.10.3

## References

- [https://github.com/nltk/nltk/security/advisories/GHSA-8mpw-7fpc-4gqj](https://github.com/nltk/nltk/security/advisories/GHSA-8mpw-7fpc-4gqj)
- [https://www.vulncheck.com/advisories/nltk-before-3.10.3-regular-expression-denial-of-service-via-pl196xcorpusreader](https://www.vulncheck.com/advisories/nltk-before-3.10.3-regular-expression-denial-of-service-via-pl196xcorpusreader)

## Related threats

- [NLTK WekaClassifier path traversal in model validation](https://junglewise.ai/threats/cve-2026-109956-nltk-through-3-10-3-contains-a-path-traversal-vulnerability-in)
- [NLTK RecursiveDescentParser uncontrolled recursion denial of service](https://junglewise.ai/threats/cve-2026-12876-nltk-recursivedescentparser-uncontrolled-recursion-denial-of)
- [NLTK tgrep regular expression denial of service](https://junglewise.ai/threats/nltk-tgrep-regular-expression-denial-of-service-02fca1b2)
- [NLTK Downloader hardlink filesystem containment bypass](https://junglewise.ai/threats/nltk-downloader-hardlink-filesystem-containment-bypass-522cb97d)
- [NLTK path traversal in model-artifact APIs via pathsec bypass](https://junglewise.ai/threats/nltk-path-traversal-in-model-artifact-apis-via-pathsec-bypass-a4651c73)
