# NLTK uncontrolled recursion in FeatStructReader denial of service

Source: https://junglewise.ai/threats/nltk-uncontrolled-recursion-in-featstructreader-denial-of-service-e246abcc  
Publisher: Junglewise Threat Intelligence, https://junglewise.ai/threats  
Published: 2026-08-27. Updated: 2026-09-25  
License: CC BY 4.0 with a link back

Severity: medium · CVSS 5.3 · Published 2026-08-27

NLTK is a widely-used natural language processing library; its FeatStructReader component parses feature structures used in linguistic grammars. An unauthenticated attacker can send a trivial payload (less than 1 KB) of deeply nested brackets to crash any application that accepts user-supplied feature structures or grammars—for example, NLP teaching tools, grammar playgrounds, or unification-grammar-based NLU systems. The crash is caused by an unhandled exception and can lead to service downtime if the application lacks automatic recovery.

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

## Quick answers

**Is This vulnerability exploited in the wild?** No. Junglewise Threat Intelligence has no report of This vulnerability being exploited in the wild.

**How severe is This vulnerability?** Medium severity, with a CVSS score of 5.3, published 27 August 2026.

**Which products and versions are affected?** nltk (PyPI) <= 3.10.2.

**Is there a fix for This vulnerability?** A patch was published on 2026-08-27: Fix available in NLTK 3.10.3 and later Junglewise finds every place you run it, drafts the upgrade and applies it once you approve.

**How is This vulnerability attacked?** It is attacked over the network, in a software library.

**Am I affected?** 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.

## Technical details

The vulnerability exists in nltk.featstruct.FeatStructReader, a recursive-descent parser that processes feature-structure notation (e.g., [a=1]). The parser contains a recursive call cycle (FeatStructReader.read_partial → _read_partial_featdict → _read_value → read_value → read_fstruct_value → read_partial) with no nesting-depth limit or guard. When input contains deeply nested brackets, the recursion depth exceeds Python's built-in limit, raising an unhandled RecursionError—a subclass not caught by the parser's normal exception handlers (which expect ValueError). The same vulnerability affects FeatureGrammar.fromstring(), which uses the same parser for embedded feature structures. A proof-of-concept payload of 669 bytes with 167 levels of nesting crashes in under 2 milliseconds. Similar issues in other NLTK modules (logic.py, jsontags.py) were previously fixed by enforcing a MAX_*_DEPTH constant; featstruct.py lacked equivalent protection. The vulnerability is patched in NLTK 3.10.3 by adding recursion-depth checks.

## Affected products

- NLTK Project NLTK <= 3.10.2

## Timeline

- 2026-08-12: disclosed: Original advisory GHSA-cw6x-m8jw-qmrh published
- 2026-08-27: advisory: Duplicate advisory GHSA-pf76-q698-37v8 published
- 2026-08-27: patched: Fix available in NLTK 3.10.3 and later

## References

- [https://github.com/nltk/nltk/security/advisories/GHSA-cw6x-m8jw-qmrh](https://github.com/nltk/nltk/security/advisories/GHSA-cw6x-m8jw-qmrh)
- [https://www.vulncheck.com/advisories/nltk-before-3.10.3-denial-of-service-via-uncontrolled-recursion](https://www.vulncheck.com/advisories/nltk-before-3.10.3-denial-of-service-via-uncontrolled-recursion)

## 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 RecursiveDescentParser uncontrolled recursion denial of service](https://junglewise.ai/threats/cve-2026-12876-nltk-recursivedescentparser-uncontrolled-recursion-denial-of)
- [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)
