Skip to content
RCE Advisory Advanced CVE-2018-4031

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.

Claudio Bozzato Follow

Originally disclosed on Cisco Talos

Critical 9.0 View original

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.

Claudio Bozzato, on Cisco Talos

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

  1. An attacker on the same network sends an HTTP request to any remote server with a malicious Host header.
  2. The firewall's iptables rule passes the packet to the Lua function nf_http.
  3. nf_http extracts the Host header using a weak regex and passes it to safebro.filter.
  4. safebro.filter calls threat.lookup, which sends the hostname to the threatd process.
  5. threatd inserts the hostname into a Lua statement and writes it to /proc/nf_lua.
  6. 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.

More by Claudio Bozzato

View all

185 more disclosed reports, best first.

More from Cisco Talos

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Remote code execution

The lesson behind this report.

Running the attacker's code on the target's servers: through command or code injection, unsafe deserialisation or template injection.