Snyk has a proof-of-concept or detailed explanation of how to exploit this vulnerability.
The probability is the direct output of the EPSS model, and conveys an overall sense of the threat of exploitation in the wild. The percentile measures the EPSS probability relative to all known EPSS scores. Note: This data is updated daily, relying on the latest available EPSS model version. Check out the EPSS documentation for more details.
In a few clicks we can analyze your entire application and see what components are vulnerable in your application, and suggest you quick fixes.
Test your applicationsUpgrade nltk to version 3.10.4 or higher.
nltk is a Natural Language Toolkit (NLTK) is a Python package for natural language processing.
Affected versions of this package are vulnerable to Inefficient Algorithmic Complexity via XMLCorpusView._read_xml_fragment in nltk/corpus/reader/xmldocs.py, which accumulates a file into a single growing buffer in 1 KiB blocks and re-runs a linear whole-buffer regex validation (_VALID_XML_RE.match) after every block. When the input XML contains a large comment or CDATA section whose terminator (--> or ]]>) spans many blocks, every block triggers an O(current buffer length) scan, making the total read cost O(n²) in the file size. An attacker who can supply a well-formed XML corpus file with a large comment or CDATA body containing </> characters can pin a CPU core for time quadratic in the file size, reaching tens of seconds for a few MiB and minutes for tens of MiB. The in_tag guard introduced for GHSA-vp2x covers only unclosed bare <...> tags and leaves the CDATA and comment paths unprotected.
The self-checking script embedded at the end of this advisory builds a well-formed XML document whose root holds a large comment containing </> characters with no --> before the final marker, drives XMLCorpusView's fragment reader at sizes n and 4n, and asserts the doubling ratio is far above linear. It also runs the CDATA variant, a single-match linearity check (proving the regex itself is not the super-linear factor), a linear-control giant tag, a well-formedness check, and a public-API reachability check, exiting non-zero on any failure.
Scope note: dynamically run on 3.6, 3.9.2, 3.10.3 (released wheels from PyPI / the local 3.10.3 wheel) and develop 6818767b9 (checked out source). No releases outside those were run; the >= 3.6 bound is the oldest release tested. Environment for the recorded runs: CPython 3.10.12, Linux x86_64. Input sizes are 64 KiB vs 256 KiB (attack) and 1 MiB vs 4 MiB (linear control), so a full run takes a few seconds.
Live transcript (recorded run on the 3.10.3 wheel; the 3.6, 3.9.2 and develop 6818767b9 runs are summarized below):
[TIMING] unclosed comment n=65558 t=0.083s 4n=262166 t=1.070s ratio=12.9 (n->returned)
[PASS] attack document is well-formed XML (parses with ElementTree) (both sizes parse; root element tag='root')
[PASS] unclosed-comment read cost scales super-linearly (t(4n)/t(n) > 10; linear ~4) (measured 12.9)
[INFO] in-tag guard present in module: True
[TIMING] CDATA variant n=65561 t=0.142s 4n=262169 t=2.169s ratio=15.3 (n->returned)
[PASS] CDATA variant also super-linear on guard-present build (measured 15.3)
[TIMING] single _VALID_XML_RE.match 256KiB=0.0083s 512KiB=0.0741s 1MiB=0.1419s 2MiB=0.2804s
[PASS] single match scales ~linearly (512KiB->2MiB 4x input ~4x time; not super-linear) (measured 4x ratio=3.79)
[TIMING] oversized tag (control) n=1048576 t=0.059s 4n=4194304 t=0.242s ratio=4.1
[PASS] oversized single tag reads linearly (guard present; t(4n)/t(n) < 8) (measured 4.1)
[PASS] public API list(XMLCorpusView(path, '.*')) reads the attack document (1 item(s) read from 65558-byte document)
RESULT 6/6 checks passed, 0 failed
Other runs (all 6/6; essential lines only):
3.6 (pre-guard): comment ratio=15.5 (returned); CDATA -> ValueError; tag control ratio=16.8; single-match 4x ratio=1.19
3.9.2 (pre-guard): comment ratio=15.0 (returned); CDATA -> ValueError; tag control ratio=16.8; single-match 4x ratio=0.95
develop 6818767b9: comment ratio=13.0 (returned); CDATA ratio=15.3 (returned); tag control ratio=3.9; single-match 4x ratio=3.76
(The pre-guard single-match ratios are meaningless — their dead CDATA alternative fails in O(1) — and are reported for completeness only.)
Note: The PoC states it was run on CPython 3.10.12, Linux x86_64, against nltk versions 3.6, 3.9.2, 3.10.3 (released PyPI wheels) and develop commit 6818767b9, with default input sizes of 64 KiB vs 256 KiB for the attack and 1 MiB vs 4 MiB for the linear control.