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 SeekableUnicodeStreamReader.readline in nltk/data.py, which assembles a line by appending each newly read block to a growing chars buffer and then calling chars.splitlines(True) over the entire accumulated buffer on every loop iteration. Because the read block size is capped at 8000 characters, reading a single unterminated line of N characters requires approximately N/8000 iterations, and each iteration k rescans roughly 8000*k characters, producing O(N^2) total CPU work. An attacker who supplies a corpus file containing one very long line with no newline terminator can pin a CPU core for quadratic time in the reader's process.
Note: This is only exploitable when a corpus file is processed through a line-oriented corpus reader with an encoding set, which causes StreamBackedCorpusView._open to construct a SeekableUnicodeStreamReader; the block readers read_line_block, read_whitespace_block, read_wordpunct_block, and read_blankline_block all call stream.readline() with no size argument, reaching the vulnerable path.
Requires only the nltk package under test on PYTHONPATH; no network access. Feeds one unterminated line of increasing length through SeekableUnicodeStreamReader.readline (size=None, the corpus-view path) and times each call.
import io, time from nltk.data import SeekableUnicodeStreamReaderdef measure(n): stream = io.BytesIO(b"a" * n) # one unterminated line, no newline reader = SeekableUnicodeStreamReader(stream, "utf-8") t0 = time.perf_counter() line = reader.readline() # size=None -> corpus-view path dt = time.perf_counter() - t0 assert len(line) == n return dt
prev = None for n in (1_000_000, 2_000_000, 4_000_000, 8_000_000): dt = measure(n) ratio = "-" if prev is None else f"{dt/prev:.2f}x" print(f"{n:>12,} chars {dt:8.3f}s ratio(x2 size)={ratio}") prev = dt
1,000,000 chars 0.058s ratio(x2 size)=-
2,000,000 chars 0.290s ratio(x2 size)=4.99x
4,000,000 chars 1.154s ratio(x2 size)=3.98x
8,000,000 chars 4.694s ratio(x2 size)=4.07x
The roughly 4x time increase for each 2x increase in size is the O(N^2) signature; a linear readline would grow about 2x per 2x size step.
Note: Requires only the nltk package on PYTHONPATH with no network access, feeding unterminated lines of increasing length through SeekableUnicodeStreamReader.readline with size=None.