CUJO Smart Firewall mdnscap mDNS character-strings code execution vulnerability
The mdnscap binary of CUJO Smart Firewall mishandles string lengths when parsing character-strings in mDNS resource records, causing a heap buffer overflow. An unauthenticated attacker can send a crafted mDNS message to achieve arbitrary code execution in the context of the mdnscap process.
Originally disclosed on Cisco Talos
An exploitable heap overflow vulnerability exists in the mdnscap binary of the CUJO Smart Firewall running firmware 7003. The string lengths are handled incorrectly when parsing character strings in mDNS resource records, leading to arbitrary code execution in the context of the mdnscap process.
The full write-up lives on its author's site
It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
How it worked
Root cause
The length check in collect_strings only compares each character-string's length against the total rdlength, ignoring the cumulative length of all strings plus separators and the null terminator, so the buffer allocated with rdlength+1 bytes can be overflowed.
Impact
An unauthenticated attacker could achieve arbitrary code execution in the context of the mdnscap process, but would need to escape the chroot and elevate privileges to fully compromise the device.
What the attacker needed
Network access to UDP port 5353; no authentication required
How it was found
- Craft an mDNS response packet with QR=1 and TC=0, containing an answer record of type SRV (33) with a declared RDLENGTH smaller than the sum of the character-string lengths.
- Send the packet to UDP port 5353 on the CUJO device.
- The mdnscap process parses the packet, calls collect_strings, and overflows the heap buffer, causing a crash or potential code execution.
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
The firewall runs a small program that listens for mDNS (a protocol used by devices to announce themselves on a local network). When it reads a message, it copies text into a fixed-size memory area without checking the total length properly. By sending a specially crafted message, an attacker can overflow that memory area and potentially run their own code on the device.
What is Memory corruption?
Native code reads or writes memory it should not: overflows, use-after-free, type confusion. The core of browser, kernel and parser bugs.