Dnsmasq Heap Overflow Enables DNS Cache Poisoning and Potential Remote Code Execution
Patch & Detection Intelligence · 2 sources · Updated 4mo ago · First seen Jul 20, 2026

A heap buffer overflow in Dnsmasq tracked as CVE-2026-2291 can be triggered when the resolver processes malicious DNS replies from an upstream DNS server, allowing memory corruption, false cache entry injection, DNS redirection, and denial of service. The flaw affects code introduced in release 2.73 and is tied to unsafe strcpy() use during cache insertion after extract_name() converts DNS names from wire format into C strings, where escaped names can exceed the 1,025-byte bigname heap buffer.
Researchers reported practical exploitation against OpenWRT 24.10.4 configured to use a malicious upstream resolver, using crafted requests and CNAME chains to corrupt the bigname free list, obtain a write-what-where primitive, and overwrite a function pointer in musl ld.so to gain instruction-pointer control. The issue was fixed on 11 May 2026 in versions 2.92rel2 and 2.93, and public reporting warns that exposed deployments could face DNS hijacking or, under the demonstrated conditions, full remote code execution.


