Natural Language Toolkit (NLTK): ReDoS in NLTK ReviewsCorpusReader FEATURES regex (CVE-2026-12061)
Natural Language Toolkit (NLTK) versions prior to 3.10.0 contain a Regular Expression Denial of Service (ReDoS) vulnerability in the ReviewsCorpusReader's FEATURES regex. The vulnerable regex uses an unbounded greedy pattern to extract feature annotations, which on long bracket-less lines causes quadratic backtracking and high CPU consumption. This can hang functions like reviews(), features(), and sents() when processing crafted input lines. The issue allows denial of service by stalling processing on a single malicious review line without requiring authentication or privileges.
AI Analysis
Technical Summary
The ReviewsCorpusReader in NLTK uses a module-level FEATURES regex to extract feature annotations formatted as a label followed by a bracketed signed digit (e.g., label[+2]). The label sub-pattern is an unbounded greedy run of word-plus-whitespace groups followed by a word, which must be followed by a literal '['. On input lines that are long sequences of words without brackets, the regex engine performs quadratic backtracking due to repeated failed attempts to match the bracket at each position. This results in O(n²) CPU time relative to the line length, causing the reader functions to hang on a single crafted line. A fix was introduced by bounding the number of word-plus-whitespace groups, reducing the complexity to linear time while preserving extraction correctness on realistic data.
Potential Impact
An attacker can cause denial of service by supplying a single crafted review line with a very long sequence of words and no bracketed annotation. Processing this line with ReviewsCorpusReader functions (reviews(), features(), sents()) results in excessive CPU consumption and hanging of the processing thread or process. No authentication or privileges are required, so any user-supplied or untrusted corpus can be used to trigger this condition, potentially stalling multi-tenant pipelines or batch jobs.
Mitigation Recommendations
A patch is available that introduces a bound on the number of word-plus-whitespace groups in the FEATURES regex, preventing quadratic backtracking. Users should upgrade to NLTK version 3.10.0 or later where this fix is applied. Until patched, avoid processing untrusted or user-supplied review corpora that may contain long bracket-less lines. The vendor advisory confirms a fix is available.
Natural Language Toolkit (NLTK): ReDoS in NLTK ReviewsCorpusReader FEATURES regex (CVE-2026-12061)
Description
Natural Language Toolkit (NLTK) versions prior to 3.10.0 contain a Regular Expression Denial of Service (ReDoS) vulnerability in the ReviewsCorpusReader's FEATURES regex. The vulnerable regex uses an unbounded greedy pattern to extract feature annotations, which on long bracket-less lines causes quadratic backtracking and high CPU consumption. This can hang functions like reviews(), features(), and sents() when processing crafted input lines. The issue allows denial of service by stalling processing on a single malicious review line without requiring authentication or privileges.
CVSS v3.1
Score 7.5high
Affected software
Run on your own infrastructure? Check whether these packages are installed with threat-finder — our free open-source scanner.
Weaknesses
AI-Powered Analysis
Machine-generated threat intelligence
Technical Analysis
The ReviewsCorpusReader in NLTK uses a module-level FEATURES regex to extract feature annotations formatted as a label followed by a bracketed signed digit (e.g., label[+2]). The label sub-pattern is an unbounded greedy run of word-plus-whitespace groups followed by a word, which must be followed by a literal '['. On input lines that are long sequences of words without brackets, the regex engine performs quadratic backtracking due to repeated failed attempts to match the bracket at each position. This results in O(n²) CPU time relative to the line length, causing the reader functions to hang on a single crafted line. A fix was introduced by bounding the number of word-plus-whitespace groups, reducing the complexity to linear time while preserving extraction correctness on realistic data.
Potential Impact
An attacker can cause denial of service by supplying a single crafted review line with a very long sequence of words and no bracketed annotation. Processing this line with ReviewsCorpusReader functions (reviews(), features(), sents()) results in excessive CPU consumption and hanging of the processing thread or process. No authentication or privileges are required, so any user-supplied or untrusted corpus can be used to trigger this condition, potentially stalling multi-tenant pipelines or batch jobs.
Mitigation Recommendations
A patch is available that introduces a bound on the number of word-plus-whitespace groups in the FEATURES regex, preventing quadratic backtracking. Users should upgrade to NLTK version 3.10.0 or later where this fix is applied. Until patched, avoid processing untrusted or user-supplied review corpora that may contain long bracket-less lines. The vendor advisory confirms a fix is available.
Technical Details
- Gcve Source
- db.gcve.eu
- Osv Id
- GHSA-fg7f-2386-8897
- Osv Schema Version
- 1.4.0
- Aliases
- ["CVE-2026-12061"]
- Ecosystems
- ["PyPI"]
- Database Specific Severity
- HIGH
- Cvss Version
- 3.1
Threat ID: 6a6cf7f1bf32cb7a342b3ed2
Added to database: 07/31/2026, 19:30:57 UTC
Last enriched: 07/31/2026, 19:48:31 UTC
Last updated: 07/31/2026, 19:48:31 UTC
Views: 1
Community Reviews
0 reviewsCrowdsource mitigation strategies, share intel context, and vote on the most helpful responses. Sign in to add your voice and help keep defenders ahead.
Want to contribute mitigation steps or threat intel context? Sign in or create an account to join the community discussion.
Actions
Updates to AI analysis require Pro Console access. Upgrade inside Console → Billing.
Need more coverage?
Upgrade to Pro Console for AI refresh and higher limits.
For incident response and remediation, OffSeq services can help resolve threats faster.
Latest Threats
Check if your credentials are on the dark web
Instant breach scanning across billions of leaked records. Free tier available.