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

Published Aug 20, 2026
·
Updated

The URLS regular expression in nltk/tokenize/casual.py, compiled into TweetTokenizer.WORDRE 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 HANGRE 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 casualtokenize, to submitted text can be stalled per request without authentication. Version 3.10.1 bounds the label repetition.

Affected Software

1 affected component
pypi/nltk<3.10.1

Remediation

Recommended actions to resolve this vulnerability, in priority order.

  1. Upgrade

    Upgrade nltk/tokenize/casual.py (TweetTokenizer WORD_RE) to a version that resolves this vulnerability.

    Fixed in 3.10.1

Event History

Aug 20, 2026
CVE Published
via MITRE·09:57 PM
Data Sourced
via MITRE·09:57 PM
DescriptionSeverityWeakness

Frequently Asked Questions

1

Which deployments are exposed to this denial-of-service issue?

Services that pass submitted or otherwise untrusted text to TweetTokenizer.tokenize or the module-level casual_tokenize are exposed. An attacker can trigger the issue remotely without authentication when they can supply text to a tokenization path.

2

What input is needed to trigger the excessive CPU use?

The triggering input consists of many alternating domain-label separators arranged to resemble a naked domain but without a valid trailing top-level domain. Only a few kilobytes can consume seconds to minutes of single-threaded CPU.

3

Are default preprocessing steps sufficient to prevent exploitation?

No. The HANG_RE substitution performed before matching does not collapse the problematic pattern, so it does not prevent the catastrophic backtracking.

4

What version addresses the vulnerable regular expression?

NLTK version 3.10.1 bounds the domain-label repetition in the URL pattern.

Contact

SecAlerts Pty Ltd.
132 Wickham Terrace
Fortitude Valley,
QLD 4006, Australia
info@secalerts.co
By using SecAlerts services, you agree to our services end-user license agreement. This website is safeguarded by reCAPTCHA and governed by the Google Privacy Policy and Terms of Service. All names, logos, and brands of products are owned by their respective owners, and any usage of these names, logos, and brands for identification purposes only does not imply endorsement. If you possess any content that requires removal, please get in touch with us.
© 2026 SecAlerts Pty Ltd.
ABN: 70 645 966 203, ACN: 645 966 203