{"vuln_id":"CVE-2026-129224","aliases":["GHSA-3h95-x772-4765"],"description":"nltk: nltk: Denial of Service via uncontrolled recursion in lexicon parser","published_at":"2026-11-19T18:04:56Z","modified_at":"2026-11-22T21:00:08.953724Z","first_seen_at":"2026-11-21T19:15:15.262540Z","severity":"medium","severity_source":"nvd","cvss_score":5.3,"cvss_vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:L","cwe":["CWE-770","CWE-674"],"vendor":null,"product":null,"kev":{"is_kev":false,"date_added":null,"due_date":null,"ransomware":false},"epss":0.00536,"epss_percentile":0.46048,"nvd_status":"Awaiting Analysis","enriched_at":null,"links":{"nvd":"https://nvd.nist.gov/vuln/detail/CVE-2026-129224"},"matched_alias":null,"items":[{"id":10701,"source":{"id":"osv","name":"OSV.dev"},"title":"GHSA-3h95-x772-4765: NLTK: Uncontrolled recursion in CCG lexicon parser causes denial of service via deeply nested category input","summary":"NLTK: Uncontrolled recursion in CCG lexicon parser causes denial of service via deeply nested category input\n\n## Root Cause\nThe CCG lexicon parser recurses on nested parenthesised categories without any depth\nbound. `matchBrackets` (`nltk/ccg/lexicon.py:154`) calls itself once per nested `(`, and\n`augParseCategory` (`nltk/ccg/lexicon.py:228,242`) recurses once per bracketed\nsub-category. Neither function tracks recursion depth nor checks\n`sys.getrecursionlimit()`, and the public entry point `fromstring`\n(`nltk/ccg/lexicon.py:252`, also re-exported via `nltk.ccg.chart.fromstring`) applies no\nlength or nesting cap before handing the text to the parser.\n\n## Impact\nAn application that parses an untrusted lexicon string aborts with an unhandled\n`RecursionError`, terminating the affected parse operation or request worker\n(denial of service, CWE-674). The recursion is pure Python, so CPython raises a catchable\n`RecursionError` rather than crashing the process; there is no memory-corruption or\ncode-execution primitive. Confidentiality and integrity are unaffected. Plausibly, a\nservice that does not wrap the parse in a handler will surface the error to the caller and\ndrop the in-flight request.\n\n## Attack Chain\n1. The application calls `nltk.ccg.lexicon.fromstring(lex_str)` with attacker-supplied\n   text such as `\":- S\\nw => \" + \"(\" * 2000 + \"S\" + \")\" * 2000 + \"\\n\"`.\n2. `fromstring` splits the input into lines; `LEX_RE`/`RHS_RE`\n   (`nltk/ccg/lexicon.py:275-276`) match and route the parenthesised category into\n   `augParseCategory` (`nltk/ccg/lexicon.py:277`) with no depth or length guard.\n3. Because the category starts with `(`, `nextCategory` dispatches to `matchBrackets`,\n   which recurses once per nested `(`; `augParseCategory` recurses once per bracketed\n   sub-category. Each nesting level consumes call-stack frames.\n4. Once the depth exceeds the interpreter recursion limit, an unhandled `RecursionError`\n   propagates out of the public API and aborts the parse.\n\n## Bypass Evidence\nRunning the dependency-free `matchBrackets` body verbatim from the shipped source at the\ndefault recursion limit (1000): a well-formed balanced input at depth 5 and 500 parses\ncleanly, while depth 2000 and 5000 raise an unhandled `RecursionError`. Because shallow,\nbalanced input parses without error, the failure is depth-driven rather than a generic\nparse error. The crash triggers near ~1000 nesting levels at the default limit, so the\npayload need not be extreme. A repository-wide search confirms no depth/recursion guard\nexists anywhere under `nltk/ccg/` (the only recent change to this file routed regexes\nthrough `nltk.redos` and added no recursion bound).\n\n## Suggested Fix\nAdd a recursion-depth choke point on the lexicon-parsing path — for example a depth\ncounter that raises a bounded `ValueError` past a configurable maximum, mirroring the\nexisting guards on `FeatStructReader` (`nltk/featstruct.py`), `Tree.fromstring`\n(`MAX_TREE_DEPTH`, `nltk/tree/tree.py`), and `LogicParser` (`MAX_PARSE_DEPTH`,\n`nltk/sem/logic.py`).\n\nReported by pi (GitHub: @manus-pi).\n\n## Fix status (2026-09-28)\n\nAffected: PyPI:nltk\n\nFixed in: 3.10.4\n\nReferences:\nhttps://github.com/nltk/nltk/security/advisories/GHSA-3h95-x772-4765\nhttps://nvd.nist.gov/vuln/detail/CVE-2026-129224\nhttps://github.com/nltk/nltk/pull/3885\nhttps://github.com/nltk/nltk/commit/30e93eb7b69021293e019042fe0cedb99c95b054\nhttps://github.com/nltk/nltk\nhttps://github.com/nltk/nltk/releases/tag/v3.10.4","url":"https://osv.dev/vulnerability/GHSA-3h95-x772-4765","published_at":"2026-11-19T23:52:54Z","updated_at":"2026-11-20T00:00:04.077530Z","fetched_at":"2026-11-21T19:15:55.946115Z","severity":"medium","cvss_score":5.3,"epss":0.00536,"is_kev":false,"has_exploit":false,"kev_due_date":null,"vendor":null,"product":"nltk","vuln_id":"CVE-2026-129224","vuln_ids":["CVE-2026-129224","GHSA-3H95-X772-4765"],"tags":["osv","pypi","fix-available"],"cluster_id":2145,"links":{"self":"https://vulnwatch.ve1ve2.com/api/v1/items/10701","html":"https://vulnwatch.ve1ve2.com/item/10701"}},{"id":2357,"source":{"id":"ghsa","name":"GitHub Security Advisories"},"title":"GHSA-3h95-x772-4765 / CVE-2026-129224: NLTK: Uncontrolled recursion in CCG lexicon parser causes denial of service via deeply nested category input","summary":"NLTK: Uncontrolled recursion in CCG lexicon parser causes denial of service via deeply nested category input\n\n## Root Cause\nThe CCG lexicon parser recurses on nested parenthesised categories without any depth\nbound. `matchBrackets` (`nltk/ccg/lexicon.py:154`) calls itself once per nested `(`, and\n`augParseCategory` (`nltk/ccg/lexicon.py:228,242`) recurses once per bracketed\nsub-category. Neither function tracks recursion depth nor checks\n`sys.getrecursionlimit()`, and the public entry point `fromstring`\n(`nltk/ccg/lexicon.py:252`, also re-exported via `nltk.ccg.chart.fromstring`) applies no\nlength or nesting cap before handing the text to the parser.\n\n## Impact\nAn application that parses an untrusted lexicon string aborts with an unhandled\n`RecursionError`, terminating the affected parse operation or request worker\n(denial of service, CWE-674). The recursion is pure Python, so CPython raises a catchable\n`RecursionError` rather than crashing the process; there is no memory-corruption or\ncode-execution primitive. Confidentiality and integrity are unaffected. Plausibly, a\nservice that does not wrap the parse in a handler will surface the error to the caller and\ndrop the in-flight request.\n\n## Attack Chain\n1. The application calls `nltk.ccg.lexicon.fromstring(lex_str)` with attacker-supplied\n   text such as `\":- S\\nw => \" + \"(\" * 2000 + \"S\" + \")\" * 2000 + \"\\n\"`.\n2. `fromstring` splits the input into lines; `LEX_RE`/`RHS_RE`\n   (`nltk/ccg/lexicon.py:275-276`) match and route the parenthesised category into\n   `augParseCategory` (`nltk/ccg/lexicon.py:277`) with no depth or length guard.\n3. Because the category starts with `(`, `nextCategory` dispatches to `matchBrackets`,\n   which recurses once per nested `(`; `augParseCategory` recurses once per bracketed\n   sub-category. Each nesting level consumes call-stack frames.\n4. Once the depth exceeds the interpreter recursion limit, an unhandled `RecursionError`\n   propagates out of the public API and aborts the parse.\n\n## Bypass Evidence\nRunning the dependency-free `matchBrackets` body verbatim from the shipped source at the\ndefault recursion limit (1000): a well-formed balanced input at depth 5 and 500 parses\ncleanly, while depth 2000 and 5000 raise an unhandled `RecursionError`. Because shallow,\nbalanced input parses without error, the failure is depth-driven rather than a generic\nparse error. The crash triggers near ~1000 nesting levels at the default limit, so the\npayload need not be extreme. A repository-wide search confirms no depth/recursion guard\nexists anywhere under `nltk/ccg/` (the only recent change to this file routed regexes\nthrough `nltk.redos` and added no recursion bound).\n\n## Suggested Fix\nAdd a recursion-depth choke point on the lexicon-parsing path — for example a depth\ncounter that raises a bounded `ValueError` past a configurable maximum, mirroring the\nexisting guards on `FeatStructReader` (`nltk/featstruct.py`), `Tree.fromstring`\n(`MAX_TREE_DEPTH`, `nltk/tree/tree.py`), and `LogicParser` (`MAX_PARSE_DEPTH`,\n`nltk/sem/logic.py`).\n\nReported by pi (GitHub: @manus-pi).\n\n## Fix status (2026-09-28)\n\nAffected packages: pip:nltk\nPatched: nltk 3.10.4","url":"https://github.com/advisories/GHSA-3h95-x772-4765","published_at":"2026-11-19T23:52:54Z","updated_at":"2026-11-19T23:52:55Z","fetched_at":"2026-11-21T19:15:18.416775Z","severity":"medium","cvss_score":5.3,"epss":0.00536,"is_kev":false,"has_exploit":false,"kev_due_date":null,"vendor":null,"product":"nltk","vuln_id":"CVE-2026-129224","vuln_ids":["CVE-2026-129224","GHSA-3H95-X772-4765"],"tags":["ghsa","pip","CWE-674"],"cluster_id":2145,"links":{"self":"https://vulnwatch.ve1ve2.com/api/v1/items/2357","html":"https://vulnwatch.ve1ve2.com/item/2357"}},{"id":15156,"source":{"id":"osv","name":"OSV.dev"},"title":"DEBIAN-CVE-2026-129224: NLTK (Natural Language Toolkit) is a suite of open source Python modules, data sets, and tutorials supporting research and development in Natural Language Proc…","summary":"NLTK (Natural Language Toolkit) is a suite of open source Python modules, data sets, and tutorials supporting research and development in Natural Language Processing. Prior to 3.10.4, the CCG lexicon parser's matchBrackets and augParseCategory functions recursively process nested parenthesized categories without a depth bound. An attacker-controlled lexicon string with excessive nesting can raise RecursionError through nltk.ccg.lexicon.fromstring and terminate the parse operation or request worker. This issue is fixed in version 3.10.4.\n\nAffected: Debian:12:nltk, Debian:13:nltk, Debian:14:nltk\n\nNo fixed version published yet\n\nReferences:\nhttps://security-tracker.debian.org/tracker/CVE-2026-129224","url":"https://osv.dev/vulnerability/DEBIAN-CVE-2026-129224","published_at":"2026-11-19T19:17:21.473000Z","updated_at":"2026-11-22T21:00:08.953724Z","fetched_at":"2026-11-23T03:05:53.019724Z","severity":"medium","cvss_score":5.3,"epss":0.00536,"is_kev":false,"has_exploit":false,"kev_due_date":null,"vendor":"debian","product":"12:nltk","vuln_id":"CVE-2026-129224","vuln_ids":["CVE-2026-129224","DEBIAN-CVE-2026-129224","GHSA-3H95-X772-4765"],"tags":["osv","debian","no-fix-yet"],"cluster_id":830,"links":{"self":"https://vulnwatch.ve1ve2.com/api/v1/items/15156","html":"https://vulnwatch.ve1ve2.com/item/15156"}},{"id":9068,"source":{"id":"nvd","name":"NVD CVE API 2.0"},"title":"CVE-2026-129224: NLTK (Natural Language Toolkit) is a suite of open source Python modules, data sets, and tutorials supporting research and development in Natural Language Proc…","summary":"NLTK (Natural Language Toolkit) is a suite of open source Python modules, data sets, and tutorials supporting research and development in Natural Language Processing. Prior to 3.10.4, the CCG lexicon parser's matchBrackets and augParseCategory functions recursively process nested parenthesized categories without a depth bound. An attacker-controlled lexicon string with excessive nesting can raise RecursionError through nltk.ccg.lexicon.fromstring and terminate the parse operation or request worker. This issue is fixed in version 3.10.4.\n\nReferences:\nhttps://github.com/nltk/nltk/commit/30e93eb7b69021293e019042fe0cedb99c95b054\nhttps://github.com/nltk/nltk/pull/3885\nhttps://github.com/nltk/nltk/releases/tag/v3.10.4\nhttps://github.com/nltk/nltk/security/advisories/GHSA-3h95-x772-4765\nhttps://github.com/nltk/nltk/security/advisories/GHSA-3h95-x772-4765","url":"https://nvd.nist.gov/vuln/detail/CVE-2026-129224","published_at":"2026-11-19T19:17:21.473000Z","updated_at":"2026-11-19T20:17:23.643000Z","fetched_at":"2026-11-21T19:15:31.484715Z","severity":"medium","cvss_score":5.3,"epss":0.00536,"is_kev":false,"has_exploit":false,"kev_due_date":null,"vendor":null,"product":null,"vuln_id":"CVE-2026-129224","vuln_ids":["CVE-2026-129224","GHSA-3H95-X772-4765"],"tags":["CWE-674"],"cluster_id":830,"links":{"self":"https://vulnwatch.ve1ve2.com/api/v1/items/9068","html":"https://vulnwatch.ve1ve2.com/item/9068"}},{"id":1091,"source":{"id":"redhat","name":"Red Hat Security Data API"},"title":"CVE-2026-129224: nltk: nltk: Denial of Service via uncontrolled recursion in lexicon parser","summary":"nltk: nltk: Denial of Service via uncontrolled recursion in lexicon parser","url":"https://access.redhat.com/security/cve/cve-2026-129224","published_at":"2026-11-19T18:04:56Z","updated_at":null,"fetched_at":"2026-11-21T19:15:08.893736Z","severity":"medium","cvss_score":5.3,"epss":0.00536,"is_kev":false,"has_exploit":false,"kev_due_date":null,"vendor":"redhat","product":null,"vuln_id":"CVE-2026-129224","vuln_ids":["CVE-2026-129224","GHSA-3H95-X772-4765"],"tags":["redhat"],"cluster_id":830,"links":{"self":"https://vulnwatch.ve1ve2.com/api/v1/items/1091","html":"https://vulnwatch.ve1ve2.com/item/1091"}}]}