CVE-2026-81722: NLTK PorterStemmer quadratic-time DoS via long runs of 'y'

CVE-2026-81722 · Severity: high · CVSS 7.5 · Published 2026-08-27

NLTK's PorterStemmer is a widely used text processing tool applied to search queries, document indexing, and natural language pipelines. An attacker can craft a single token containing tens of thousands of consecutive 'y' characters (e.g., 20 KB), which causes the stemmer to consume multiple seconds of CPU time per request due to an inefficient algorithm, potentially exhausting server resources and degrading service availability. There is no impact to data confidentiality or integrity.

Technologies: nltk (PyPI). Vendors: PyPI.

Quick answers

Is CVE-2026-81722 exploited in the wild?
No. Junglewise Threat Intelligence has no report of CVE-2026-81722 being exploited in the wild.
How severe is CVE-2026-81722?
High severity, with a CVSS score of 7.5, published 27 August 2026.
Which products and versions are affected?
nltk (PyPI) <= 3.10.2, ECOSYSTEM:introduced=0,fixed=3.10.3.
Is there a fix for CVE-2026-81722?
Yes. nltk (PyPI): upgrade to 3.10.3 or later. Junglewise finds every place you run it, drafts the upgrade and applies it once you approve.
How is CVE-2026-81722 attacked?
It is attacked over the network.
Am I affected by CVE-2026-81722?
Check whether you run nltk (PyPI) at an affected version. Junglewise does that check for you around the clock: connect your code, cloud and domains, and it matches new vulnerabilities like this one against what you actually run and tells you when one reaches you.

How to fix

  • nltk (PyPI): upgrade to 3.10.3 or later
    pip install "nltk>=3.10.3"

Technical details

The `_is_consonant()` function in PorterStemmer uses an iterative backward walk to classify the letter 'y', intended to fix an earlier stack overflow issue. However, this function is called once for every character position in the stem by `_measure()`. For a token with n consecutive 'y' characters, this results in O(n²) total operations (sum of 1+2+...+n). A crafted token like 'y'*20000 + 'ness' requires >20 seconds to process. The vulnerability is reachable via untrusted input in search, indexing, and NLP systems. No authentication is required; the attack is network-accessible. The fix (version 3.10.3 and later) pre-computes consonant/vowel classification in a single O(n) pass.

Affected products

  • NLTK Project NLTK <= 3.10.2

Identifiers

  • CVE-2026-81722
  • GHSA-ww6m-cw3f-q94g
  • PYSEC-2026-3738

Timeline

  • 2026-08-12: disclosed
  • 2026-08-12: patched: Version 3.10.3 released
  • 2026-09-02: advisory: GitHub Advisory published

References

This page as Markdown. Free to reuse under CC BY 4.0 with a link back.