{"vuln_id":"CVE-2026-129228","aliases":["GHSA-f2h2-f4fc-p978"],"description":"nltk: nltk: Denial of Service via unbounded recursion in ToolboxSettings","published_at":"2026-11-19T18:03:36Z","modified_at":"2026-11-22T21:00:05.730814Z","first_seen_at":"2026-11-21T19:15:15.262546Z","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.00469,"epss_percentile":0.41366,"nvd_status":"Awaiting Analysis","enriched_at":null,"links":{"nvd":"https://nvd.nist.gov/vuln/detail/CVE-2026-129228"},"matched_alias":null,"items":[{"id":10693,"source":{"id":"osv","name":"OSV.dev"},"title":"GHSA-f2h2-f4fc-p978: NLTK: Uncontrolled recursion in Toolbox settings helpers causes denial of service via deeply nested input","summary":"NLTK: Uncontrolled recursion in Toolbox settings helpers causes denial of service via deeply nested input\n\n## Root Cause\nThe Toolbox settings-tree helpers recurse over the parsed element tree without any depth\nbound. `_to_settings_string` (`nltk/toolbox.py:418`), `remove_blanks`\n(`nltk/toolbox.py:432`), `add_default_fields` (`nltk/toolbox.py:451`), `_sort_fields`\n(`nltk/toolbox.py:484`), and `add_blank_lines` (`nltk/toolbox.py:502,516`) each recurse once\nper element level with no depth counter or explicit stack. The producer\n`ToolboxSettings.parse` builds the element tree iteratively, so nesting depth is driven\nentirely by attacker-supplied `\\+marker` / `\\-marker` pairs.\n\n## Impact\nAn application that parses an untrusted Toolbox settings file and then serialises or\ntransforms it through any of the public helper functions aborts with an unhandled\n`RecursionError`, terminating the affected operation or request worker (denial of service,\nCWE-674). The recursion is pure Python, yielding a catchable `RecursionError` rather than\nmemory corruption or code execution. Confidentiality and integrity are unaffected.\n\n## Attack Chain\n1. The application parses an untrusted settings file via `ToolboxSettings.open_string` /\n   `open` plus `parse`, producing an *N*-deep element tree; parsing is iterative and\n   completes without error.\n2. The application passes the tree to a public helper — `to_settings_string`,\n   `remove_blanks`, `add_default_fields`, `sort_fields`, or `add_blank_lines` — as in the\n   module's own parse-then-serialise round trip.\n3. The helper recurses once per element level with no depth guard, consuming call-stack\n   frames. This holds even when the helper's configuration dictionaries are empty.\n4. Once the nesting depth exceeds the interpreter recursion limit, an unhandled\n   `RecursionError` propagates out of the public API.\n\n## Bypass Evidence\nAgainst the shipped source at the default recursion limit, a settings input nested 5 levels\ndeep traverses cleanly through every helper, while a well-formed input nested 5000 levels\ndeep drives each of the five helpers to an unhandled `RecursionError`; the iterative parse\nbuilds the 4999-deep tree without error, isolating the fault to the recursive helpers. The\nconfig-taking helpers (`add_default_fields`, `sort_fields`, `add_blank_lines`) recurse to\nfailure even with empty configuration dictionaries. A repository-wide search confirms no\ndepth guard exists anywhere in this module.\n\n## Suggested Fix\nCap nesting depth at the shared producer `ToolboxSettings.parse` (the choke point that\nbuilds the tree), or convert the five helpers to iterative traversals / add a shared\nrecursion-depth bound, so all consumers are protected by one fix.\n\nReported by pi (GitHub: @manus-pi).\n\n## Fix status (2026-09-28)\n\nStatus: MERGED on develop (unreleased; v3.10.3 of 2026-08-12 predates the fix).\n\nPR: #3885 \"Bound recursion depth in parsers and traversal helpers\" (ekaf), merged 2026-09-11, merge commit e521ecafc on develop.\n\nFix commit: 0b6975377 (nltk/toolbox.py: the settings helpers stop at MAX_TOOLBOX_DEPTH=500 with ValueErr\n\nAffected: PyPI:nltk\n\nFixed in: 3.10.4\n\nReferences:\nhttps://github.com/nltk/nltk/security/advisories/GHSA-f2h2-f4fc-p978\nhttps://nvd.nist.gov/vuln/detail/CVE-2026-129228\nhttps://github.com/nltk/nltk/pull/3885\nhttps://github.com/nltk/nltk/commit/0b6975377d0334af604d32c9d83b26b46e1d437c\nhttps://github.com/nltk/nltk\nhttps://github.com/nltk/nltk/releases/tag/v3.10.4","url":"https://osv.dev/vulnerability/GHSA-f2h2-f4fc-p978","published_at":"2026-11-19T23:50:37Z","updated_at":"2026-11-20T00:00:05.086947Z","fetched_at":"2026-11-21T19:15:55.946108Z","severity":"medium","cvss_score":5.3,"epss":0.00469,"is_kev":false,"has_exploit":false,"kev_due_date":null,"vendor":null,"product":"nltk","vuln_id":"CVE-2026-129228","vuln_ids":["CVE-2026-129228","GHSA-F2H2-F4FC-P978"],"tags":["osv","pypi","fix-available"],"cluster_id":2149,"links":{"self":"https://vulnwatch.ve1ve2.com/api/v1/items/10693","html":"https://vulnwatch.ve1ve2.com/item/10693"}},{"id":2361,"source":{"id":"ghsa","name":"GitHub Security Advisories"},"title":"GHSA-f2h2-f4fc-p978 / CVE-2026-129228: NLTK: Uncontrolled recursion in Toolbox settings helpers causes denial of service via deeply nested input","summary":"NLTK: Uncontrolled recursion in Toolbox settings helpers causes denial of service via deeply nested input\n\n## Root Cause\nThe Toolbox settings-tree helpers recurse over the parsed element tree without any depth\nbound. `_to_settings_string` (`nltk/toolbox.py:418`), `remove_blanks`\n(`nltk/toolbox.py:432`), `add_default_fields` (`nltk/toolbox.py:451`), `_sort_fields`\n(`nltk/toolbox.py:484`), and `add_blank_lines` (`nltk/toolbox.py:502,516`) each recurse once\nper element level with no depth counter or explicit stack. The producer\n`ToolboxSettings.parse` builds the element tree iteratively, so nesting depth is driven\nentirely by attacker-supplied `\\+marker` / `\\-marker` pairs.\n\n## Impact\nAn application that parses an untrusted Toolbox settings file and then serialises or\ntransforms it through any of the public helper functions aborts with an unhandled\n`RecursionError`, terminating the affected operation or request worker (denial of service,\nCWE-674). The recursion is pure Python, yielding a catchable `RecursionError` rather than\nmemory corruption or code execution. Confidentiality and integrity are unaffected.\n\n## Attack Chain\n1. The application parses an untrusted settings file via `ToolboxSettings.open_string` /\n   `open` plus `parse`, producing an *N*-deep element tree; parsing is iterative and\n   completes without error.\n2. The application passes the tree to a public helper — `to_settings_string`,\n   `remove_blanks`, `add_default_fields`, `sort_fields`, or `add_blank_lines` — as in the\n   module's own parse-then-serialise round trip.\n3. The helper recurses once per element level with no depth guard, consuming call-stack\n   frames. This holds even when the helper's configuration dictionaries are empty.\n4. Once the nesting depth exceeds the interpreter recursion limit, an unhandled\n   `RecursionError` propagates out of the public API.\n\n## Bypass Evidence\nAgainst the shipped source at the default recursion limit, a settings input nested 5 levels\ndeep traverses cleanly through every helper, while a well-formed input nested 5000 levels\ndeep drives each of the five helpers to an unhandled `RecursionError`; the iterative parse\nbuilds the 4999-deep tree without error, isolating the fault to the recursive helpers. The\nconfig-taking helpers (`add_default_fields`, `sort_fields`, `add_blank_lines`) recurse to\nfailure even with empty configuration dictionaries. A repository-wide search confirms no\ndepth guard exists anywhere in this module.\n\n## Suggested Fix\nCap nesting depth at the shared producer `ToolboxSettings.parse` (the choke point that\nbuilds the tree), or convert the five helpers to iterative traversals / add a shared\nrecursion-depth bound, so all consumers are protected by one fix.\n\nReported by pi (GitHub: @manus-pi).\n\n## Fix status (2026-09-28)\n\nStatus: MERGED on develop (unreleased; v3.10.3 of 2026-08-12 predates the fix).\n\nPR: #3885 \"Bound recursion depth in parsers and traversal helpers\" (ekaf), merged 2026-09-11, merge commit e521ecafc on develop.\n\nFix commit: 0b6975377 (nltk/toolbox.py: the settings helpers stop at MAX_TOOLBOX_DEPTH=500 with ValueErr\n\nAffected packages: pip:nltk\nPatched: nltk 3.10.4","url":"https://github.com/advisories/GHSA-f2h2-f4fc-p978","published_at":"2026-11-19T23:50:37Z","updated_at":"2026-11-19T23:50:38Z","fetched_at":"2026-11-21T19:15:18.416778Z","severity":"medium","cvss_score":5.3,"epss":0.00469,"is_kev":false,"has_exploit":false,"kev_due_date":null,"vendor":null,"product":"nltk","vuln_id":"CVE-2026-129228","vuln_ids":["CVE-2026-129228","GHSA-F2H2-F4FC-P978"],"tags":["ghsa","pip","CWE-674"],"cluster_id":2149,"links":{"self":"https://vulnwatch.ve1ve2.com/api/v1/items/2361","html":"https://vulnwatch.ve1ve2.com/item/2361"}},{"id":15176,"source":{"id":"osv","name":"OSV.dev"},"title":"DEBIAN-CVE-2026-129228: 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, ToolboxSettings.parse builds a deeply nested attacker-controlled settings tree iteratively, but the later public helpers to_settings_string, remove_blanks, add_default_fields, sort_fields, and add_blank_lines recursively traverse that tree without a depth bound. Invoking any of those helpers on input nested beyond the interpreter recursion limit can raise RecursionError and abort the 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-129228","url":"https://osv.dev/vulnerability/DEBIAN-CVE-2026-129228","published_at":"2026-11-19T19:17:21.840000Z","updated_at":"2026-11-22T21:00:05.730814Z","fetched_at":"2026-11-23T03:05:53.019739Z","severity":"medium","cvss_score":5.3,"epss":0.00469,"is_kev":false,"has_exploit":false,"kev_due_date":null,"vendor":"debian","product":"12:nltk","vuln_id":"CVE-2026-129228","vuln_ids":["CVE-2026-129228","DEBIAN-CVE-2026-129228","GHSA-F2H2-F4FC-P978"],"tags":["osv","debian","no-fix-yet"],"cluster_id":832,"links":{"self":"https://vulnwatch.ve1ve2.com/api/v1/items/15176","html":"https://vulnwatch.ve1ve2.com/item/15176"}},{"id":9069,"source":{"id":"nvd","name":"NVD CVE API 2.0"},"title":"CVE-2026-129228: 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, ToolboxSettings.parse builds a deeply nested attacker-controlled settings tree iteratively, but the later public helpers to_settings_string, remove_blanks, add_default_fields, sort_fields, and add_blank_lines recursively traverse that tree without a depth bound. Invoking any of those helpers on input nested beyond the interpreter recursion limit can raise RecursionError and abort the operation or request worker. This issue is fixed in version 3.10.4.\n\nReferences:\nhttps://github.com/nltk/nltk/commit/0b6975377d0334af604d32c9d83b26b46e1d437c\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-f2h2-f4fc-p978\nhttps://github.com/nltk/nltk/security/advisories/GHSA-f2h2-f4fc-p978","url":"https://nvd.nist.gov/vuln/detail/CVE-2026-129228","published_at":"2026-11-19T19:17:21.840000Z","updated_at":"2026-11-19T20:17:23.770000Z","fetched_at":"2026-11-21T19:15:31.484715Z","severity":"medium","cvss_score":5.3,"epss":0.00469,"is_kev":false,"has_exploit":false,"kev_due_date":null,"vendor":null,"product":null,"vuln_id":"CVE-2026-129228","vuln_ids":["CVE-2026-129228","GHSA-F2H2-F4FC-P978"],"tags":["CWE-674"],"cluster_id":832,"links":{"self":"https://vulnwatch.ve1ve2.com/api/v1/items/9069","html":"https://vulnwatch.ve1ve2.com/item/9069"}},{"id":1093,"source":{"id":"redhat","name":"Red Hat Security Data API"},"title":"CVE-2026-129228: nltk: nltk: Denial of Service via unbounded recursion in ToolboxSettings","summary":"nltk: nltk: Denial of Service via unbounded recursion in ToolboxSettings","url":"https://access.redhat.com/security/cve/cve-2026-129228","published_at":"2026-11-19T18:03:36Z","updated_at":null,"fetched_at":"2026-11-21T19:15:08.893742Z","severity":"medium","cvss_score":5.3,"epss":0.00469,"is_kev":false,"has_exploit":false,"kev_due_date":null,"vendor":"redhat","product":null,"vuln_id":"CVE-2026-129228","vuln_ids":["CVE-2026-129228","GHSA-F2H2-F4FC-P978"],"tags":["redhat"],"cluster_id":832,"links":{"self":"https://vulnwatch.ve1ve2.com/api/v1/items/1093","html":"https://vulnwatch.ve1ve2.com/item/1093"}}]}