Skip to content
RCE Write-up Intermediate

PwnAgent: A One-Click WAN-side RCE in Netgear RAX Routers with CVE-2023-24749

A command injection vulnerability in the puhttpsniff binary on Netgear RAX routers allows an attacker to execute arbitrary commands by controlling the User-Agent header of HTTP traffic leaving the local network. An attacker can exploit this by hosting a malicious website that sets a custom User-Agent via JavaScript, leading to remote code execution on the router when a victim visits the site.

Zion Basque Follow

Published on mahaloz.re

A breakdown of a bug SEFCOM T0 and I exploited to achieve a WAN-side RCE in some Netgear RAX routers for pwn2own 2022. The bug is a remotely accessible command injection due to bad packet logging, cataloged as CVE-2023-24749.

Zion Basque (@mahal0z), Wil Gibbs (@cl4sm), on mahaloz.re

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 write-up has not been written yet. The Original tab links to the source.

How it worked

Root cause

The puhttpsniff binary uses the User-Agent header from logged packets in a system() call without sanitisation, leading to command injection.

Impact

An attacker could achieve remote code execution as root on the router, allowing them to snoop on traffic, read unencrypted data, and manipulate DNS; for routers with nginx behind them, no user interaction is needed.

What the attacker needed

Victim visits attacker's site; attacker controls a website on port 80; router is unpatched

The fix

Netgear patched the bug in firmware version 1.0.9.92 for the RAX30, but other models may still be vulnerable; users should update their firmware.

How it was found

  1. Victim connects to the router and gets a local IP.
  2. Victim visits a malicious website.
  3. The website sends JavaScript that sets a custom User-Agent.
  4. The victim's browser executes the JavaScript and sends a request with the malicious User-Agent.
  5. The router logs the outgoing packet and executes the injected command.

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 write-up has not been written yet. The Original tab links to the source.

This report describes a security flaw in some Netgear routers. The router runs a program that logs web traffic, and it mistakenly treats part of that traffic (the User-Agent, which identifies your browser) as a command to run. An attacker can trick your browser into sending a malicious User-Agent, and when the router logs it, the attacker's commands run on the router, giving them control.

What is RCE?

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

More from Netgear

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.