Siretta QUARTZ-GOLD httpd txt/restore.cgi OS command injection vulnerability
The router's restore.cgi endpoint parses uploaded key-value lines and passes them to a system command without sanitisation, allowing an attacker to inject shell commands. An authenticated attacker could execute arbitrary commands and add a new root user.
Originally disclosed on Cisco Talos
An OS command injection vulnerability exists in the httpd txt/restore.cgi functionality of Siretta QUARTZ-GOLD G5.0.1.5-210720-141020. A specially-crafted network request can lead to arbitrary 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 web server builds a shell command using unvalidated user-supplied nvram key and value strings and executes it with system().
Impact
An authenticated attacker could execute arbitrary commands as root, leading to full compromise of the device.
What the attacker needed
Valid basic authentication; valid TID parameter; network access to the router's web interface
The fix
The vendor released a patch, but the text does not describe the fix details.
How it was found
- Send an HTTP POST request to /txt/restore.cgi with a valid TID and basic authentication.
- Include a multipart form body containing a line with a crafted nvram key that includes shell commands.
- The router writes the body to a temporary file and parses each line.
- For each line, it builds an nvram set command and executes it via system().
- The injected commands run, for example adding a new user to /etc/passwd and /etc/shadow.
- Log in via telnet on port 2323 using the injected credentials.
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 page for restoring settings. It takes lines of text from the uploaded file and runs them as part of a system command. Because it does not check for special characters, someone who can log in can sneak in extra commands that the router will run as root.
What is RCE?
Running the attacker's code on the target's servers: through command or code injection, unsafe deserialisation or template injection.