Skip to content
RCE Write-up Intermediate

Affected products

An authenticated command injection vulnerability in the SonicWall SMA 100 series web interface allows an attacker to execute arbitrary commands as root. The flaw is in the viewcert CGI binary, where the CERT parameter is insufficiently sanitised, allowing a newline character to break out of an rm -rf command.

attackerkb.com

Published on attackerkb.com

On December 7, 2021, SonicWall released new firmware for their Secure Mobile Access (SMA) 100 series. SonicWall issued a security advisory on January 11, 2022 notifying users that the December releases fixed security issues found by Rapid7.

Rapid7, on attackerkb.com

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 safeSystemCmdArg2 function fails to treat the newline character as unsafe, allowing an attacker to terminate the intended rm -rf command and start a new one.

Impact

An attacker with valid credentials (including default credentials if unchanged) could execute arbitrary commands as root, leading to full system compromise.

What the attacker needed

Authentication (default credentials may work)

The fix

The vulnerability was fixed in firmware updates released by SonicWall in December 2021.

How it was found

  1. Log in to the web interface using default credentials to obtain a session cookie.
  2. Send a request to the viewcert endpoint with the delete button type and a CERT parameter containing a newline followed by a command.
  3. Observe the command execution by the delay in the server response.

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.

This is a command injection bug. The web server takes a user-supplied value and uses it to build a shell command without properly checking for dangerous characters. An attacker who can log in can sneak in extra commands that run with the highest privileges on the device.

What is RCE?

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

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.