Skip to content
RCE Write-up Intermediate

The SSH host field, and the thirty minutes that went nowhere

Two OS command injection vulnerabilities existed in SSH host fields of a cloud server provisioning platform, where user input was passed to curl via shell_exec. An attacker could execute arbitrary commands, one as root and the other as a service user in a per-customer container.

saurinn.github.io

Published on saurinn.github.io

I found two OS command injections in a bug bounty program in two different features of a platform that provisions cloud servers for its customers. Both took an SSH host and passed it to curl inside a shell rather than making the connection themselves, and one of them ran the resulting command as root.

The author, on saurinn.github.io

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 application used shell_exec to run curl with unquoted user input, allowing shell metacharacters to break out of the intended command.

Impact

An attacker could execute arbitrary commands on the server, potentially as root in one case and as a service user in a per-customer container in the other, leading to full compromise of the container or host.

What the attacker needed

Access to the SSH host input field; no authentication mentioned

The fix

The vulnerabilities were fixed by the program within two days.

How it was found

  1. Enter a host value containing a semicolon and a command into the SSH host field of the connectivity test panel.
  2. Observe that the command executes and its output appears in the response.
  3. For the second bug, enter a URL with a query or fragment containing a semicolon and a command into the file configuration download host field.
  4. Observe that the command executes and its output appears in the 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.

The application took a hostname typed by the user and inserted it directly into a command line that it ran on the server. Because the input was not properly sanitised, an attacker could add extra shell commands after the hostname, and those commands would run on the server with the application's privileges.

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.