Skip to content
Threat Brief

← All advisories

CVE-2026-126299

High 7.5No known exploitationFix available

NLTK before 3.10.4 Quadratic-Time Denial of Service via CCG Lexicon fromstring

Vendor advisory: GHSA-89p3-fcch-88ph

Record last updated

CVSS score

7.5

High on a 0 to 10 scale

EPSS, chance of exploitation in 30 days

0.6%

Higher than 48% of scored CVEs. A prediction, not evidence.

CISA remediation deadline

None

Not in the KEV catalog

Description

## 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. ```text Affected functions: - nltk.ccg.lexi…

Weakness: CWE-400, CWE-407

Patching and mitigation

Patch status
Fix available (source: Microsoft MSRC)
Fix documented (source date)
Mitigation
None documented
Vendor guidance
msrc.microsoft.com (opens in a new tab)

Affected products

VendorProductAffected versionsFixed inPer
Microsoftazl4 python-nltk 1:3.9.1-9.azl4 on Azure Linux 4.0Not documentedNot documentedMicrosoft MSRC
pipnltkall versions up to and including 3.10.33.10.4GitHub Advisory Database

Timeline

  1. Advisory

    Microsoft advisory published

    Source: Microsoft MSRC (opens in a new tab)

  2. Advisory change

    Microsoft advisory revised (2.0): Information published.

    Source: Microsoft MSRC (opens in a new tab)

  3. Patch

    Fix documented by Microsoft MSRC

    Source: Microsoft MSRC (opens in a new tab)

Vendor guidance and references