Junglewise Threat Intelligence

NLTK unbounded recursion in JSONTaggedDecoder.decode_obj

Severity: high · CVSS 7.5 · Published 2026-08-22

Executive brief

NLTK is a popular Python library for natural language processing tasks. The JSONTaggedDecoder component, which parses JSON data, can be exploited by sending deeply nested JSON structures that exceed Python's recursion limit, causing the process to crash and resulting in denial of service.

Technical details

The vulnerability is an uncontrolled recursion flaw (CWE-674) in the JSONTaggedDecoder.decode_obj() method within nltk/jsontags.py. The method recursively processes JSON objects and lists without implementing any depth limit, causing it to exceed Python's default recursion limit (typically 1000) when processing maliciously crafted deeply nested JSON. An attacker can supply externally-sourced JSON with nesting depth exceeding sys.getrecursionlimit() to trigger an unhandled RecursionError that crashes the Python process. The attack requires network reachability to a code path that passes untrusted JSON to JSONTaggedDecoder; no authentication or user interaction is required. The fix, available in version 3.9.4, adds a depth parameter with a hard recursion limit check.

Affected products

  • NLTK Project NLTK <= 3.9.3

Timeline

  • 2026-03-18: disclosed: GHSA-rf74-v2fm-23pw security advisory published
  • 2026-08-22: advisory: Duplicate advisory GHSA-cv2g-m8rr-888c published; NVD entry CVE-2026-66393 created
  • 2026-03-18: patched: Fix available in NLTK 3.9.4

References

Related threats