PyPI: nltk

CVE-2026-81725

Safety vulnerability ID: SFTY-20260908-61270

Affected versions of the NLTK package are vulnerable to Regular Expression Denial of Service (ReDoS) due to unbounded regular expression complexity in parsing TEI blocks. The `nltk.corpus.reader.pl196x.TEICorpusView.read_block` method and public methods of `Pl196xCorpusReader` use lazy regexes to parse entire `<text>` blocks, which rescan from each opening tag position when unmatched tags are present. An attacker can exploit this by supplying malformed corpus files containing numerous unmatched opening tags, causing quadratic CPU growth and potentially causing denial of service through excessive resource consumption.

Created at: Sep 9, 2026Updated at: Sep 9, 2026

Overview

NLTK: Pl196xCorpusReader has quadratic ReDoS on malformed TEI blocks

Advisory

nltk – Denial of Service (DoS)

Affected Package

Affecting nltk package, versions
<= 3.10.2

Also affects

---

How to Fix

Upgrade
nltk
to
3.10.3
or higher.

Mitigation and Workarounds

---

Vulnerable Functions

Functions linked to known vulnerabilities.

Vulnerable function data is available for Enterprise customers

Book a call with us to see Safety in action.

Safety

Verified by Safety

Our Cybersecurity Intelligence Team reviewed this vulnerability. We combine public data with our own research to find issues not yet reported to public sources.

Learn more