Router nr1800x Command Injection Via Setussd
The router's CGI handler takes a user-supplied USSD value, formats it into a buffer and passes it to a system() call, allowing command injection. An attacker could chain this with an authentication bypass to run commands on the device, such as starting a telnet service.
Published on infosecwriteups.com
In a Mitre publication, a vulnerability of a TOTOLink NR1800X router (CVE-2022–41525) version V9.1.0u.6279B20210910 appeared, which caught my attention so I kept learning more about the vulnerability.
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
Likely the ussd request value is formatted into a buffer with snprintf and then handed to system() without sanitisation, so shell metacharacters in the value are executed.
Impact
An attacker could execute arbitrary commands on the router, for example starting telnetd, once the authentication bypass is chained in.
What the attacker needed
Access to the router's web interface; an authentication bypass to reach the handler
How it was found
- Send a request whose body contains the ussd value.
- Observe websGetVar() reading the ussd value from the request.
- Watch snprintf() format the string into the stack buffer.
- See system() called with the formatted string.
- Use the setUssd action name to trigger the vulnerable path.
- Chain an authentication bypass request so the session is accepted by the second request.
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 router's web interface passes a value from the request straight into a shell command without cleaning it. If someone puts shell instructions in that value, the router runs them as if an administrator typed them. The author also chains a separate login bypass so the malicious request is accepted.
What is RCE?
Running the attacker's code on the target's servers: through command or code injection, unsafe deserialisation or template injection.