# CVE-2026-12876: NLTK RecursiveDescentParser uncontrolled recursion denial of service

Source: https://junglewise.ai/threats/cve-2026-12876-nltk-recursivedescentparser-uncontrolled-recursion-denial-of  
Publisher: Junglewise Threat Intelligence, https://junglewise.ai/threats  
Published: 2026-09-02. Updated: 2026-09-25  
License: CC BY 4.0 with a link back

CVE-2026-12876 · Severity: medium · CVSS 4 · Published 2026-09-02

NLTK is a widely-used Python library for natural language processing that includes parsers for analyzing text based on grammars. The RecursiveDescentParser component fails to limit recursive operations when processing certain ambiguous or left-recursive grammars, allowing an attacker to supply a tiny crafted grammar or input that causes the parser to consume unbounded CPU cycles and exhaust the Python call stack, permanently blocking the affected process. This is a single-process availability attack with no data breach or system integrity risk.

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

## Quick answers

**Is CVE-2026-12876 exploited in the wild?** No. Junglewise Threat Intelligence has no report of CVE-2026-12876 being exploited in the wild.

**How severe is CVE-2026-12876?** Medium severity, with a CVSS score of 4, published 2 September 2026.

**Which products and versions are affected?** nltk (PyPI) <= 3.10.2, ECOSYSTEM:introduced=0,fixed=3.10.3.

**Is there a fix for CVE-2026-12876?** Yes. nltk (PyPI): upgrade to 3.10.3 or later. Junglewise finds every place you run it, drafts the upgrade and applies it once you approve.

**How is CVE-2026-12876 attacked?** It is attacked over the network.

**Am I affected by CVE-2026-12876?** 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.

## How to fix

- nltk (PyPI): upgrade to 3.10.3 or later

  ```sh
  pip install "nltk>=3.10.3"
  ```


## Technical details

The RecursiveDescentParser (and SteppingRecursiveDescentParser) in NLTK enumerate parse trees top-down with no upper bound on the number of recursive steps (CWE-407, CWE-674). Two attack patterns are demonstrated: (a) left-recursive grammars (e.g., "S -> S S | 'a'") trigger unbounded recursion depth; (b) ambiguous grammars (e.g., "S -> 'a' S | 'a' S S | 'a'") cause exponential enumeration of parse trees. Both hang on a 24-token input with super-linear growth in input length. Attack vector is network-capable if the grammar or input is drawn from an untrusted source. The fix (in NLTK 3.10.3+) adds a wall-clock max_time limit (default 5 seconds) checked on every recursive _parse entry, protecting by default while allowing opt-out via max_time=None.

## Affected products

- NLTK Project NLTK <= 3.10.2

## Identifiers

- CVE-2026-12876
- GHSA-ff5c-cp5c-9wjf
- PYSEC-2026-3869

## Timeline

- 2026-08-12: disclosed: Published to GitHub Advisory Database
- 2026-08-12: patched: Fix committed; NLTK 3.10.3 released
- 2026-09-02: advisory: Advisory GHSA-ff5c-cp5c-9wjf published

## References

- [https://github.com/nltk/nltk/security/advisories/GHSA-ff5c-cp5c-9wjf](https://github.com/nltk/nltk/security/advisories/GHSA-ff5c-cp5c-9wjf)
- [https://github.com/nltk/nltk/pull/3649](https://github.com/nltk/nltk/pull/3649)
- [https://github.com/nltk/nltk/commit/43aaca1b9024138421c97f970bf13ee19ac8129d](https://github.com/nltk/nltk/commit/43aaca1b9024138421c97f970bf13ee19ac8129d)
- [https://github.com/nltk/nltk/releases/tag/v3.10.3](https://github.com/nltk/nltk/releases/tag/v3.10.3)
- [https://api.github.com/repos/nltk/nltk/security-advisories/GHSA-ff5c-cp5c-9wjf](https://api.github.com/repos/nltk/nltk/security-advisories/GHSA-ff5c-cp5c-9wjf)

## 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 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 Pl196xCorpusReader quadratic ReDoS on malformed TEI blocks](https://junglewise.ai/threats/nltk-pl196xcorpusreader-quadratic-redos-on-malformed-tei-blocks-8473e6ef)
- [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)
