Dnsmasq 2.73-2.91 has a heap buffer overflow enabling remote code execution
Dnsmasq versions 2.73 through 2.91 contain an unchecked strcpy() that can overflow a 1,025-byte bigname buffer, allowing an attacker controlling an upstream DNS server to achieve remote code execution on vulnerable hosts.
Systems Exodus Intelligence 20 Jul 2026 Disclosure Real-world evidence
Published as “Dnsmasq DNS Remote Heap Buffer Overflow”
Why it matters
Dnsmasq deployments that accept untrusted DNS responses are vulnerable to remote code execution.
Summary
The researchers discovered that dnsmasq’s caching code uses a fixed 1,025-byte buffer (bigname) without length checks, leading to a heap overflow when processing specially crafted DNS responses. They built a proof-of-concept exploit that sends a series of CNAME records to an OpenWRT 24.10.4 target configured with a malicious upstream DNS server, corrupting the free-list and overwriting a function pointer in musl ld.so. The exploit achieves EIP control, demonstrating remote code execution. The issue was patched in dnsmasq 2.92rel2 and 2.93 and assigned CVE-2026-2291.
What they found 1
- The strcpy() into the bigname buffer can overflow when the escaped domain name exceeds 1,025 bytes.
“Since the name string may be larger than the 1,025-byte buffer, this strcpy() may overflow the heap buffer.”
Caveats 2
- If this capability is chained with other primitives, such as an information leak, a functional exploit can be obtained.
- The exploit is demonstrated on a VM running the generic x86 build of OpenWRT version 24.10.4.
What’s new here 4
- Identifies an unchecked strcpy() in dnsmasq’s cache that can overflow a 1,025-byte buffer.
- Shows how crafted CNAME chains can corrupt the heap free list and overwrite function pointers.
- Provides a working remote code execution exploit against OpenWRT 24.10.4.
- Details the fix and assigns CVE-2026-2291.