peplink Surf SOHO HW1 api.cgi cmd.mvpn.x509.write OS command injection vulnerability
The router's certificate configuration endpoint builds shell commands from the cert and key request parameters without escaping them, while only the password parameter is escaped. An authenticated user with write privileges could inject extra shell commands that run as root on the device.
Originally disclosed on Cisco Talos
An OS command injection vulnerability exists in the api.cgi cmd.mvpn.x509.write functionality of peplink Surf SOHO HW1 v6.3.5 (in QEMU). A specially crafted HTTP request can lead to command execution.
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 cert and key parameters are inserted into a shell command string without escaping, while only the pw parameter is passed through an escape routine.
Impact
An authenticated attacker with write privileges could execute arbitrary commands with root privileges on the device.
What the attacker needed
Authenticated admin with write privileges
How it was found
- Authenticate to the device web interface as a user with write privileges.
- Send an HTTP POST request to the api.cgi endpoint with the func parameter set to cmd.mvpn.x509.write.
- Include cert, key and pw parameters, with shell metacharacters in cert or key to break out of the intended 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 report has not been written yet. The Original tab links to the source.
This router has a web admin page for uploading certificates. When you submit a certificate, the device runs a small helper program on the command line using the text you supplied. Because two of those text fields are pasted into the command without being cleaned, someone who can log in as an admin can add their own shell commands, and the device runs them with the highest privileges.
What is RCE?
Running the attacker's code on the target's servers: through command or code injection, unsafe deserialisation or template injection.