Skip to content
RCE Advisory Intermediate CVE-2022-40220

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.

Francesco Benvenuto Follow

Originally disclosed on Cisco Talos

High 7.2 View original

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.

Francesco Benvenuto, on Cisco Talos

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

  1. Send an HTTP POST request to /txt/restore.cgi with a valid TID and basic authentication.
  2. Include a multipart form body containing a line with a crafted nvram key that includes shell commands.
  3. The router writes the body to a temporary file and parses each line.
  4. For each line, it builds an nvram set command and executes it via system().
  5. The injected commands run, for example adding a new user to /etc/passwd and /etc/shadow.
  6. 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.

More by Francesco Benvenuto

View all

152 more disclosed reports, best first.

More from Cisco Talos

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Remote code execution

The lesson behind this report.

Running the attacker's code on the target's servers: through command or code injection, unsafe deserialisation or template injection.