From 0-Day to Exploit - Buffer Overflow in Belkin N750 (CVE-2014-1635)
A buffer overflow in the guest network web interface of the Belkin N750 router allows an unauthenticated remote attacker to overwrite a heap variable and inject shell commands, gaining root access. The attacker can execute arbitrary commands on the device.
labs.integrity.pt
Published on labs.integrity.pt
A vulnerability in the guest network web interface of the Belkin N750 DB Wi-Fi Dual-Band N+ Gigabit Router with firmware F9K1103WW1.10.16m, allows an unauthenticated remote attacker to gain root access to the operating system of the affected device. The guest network functionality is default functionality and is…
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 web server used the unsafe strcpy() function to copy the POST parameter 'jump' into a fixed-size buffer, allowing a heap overflow that overwrote a control variable and a CGI command name.
Impact
An unauthenticated attacker on the guest Wi-Fi network could execute arbitrary commands as root, gaining full control of the router.
What the attacker needed
Access to the guest Wi-Fi network; no authentication required
How it was found
- Send a POST request to the guest network web interface with the 'jump' parameter containing padding and shell commands.
- The padding overwrites the do_xread variable to a non-zero value, causing the server to execute a CGI.
- The CGI name is also overwritten with the attacker's command, which is passed to popen() and run by /bin/sh.
- The attacker's command (e.g., starting telnet) executes with root privileges.
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.
A buffer overflow happens when a program copies more data into a memory area than it can hold, so the extra data spills over and can change other values. Here, the router's web server copied a long value from a form field into a small buffer, letting an attacker overwrite a flag and a command name, which the server then ran as a shell command. This gave full control of the router without needing to log in.
What is RCE?
Running the attacker's code on the target's servers: through command or code injection, unsafe deserialisation or template injection.