Skip to content
RCE Write-up Advanced

Detailing SaltStack Salt Command Injection Vulnerabilities

The Salt rest-cherrypy netapi module did not validate the token or eauth parameters, allowing an unauthenticated attacker to reach the salt-ssh subsystem. User-controlled parameters such as ssh_priv were passed unsanitised into a shell command, enabling arbitrary command execution on the Salt master.

zerodayinitiative.com

Published on zerodayinitiative.com

On November 03, SaltStack released a security patch for Salt to fix three critical vulnerabilities. Two of these fixes were in response to five bugs originally reported through the ZDI program.

The author, on zerodayinitiative.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

Likely the authentication check only tested for the presence of token or eauth rather than validating them, and user-controlled parameters were concatenated into a shell command string executed with the system shell.

Impact

An unauthenticated attacker could run arbitrary commands on the system running the affected Salt application, but only if the non-default rest-cherrypy module is enabled.

What the attacker needed

Rest-cherrypy netapi module enabled; network access to the Salt API

The fix

It was fixed by disabling the system shell when executing commands and by adding validation for the eauth and token parameters.

How it was found

  1. Enable the rest-cherrypy netapi module in the Salt master configuration.
  2. Send a POST request to the /run endpoint with client set to ssh.
  3. Supply a token or eauth parameter with any arbitrary value to pass the check.
  4. Include command injection characters in a parameter such as ssh_priv, ssh_user, ssh_port, ssh_remote_port_forwards or ssh_options.
  5. The crafted value is used in a shell command, executing arbitrary commands on the host.

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.

Salt is a tool for managing many servers. Its REST API had a login check that only looked for the presence of a token, not whether the token was valid, so anyone could get past it. Once past, some input was placed into a command run by the operating system's shell, so special characters in that input could run extra commands on the server.

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.