CVE-2026-129227
## Root Cause `Tree.fromlist` (`nltk/tree/tree.py:767`) converts a nested list into a `Tree` by recursing once per nesting level (`nltk/tree/tree.py:780`) with no depth bound — its only validation is `type(l) == list and len(l) > 0`. The sibling constructor `Tree.fromstring` was hardened with a `MAX_TREE_DEPTH` cap (`nltk/tree/tree.py:31,695`) that rejects adversarially deep input with a bounded `ValueError`, but that guard was not applied to `fromlist`, which builds `Tree` objects identically. ## Impact An application that builds a `Tree` from an attacker-controlled nested list — for example `Tree.fromlist(json.loads(untrusted))` — aborts with an unhandled `RecursionError`, terminating the affected operation or request worker (denial of service, CWE-674). Any later recursive traversal of an over-deep tree (`height`, `pformat`, equality) fails the same way. 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 obtains an attacker-controlled deeply nested list, typically by decoding an untrusted JSON payload, and calls `nltk.tree.Tree.fromlist(l)`. 2. `fromlist` checks only that the argument is a non-empty list; it applies no depth cap. 3. `fromlist` recurses once per nesting level, consuming call-stack frames; the `MAX_TREE_DEPTH` guard used by `fromstring` is never invoked on this path. 4. Once the nesting depth exceeds the interpreter recursion limit, an unhandled `RecursionError` propagates out of the public API. ## Bypass Evidence Running the shipped `fromlist` body verbatim at the default recursion limit: depth 5 builds cleanly while depth 5000 raises an unhandled `RecursionError`. The realistic JSON-delivery objection does not hold: CPython's C JSON decoder tolerates far deeper nesting than the pure-Python `fromlist` recursion, so there is a wide window (measured from roughly depth 500 up to ~1500 at the de
Properties
- Summary
- NLTK: Uncontrolled recursion in Tree.fromlist causes denial of service via deeply nested list input
- Severity
- medium
- Nvd fetched at
- 2026-11-22T12:30:49.958423+00:00
- Epss score
- 0.00419
- Cvss score
- 5.3
- Cvss severity
- MEDIUM
- Retrieved at
- 2026-11-22T12:32:26+00:00
- Ghsa published
- 2026-11-19T23:51:08Z
- Source url
- https://github.com/advisories/GHSA-63wh-5r5m-wxr7
- Ghsa updated
- 2026-11-19T23:51:08Z
- Ghsa id
- GHSA-63wh-5r5m-wxr7
- Last source
- FIRST EPSS
- Score
- 5.3
- Cvss version
- 3.1
- Cve id
- CVE-2026-129227
- Cvss vector
- CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:L
- First seen by Signal
- 2026-11-19T19:29:21+00:00
- Name
- CVE-2026-129227
- Is ghsa only
- false
- Vector
- CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:L
Related Entities (3)
AFFECTS (1)
HAS_WEAKNESS (1)
VULNERABLE_TO (1)
Related research
Explore deeper with Ninja Signal's threat intelligence graph