NLTKのCCG辞書解析に脆弱性、入力で処理が止まりサービス拒否のおそれ
Summary
NLTKの3.10.4より前のバージョンには、CCG辞書パーサーfromstringの脆弱性があります。広い入力を与えられるとCPUを使い切られ、遠隔からサービス拒否の状態に陥るおそれがあります。修正版の3.10.4が公開されているので、利用中のバージョンを確認し、3.10.4以降に更新してください。
AI summary
Produced by SecPulse using an external AI model; it may contain mistakes. Check the original description and references below before acting on it.
NLTKの3.10.4より前のバージョンには、CCG辞書パーサーfromstringの脆弱性があります。広い入力を与えられるとCPUを使い切られ、遠隔からサービス拒否の状態に陥るおそれがあります。修正版の3.10.4が公開されているので、利用中のバージョンを確認し、3.10.4以降に更新してください。
Affected packages
| Package | Affected → Fixed | |
|---|---|---|
| nltknltk |
< 3.10.4→ 3.10.4 |
3.10.4 |
| pipnltk |
< 3.10.4→ 3.10.4 |
3.10.4 |
| PyPInltk |
< 3.10.4→ 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.
- Debian DEBIAN-CVE-2026-126299 nltk No fixed version in this record
Original description The description as published by the source.
Summary
The public CCG lexicon parser nltk.ccg.lexicon.fromstring parses caller-influenced lexicon text with two pure-Python loops whose cost is quadratic in the input width. A service that parses an untrusted CCG lexicon string can be driven into tens of seconds of single-threaded CPU by a few-megabyte input, starving the request worker. No authentication or user interaction is required.
Root Cause
matchBrackets consumes a bracket body one character at a time with inside = inside + rest[0]; rest = rest[1:]. The rest = rest[1:] tail re-slice copies the entire remaining string on every iteration, so a flat bracket body costs O(n^2). augParseCategory drives a while rest != "": operator loop that re-copies the regular-expression match tail (rest = app[3]) once per operator, which is also O(n^2) over a long operator chain. The parser carries a recursion-depth guard (MAX_PARSE_DEPTH = 500) that raises on deeply nested categories, but both quadratic loops run on flat input whose nesting depth stays at zero, so that guard never fires. No bound is applied to line length or category width before the text reaches these loops.
Affected functions:
- nltk.ccg.lexicon.matchBrackets (nltk/ccg/lexicon.py:149-172; tail re-slice at line 168)
- nltk.ccg.lexicon.augParseCategory (nltk/ccg/lexicon.py:223-268; APP_RE tail re-copy at line 250)
Public entry point: nltk.ccg.lexicon.fromstring (nltk/ccg/lexicon.py:271), also re-exported as nltk.ccg.chart.from…
Source: CVE.org (CVE Program・cvelistV5) NVD GitHub Advisory
References
- advisory github.com
- package github.com
- web github.com
- web vulncheck.com
- web nvd.nist.gov
- web github.com
- web github.com
- web github.com
- web github.com
- web github.com
- web github.com