PyPI: nltk
GHSA-rf74-v2fm-23pw
Safety vulnerability ID: SFTY-20260320-58622
Affected versions of the Natural Language Toolkit (NLTK) package are vulnerable to Denial of Service (DoS) due to unbounded recursion in the `JSONTaggedDecoder.decode_obj()` method. The `decode_obj()` method recursively processes JSON objects and lists without enforcing a maximum recursion depth, leading to a `RecursionError` when processing deeply nested JSON structures. An attacker can exploit this vulnerability by supplying a crafted JSON payload with excessive nesting, causing the Python process to crash and potentially disrupting services relying on NLTK for JSON decoding.
Overview
Natural Language Toolkit (NLTK) has unbounded recursion in JSONTaggedDecoder.decode_obj() may cause DoS
Advisory
nltk – Uncontrolled Recursion
How to Fix
Mitigation and Workarounds
---
Vulnerable Functions
Functions linked to known vulnerabilities.
References
- https://getsafety.com/vulnerabilities/SFTY-20260320-58622
- https://data.safetycli.com/changelogs/nltk/
- https://github.com/advisories/GHSA-rf74-v2fm-23pw
- https://pypi.org/project/nltk
- https://github.com/nltk/nltk/commit/00cdcd392142e6c745e7120c8d50a24127df5fad
- https://github.com/nltk/nltk/security/advisories/GHSA-rf74-v2fm-23pw
- https://github.com/advisories/GHSA-rf74-v2fm-23pw
Verified by Safety
Our Cybersecurity Intelligence Team reviewed this vulnerability. We combine public data with our own research to find issues not yet reported to public sources.
Learn more
