Skip to content
Medium 5.3

NLTK: Uncontrolled recursion in Toolbox settings helpers causes denial of service via deeply nested input

CVE-2026-129228 First seen on SecPulse

Affected packages

PackageAffected → Fixed
nltknltk —
PyPInltk
< 3.10.4→ 3.10.4
pipnltk
< 3.10.4→ 3.10.4

Fix status by distribution

Records published by each distribution for this CVE. Fixed versions differ by release; check each link.

Original description The description as published by the source.

Root Cause

The Toolbox settings-tree helpers recurse over the parsed element tree without any depth
bound. _to_settings_string (nltk/toolbox.py:418), remove_blanks
(nltk/toolbox.py:432), add_default_fields (nltk/toolbox.py:451), _sort_fields
(nltk/toolbox.py:484), and add_blank_lines (nltk/toolbox.py:502,516) each recurse once
per element level with no depth counter or explicit stack. The producer
ToolboxSettings.parse builds the element tree iteratively, so nesting depth is driven
entirely by attacker-supplied \+marker / \-marker pairs.

Impact

An application that parses an untrusted Toolbox settings file and then serialises or
transforms it through any of the public helper functions aborts with an unhandled
RecursionError, terminating the affected operation or request worker (denial of service,
CWE-674). The recursion is pure Python, yielding a catchable RecursionError rather than
memory corruption or code execution. Confidentiality and integrity are unaffected.

Attack Chain

  1. The application parses an untrusted settings file via ToolboxSettings.open_string /
    open plus parse, producing an N-deep element tree; parsing is iterative and
    completes without error.
  2. The application passes the tree to a public helper — to_settings_string,
    remove_blanks, add_default_fields, sort_fields, or add_blank_lines — as in the
    module's own parse-then-serialise round trip.
  3. The helper recurses once per element level wit…

Source: CVE.org (CVE Program・cvelistV5) NVD GitHub Advisory

References

We use cookies for analytics and ad measurement. This setting applies to all Game co., Ltd. sites. Details