A vulnerability in the Natural Language Toolkit (NLTK) allows an attacker to cause unbounded CPU consumption by exploiting a parser that lacks timeout protections. The flaw affects version 3.10.3 and was patched in version 3.10.4.
Quick Take
- What:
SteppingRecursiveDescentParser.parse()in NLTK performs unbounded searches on ambiguous grammars with no time limit - Who is affected: Applications using NLTK 3.10.3 that parse attacker-influenced grammars with
SteppingRecursiveDescentParser - Severity: High (CVSS 7.5), can cause denial of service by pinning CPU cores indefinitely
- Fixed in: NLTK version 3.10.4
- What to do: Update to NLTK 3.10.4 or later
In plain English
NLTK is a popular Python library for working with human language data. One of its components, a parser called SteppingRecursiveDescentParser, has a flaw where it can get stuck in an infinite loop when processing certain types of grammar rules. If an attacker can control the grammar rules and provide a short input, they can make the parser run forever and consume 100% of a CPU core.
What you should do: If you use NLTK in your code, update to version 3.10.4. If you don’t use NLTK or this specific parser, you can ignore this issue.
What happened
The SteppingRecursiveDescentParser class in NLTK performs top-down parsing of context-free grammars. Unlike its base class RecursiveDescentParser, which includes a max_time parameter to enforce a wall-clock deadline (default 5.0 seconds), the stepping subclass overrides the parse() method with its own loop that never checks this deadline.
The stepping parser’s parse() method calls initialize() and then runs while self.step() is not None, driving its own step loop without arming or consulting the inherited _parse_deadline or _max_time attributes. Its __init__ signature omits the max_time parameter entirely, so callers cannot enable or configure a timeout.
When given an ambiguous or self-embedding grammar (such as S -> 'a' S S | 'a') and a short input sequence, the parser enumerates a derivation space that grows on the order of Catalan numbers with no memoization. The GitHub advisory provides a proof-of-concept showing that while the base parser raises TimeoutError after about 2 seconds on 17 tokens, the stepping parser never returns.
An attacker who can influence the grammar and supply input to a service using this parser can force a single parse() call to pin a CPU core indefinitely. In deployments with bounded worker pools, repeated requests exhaust the pool and deny service to legitimate users. No authentication or user interaction is required.
The vulnerability was assigned CVE-2026-126303 and GHSA-8FX7-8JR8-84RV. It affects NLTK version 3.10.3 and was fixed in version 3.10.4. The stepping parser is primarily used for debugging and interactive stepping (backing a GUI), so real-world exposure is narrower than for the base parser, though parse() is a supported public method.
What you should do
Update NLTK to version 3.10.4 or later using pip:
pip install --upgrade nltkIf you cannot update immediately, avoid using SteppingRecursiveDescentParser on untrusted grammars or inputs. Consider using the base RecursiveDescentParser with an explicit max_time parameter instead.
What it means
This vulnerability demonstrates how timeout protections can be inadvertently bypassed in subclasses that override control flow. The stepping parser was designed for interactive use cases where a developer manually steps through parsing states, but its parse() method is a public API that behaves as a full parser without inheriting the safety bounds of its parent class.
The fix in version 3.10.4 likely adds timeout enforcement to the stepping parser’s loop or exposes the max_time parameter in its constructor. Organizations using NLTK for parsing untrusted input should audit their code to ensure they are not using the stepping parser in production contexts where an attacker could supply crafted grammars.



