CVE-2026-42304·Python vulnerability
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.
- Severity
- high
- Software
- Python
- Fixed in
- 26.4.0
- Published
- 2026-05-13
Affected versions
Until: 26.4.0
Fixed in: 26.4.0
How to fix this CVE
Update Python and Twisted to version 26.4.0 or later to patch the DNS name decompression denial-of-service flaw. This vulnerability allows remote attackers to freeze Twisted-based services by sending specially crafted TCP DNS packets with recursive compression pointers. Ensure your deployment uses the patched version and restart affected services.
sudo dnf update python3 python3-twistedDefensia detects this vulnerability
What an exploitation attempt looks like
Sample log line indicative of exploitation attempts:
TCP DNS packets with Content-Length or packet size exceeding 512 bytes combined with multiple DNS compression pointer chains (0xC0 followed by offset bytes) repeated more than 10 times in sequence within the message payloadHow to check if you are affected
- Check installed Twisted version: python3 -c "import twisted; print(twisted.__version__)"
- Verify if Twisted DNS resolver (twisted.names) is active in your application by searching application logs for 'twisted.names' module initialization or checking process netstat for port 53 or DNS listener ports
- Search application logs for repeated DNS decompression errors or warnings: grep -i 'dns\|decompress\|pointer' /var/log/application.log
- After patching, confirm the updated version: python3 -c "import twisted; print(twisted.__version__)" and verify it shows 26.4.0 or later
FAQ
What is CVE-2026-42304?
CVE-2026-42304 is a denial-of-service vulnerability in Twisted's DNS resolver that occurs when processing malformed TCP DNS packets containing deeply nested compression pointer chains. An unauthenticated remote attacker can trigger resource exhaustion, causing the Twisted reactor to hang and become unresponsive.
Is CVE-2026-42304 being actively exploited?
No, CVE-2026-42304 is not currently listed in the CISA Known Exploited Vulnerabilities (KEV) catalog and no public exploits are available. However, the vulnerability is easily triggerable and should be patched proactively.
What versions of Python are affected by CVE-2026-42304?
The vulnerability affects Python 3.6 and later when using Twisted versions prior to 26.4.0. Twisted 26.4.0rc2 and later versions contain the fix.
How do I check if my server is vulnerable to CVE-2026-42304?
Run 'python3 -c "import twisted; print(twisted.__version__)"' and compare against version 26.4.0. If the installed version is earlier than 26.4.0 and your application uses the twisted.names DNS module, your server is vulnerable.
Does Defensia detect CVE-2026-42304?
Yes — Defensia's CVE advisory scanner compares installed package versions against the NVD database. If Python and Twisted are installed on a monitored server, CVE-2026-42304 will appear in your dashboard with remediation steps.
Related Python CVEs
References
Track CVEs across your fleet automatically
Defensia scans your Linux servers and tells you exactly which ones are running vulnerable versions — including CVE-2026-42304. Free for 1 server.
Get started free