NLTKで細工された正規表現により、サービス運用が停止する脆弱性
Summary
NLTKの3.10.0から3.10.4までの版には、正規表現の処理に関する脆弱性があります。細工された正規表現を送られると、コンパイル時にCPUを大量に消費し、サービス運用が停止するおそれがあります。修正版の3.10.4で解消されるため、NLTKを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.0から3.10.4までの版には、正規表現の処理に関する脆弱性があります。細工された正規表現を送られると、コンパイル時にCPUを大量に消費し、サービス運用が停止するおそれがあります。修正版の3.10.4で解消されるため、NLTKを3.10.4以降に更新してください。
Affected packages
| Package | Affected → Fixed | |
|---|---|---|
| nltknltk | — | Not listed |
| PyPInltk |
≥ 3.10.0, < 3.10.4→ 3.10.4 |
3.10.4 |
| pipnltk |
< 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-129229 nltk No fixed version in this record
- Ubuntu UBUNTU-CVE-2026-129229 nltk No fixed version in this record
Original description The description as published by the source.
Summary
NLTK exposes a compile-time regular-expression denial of service in its regex-search helpers. When an application passes untrusted text as the search pattern to TokenSearcher.findall() / Text.findall(), or as the tokenizer pattern to RegexpTokenizer, the pattern is handed to the third-party regex engine, whose compilation cost is roughly quadratic in the number of capturing groups. A short pattern of the form () repeated many times (for example "()" * 25000, about 50 KB) forces tens of seconds of synchronous CPU work before any match begins. The wall-clock timeout that NLTK added to guard matching does not apply during compilation, so a single small request pins a CPU core, and repeated or concurrent requests exhaust all cores and deny service.
Root Cause
The remediation for the earlier match-time backtracking issue (advisory GHSA-rrv8-h7p8-rx55 / CVE-2026-80205) switched the caller-supplied-pattern search path from the standard library re module to the third-party regex engine and wrapped matching in a wall-clock timeout. That timeout is a match-time limit only: it is applied while the compiled pattern scans the corpus. Compilation of the pattern happens first and synchronously, outside any timeout. The regex engine's compiler is approximately O(n^2) in the number of regex groups, so a caller-controlled pattern consisting of many empty groups makes compilation, not matching, the expensive step. No control bounds the group count of a caller-…
Source: CVE.org (CVE Program・cvelistV5) NVD GitHub Advisory
References
- advisory github.com
- package github.com
- web github.com
- web github.com
- web github.com
- web github.com
- web nvd.nist.gov
- web github.com