CVE-2026-72818 NLTK TweetTokenizer URL Pattern Backtracks Catastrophically on Naked-Domain-Like Input

High 8.7 Published Updated

An attacker can cause a denial of service by submitting specially crafted text that triggers catastrophic backtracking in the NLTK TweetTokenizer URL regex.

Exploited in the wild
Not known
Login needed
Not needed
Attackable
Over the internet
Victim action needed
Not needed
Fix
Available

What is CVE-2026-72818?

CVE-2026-72818 is a high-severity denial of service vulnerability in nltk, published on 20 Aug 2026. An attacker can exploit it over the internet without logging in, with no action from the victim.

Official description

The URLS regular expression in nltk/tokenize/casual.py, compiled into TweetTokenizer.WORD_RE and applied by TweetTokenizer.tokenize, contains a naked-domain branch whose domain-label prefix [a-z0-9]+(?:[.\-][a-z0-9]+)* is unbounded. Input consisting of many alternating label separators can be partitioned in exponentially many ways, and because the branch also requires a trailing top-level domain that such input never supplies, the engine explores those partitions before failing at each offset. A few kilobytes of input therefore consumes seconds to minutes of single-threaded CPU, and the HANG_RE substitution performed before matching does not collapse the pattern. TweetTokenizer is intended for tokenizing untrusted social-media text, so any service that applies it, or the module-level casual_tokenize, to submitted text can be stalled per request without authentication. Version 3.10.1 bounds the label repetition.

Weakness: CWE-1333

Which versions are affected by CVE-2026-72818?

3 open source packages ship an affected version, including nltk.

PackageAffectedFixed in
nltk PyPIAll versions3.10.1
nltk PyPIAll versions3.10.1
nltk PyPIAll versions3.10.1

How do I fix CVE-2026-72818?

Upgrade nltk to 3.10.1 or later.

Upgrade, then put limits on request size, rate and nesting depth so one client cannot exhaust the service. More about Denial of service.

Is CVE-2026-72818 being exploited?

It is not confirmed as exploited in the wild, but public exploit code for CVE-2026-72818 exists.

Sources

Also known as DEBIAN-CVE-2026-72818, ECHO-798a-87f0-5479, GHSA-qx2g-xrx7-vfh8, MINI-2hcr-878q-x222, PYSEC-2026-3870, UBUNTU-CVE-2026-72818.

Is CVE-2026-72818 in your software?

Upload an SBOM and sbomify checks it against every vulnerability here, every day.

Check your SBOMs for free