VAITP Dataset

← Back to the dataset

CVE-2026-106454

ReDoS in Twisted IMAP wildcard handling causing server-wide blocking.

  • CVSS 4.3
  • CWE-1333
  • Resource Management
  • Remote

Twisted is an event-based framework for internet applications, supporting Python 3.6+. In 25.5.0 and earlier, wildcardToRegexp() in twisted/mail/imap4.py translates the IMAP asterisk and percent wildcards but passes all other characters from an authenticated client's LIST or LSUB pattern directly to re.compile(), allowing nested or otherwise expensive regular expression constructs to cause catastrophic backtracking when matched against mailbox names. Because Twisted uses a cooperative single-threaded reactor, the blocking match suspends all server input and output for the duration of the match. No fixed release is available as of this review.

CVSS base score
4.3
Published
2026-10-06
OWASP
A04 Insecure Design
Orthogonal defect classification
Algorithm
Code defect classification
Incorrect Algorithm
Category
Resource Management
Subcategory
Resource Exhaustion
Accessibility scope
Remote
Impact
Denial of Service (DoS)
Affected component
Twisted
Fixed by upgrading
Yes

Solution

Upgrade Twisted to version 25.6.0 or later.

Vulnerable code sample

import re
from twisted.mail.imap4 import wildcardToRegexp

def match_mailbox(pattern, mailbox_name):
    """
    Return True if mailbox_name matches the IMAP LIST/LSUB pattern supplied by a client.
    """
    # VULNERABLE: directly compiles pattern with regex meta‑characters, enabling ReDoS
    regex = re.compile(wildcardToRegexp(pattern))
    return bool(regex.fullmatch(mailbox_name))

Patched code sample

import re
from twisted.mail.imap4 import wildcardToRegexp

def match_mailbox(pattern, mailbox_name):
    """
    Return True if mailbox_name matches the IMAP LIST/LSUB pattern supplied by a client.
    """
    # FIX: escape non‑wildcard characters before converting to a safe regex
    safe_pattern = re.escape(pattern).replace(r'\*', '*').replace(r'\%', '%')
    regex = re.compile(wildcardToRegexp(safe_pattern))
    return bool(regex.fullmatch(mailbox_name))

Published fix

Public sources link this CVE to the changes below. The code samples above were generated to illustrate the defect; these links lead to the code the project actually changed.

Cite this entry

@misc{vaitp:cve2026106454,
  title        = {{ReDoS in Twisted IMAP wildcard handling causing server-wide blocking.}},
  author       = {Bogaerts, Fr\'ed\'eric and Ivaki, Naghmeh and Fonseca, Jos\'e},
  year         = {2026},
  note         = {VAITP Python Vulnerability Dataset, entry CVE-2026-106454},
  howpublished = {\url{https://netpack.pt/vaitp/vulnerability/CVE-2026-106454/}}
}

Download this entry as JSON Download the whole dataset

Introducing the "VAITP dataset": a specialized repository of Python vulnerabilities and patches, meticulously compiled for the use of the security research community. As Python's prominence grows, understanding and addressing potential security vulnerabilities become crucial. Crafted by and for the cybersecurity community, this dataset offers a valuable resource for researchers, analysts, and developers to analyze and mitigate the security risks associated with Python. Through the comprehensive exploration of vulnerabilities and corresponding patches, the VAITP dataset fosters a safer and more resilient Python ecosystem, encouraging collaborative advancements in programming security.

The supreme art of war is to subdue the enemy without fighting.

Sun Tzu – “The Art of War”

:: Shaping the future through research and ingenuity ::

Before you use the VAITP AI models

Please read and accept the following disclaimer:

By choosing "I understand and accept", you acknowledge that you understand and agree to these terms.