Hacking TP-LINK WA850RE Wi-Fi Extender: RCE Leads To Root-Level R
The TP-LINK WA850RE Wi-Fi extender's web interface passes the wps_setup_pin parameter unsanitised into a shell command, allowing an authenticated attacker to execute arbitrary commands as root. The author demonstrated remote code execution and obtained a reverse shell with root privileges.
Published on medium.com
We immediately see that it exposes a web interface through port 80 and an SSH server through port 22.
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 copies the user-supplied wps_setup_pin value into a fixed-size buffer and passes it to a function that executes it via /bin/sh -c without sanitisation.
Impact
An authenticated attacker (with default credentials) could execute arbitrary commands as root on the extender, leading to full device compromise.
What the attacker needed
Access to the extender's web interface; default admin credentials (admin/admin); attacker on the same network
The fix
The wps_setup_pin parameter should be sanitised or validated before being passed to a shell command, or the command should be executed without a shell.
How it was found
- Log in to the web interface using default credentials (admin/admin) and obtain a session cookie.
- Send a POST request to /data/wps.setup.json with operation=write, option=connect, and a wps_setup_pin value containing a shell command.
- The device executes the injected command as root, which can be confirmed by receiving a callback (e.g., wget request) on an attacker-controlled server.
- To get a reverse shell, inject a command that downloads a MIPS netcat binary, makes it executable, and connects back to the attacker.
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.
The extender's web page takes a value from a form (the WPS PIN) and puts it directly into a command that the device runs in its operating system. Because the value is not cleaned, someone can add extra commands after the PIN, and the device will run them too. The attacker first logs in (default credentials) and then sends a crafted request to the WPS setup page.
What is RCE?
Running the attacker's code on the target's servers: through command or code injection, unsafe deserialisation or template injection.