CVE-2026-81724: NLTK FeatStructReader uncontrolled recursion denial of service

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

NLTK is a widely-used natural language processing library. Its feature-structure parser, used in NLP applications and grammar tools, lacks protection against deeply nested input. An attacker can send a small malicious grammar string (~700 bytes) that causes the application to crash instantly with an unhandled exception. The impact ranges from request failures in web applications to complete process termination in single-threaded workers.

Technologies: nltk (PyPI). Vendors: PyPI.

Quick answers

Is CVE-2026-81724 exploited in the wild?
No. Junglewise Threat Intelligence has no report of CVE-2026-81724 being exploited in the wild.
How severe is CVE-2026-81724?
Medium severity, with a CVSS score of 5.3, published 27 August 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-81724?
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-81724 attacked?
It is attacked over the network, in a software library.
Am I affected by CVE-2026-81724?
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
    pip install "nltk>=3.10.3"

Technical details

The vulnerability is a classic uncontrolled recursion issue (CWE-674) in nltk.featstruct.FeatStructReader. The recursive call chain (_read_partial → _read_value → read_value → read_fstruct_value → read_partial) has no depth counter or MAX_PARSE_DEPTH guard. When deeply nested feature structures like "[a=" repeated 167 times are provided, the parser exceeds Python's recursion limit and raises an unhandled RecursionError instead of the library's normal ValueError. The PoC crashes in ~2ms with just 669 bytes. The parser is reachable via FeatStruct(str) and FeatureGrammar.fromstring(), affecting any application that processes user-supplied grammars. The fix (adding a MAX_PARSE_DEPTH constant and depth check) was already implemented in nltk/sem/logic.py but missing from featstruct.py. Patched in NLTK 3.10.3.

Affected products

  • NLTK Project NLTK <= 3.10.2

Identifiers

  • CVE-2026-81724
  • GHSA-cw6x-m8jw-qmrh
  • PYSEC-2026-3739

Timeline

  • 2026-08-12: disclosed
  • 2026-09-02: advisory: GitHub Security Advisory published
  • 2026-09-02: patched: Fix released in NLTK 3.10.3

References

This page as Markdown. Free to reuse under CC BY 4.0 with a link back.