NLTK: ReDoS in nltk.text.Text.findall() via unvalidated user-supplied regular expressions
High7.5CVE-2026-80205 · Published Sep 8, 2026
Affected versions
| Package | Affected | Fixed in |
|---|---|---|
| nltk PyPI | < 3.10.0 | 3.10.0 |
Details and references
### Summary NLTK's `Text.findall()` and `TokenSearcher.findall()` methods accept user-supplied regular expressions and pass them to the Python `re` engine without timeout or validation, enabling catastrophic backtracking (ReDoS). This issue is isolated to the `nltk.text` module and was resolved in a prior commit. ### Affected Code `nltk/text.py` , `TokenSearcher.findall()` (line 255) / `Text.findall()` (line 620) `TokenSearcher.__init__` builds an internal string by wrapping each token in angle brackets. The `findall()` method preprocesses the caller-supplied regexp and runs it directly against this string with no timeout: ```python def findall(self, regexp): # Preprocessing does NOT prevent catastrophic backtracking regexp = re.sub(r"\s", "", regexp) regexp = re.sub(r"<", "(?:<(?:", regexp) regexp = re.sub(r">", ")>)", regexp) regexp = re.sub(r"(?<!\\)\.", "[^>]", regexp) # User-controlled regexp executed with no timeout hits = re.findall(regexp, self._raw) ``` The preprocessing transforms `<` and `>` angle-bracket syntax but does not inspect or reject catastrophically backtracking patterns. ### Proof of Concept ```python import nltk import time # Token of 25 'a' characters produces self._raw = "<aaaaaaaaaaaaaaaaaaaaaaaa!>" # The trailing '!' ensures no match, forcing full backtracking. text = nltk.Text(["a" * 25 + "!"]) # Pattern after transformation: # < → (?:<(?: # > → )>) # Becomes: (?:<(?:((a+)+)b)>) # re.findall runs this against "<aaaaaaaaaaaaaaaaaaaaaaaa!>" , hangs. start = time.time() text.findall(r"<((a+)+)b>") # Never returns ``` ### Impact Applications that expose `Text.findall()` to external input are vulnerable to a denial of service. An unauthenticated attacker can cause indefinite CPU saturation with one request, denying service to all other users of the Python process. ### Remediation This vulnerability was patched in commit `d8e4753`. Users should update to the patched version. ### Credit Tool: Kira by [Offgrid Security](https://www.offgridsec.com)
- CVSS 3.1
- CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H
- Severity from
- GitHub (reviewed advisory)
- Weakness
- CWE-1333
- Also known as
- CVE-2026-80205, PYSEC-2026-3750
- github.com/nltk/nltk/security/advisories/GHSA-rrv8-h7p8-rx55
- nvd.nist.gov/vuln/detail/CVE-2026-80205
- github.com/nltk/nltk/pull/3674
- github.com/nltk/nltk/commit/d8e47539317b571ab1422981f5b9653d5eae1249
- github.com/nltk/nltk
- github.com/nltk/nltk/releases/tag/v3.10.0
- github.com/pypa/advisory-database/tree/main/vulns/nltk/PYSEC-2026-3750.yaml
- www.vulncheck.com/advisories/nltk-before-3.10.0-redos-via-text-findall-unvalidated-regex
- www.openwall.com/lists/oss-security/2026/09/01/3
More NLTK advisories
All NLTK| Date | Advisory | Severity | Fixed in |
|---|---|---|---|
| Sep 8 | NLTK: Symlink escape in CorpusReader allows arbitrary local file read outside the corpus root CVE-2026-70626High6.2fixed in 3.9.4 | High6.2 | 3.9.4 |
| Sep 8 | NLTK: FileSystemPathPointer.open() sandbox check is dead code , arbitrary file read via file:// protocol CVE-2026-65915Medium6.5fixed in 3.10.0 | Medium6.5 | 3.10.0 |
| Sep 8 | NLTK: StreamBackedCorpusView Bypasses pathsec.ENFORCE - Arbitrary Local File Read CVE-2026-63312Highfixed in 3.10.0 | High | 3.10.0 |
| Sep 8 | NLTK: Missing Post-Download Integrity Verification Allows Malicious Package Injection CVE-2026-12259Medium5.3fixed in 3.9.3 | Medium5.3 | 3.9.3 |
| Sep 8 | NLTK: Stable FrameNet and NKJP readers parse outside-root XML CVE-2026-62385High5.9fixed in 3.10.0 | High5.9 | 3.10.0 |
| Sep 8 | NLTK: Symlink-based sandbox bypass in FramenetCorpusReader (bypasses the fix for CVE-2026-54292) CVE-2026-62384High7.5fixed in 3.10.2 | High7.5 | 3.10.2 |