CUJO Smart Firewall threatd hostname reputation check code execution vulnerability
The CUJO Smart Firewall's safe browsing function extracts the HTTP Host header from network traffic and inserts it unsanitised into a Lua statement executed in the kernel. An attacker on the local network could send a crafted HTTP request to execute arbitrary Lua code in kernel context, potentially leading to remote code execution.
Originally disclosed on Cisco Talos
An exploitable vulnerability exists in the safe browsing function of the CUJO Smart Firewall, version 7003. The flaw lies in the way the safe browsing function parses HTTP requests.
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 Host header is inserted directly into a Lua statement without sanitisation, allowing code injection.
Impact
An attacker could execute arbitrary Lua code in the kernel, potentially leading to remote code execution without authentication; the proof of concept only demonstrates a crash.
What the attacker needed
Attacker on the same network as CUJO; ability to send HTTP requests
How it was found
- An attacker on the same network sends an HTTP request to any remote server with a malicious Host header.
- The firewall's iptables rule passes the packet to the Lua function nf_http.
- nf_http extracts the Host header using a weak regex and passes it to safebro.filter.
- safebro.filter calls threat.lookup, which sends the hostname to the threatd process.
- threatd inserts the hostname into a Lua statement and writes it to /proc/nf_lua.
- The kernel's Lua engine executes the injected Lua code.
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 inspects web traffic and takes the website name (Host header) from each request. It then builds a small program (Lua script) using that name without cleaning it first. Because the name can contain special characters, an attacker can sneak in extra commands that the firewall runs with high privileges, potentially taking over the device.
What is RCE?
Running the attacker's code on the target's servers: through command or code injection, unsafe deserialisation or template injection.