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.

Created at: Jun 5, 2026Updated at: Jun 5, 2026

Overview

Natural Language Toolkit (NLTK) has unbounded recursion in JSONTaggedDecoder.decode_obj() may cause DoS

Advisory

nltk – Uncontrolled Recursion

Affected Package

Affecting nltk package, versions
<=3.9.3

Also affects

---

How to Fix

Upgrade
nltk
to
3.9.4
or higher.

Mitigation and Workarounds

---

Vulnerable Functions

Functions linked to known vulnerabilities.

Vulnerable function data is available for Enterprise customers

Book a call with us to see Safety in action.

Safety

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