Skip to content
RCE Write-up Advanced

CVE-2020-28243 SaltStack Minion Local Privilege Escalation

A command injection vulnerability in SaltStack's restartcheck module allows a local attacker to escalate privileges to root by crafting a process name containing shell metacharacters and having an open file descriptor to a file with a name ending in '(deleted)' in a non-forbidden directory. When the master calls restartcheck, the malicious process name is passed to a shell command, enabling arbitrary command execution as root.

sec.stealthcopter.com

Published on sec.stealthcopter.com

I discovered a command injection vulnerability in SaltStack’s Salt that allows privilege escalation via specially crafted process names on a minion when the master calls restartcheck.

The author, on sec.stealthcopter.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 restartcheck module builds a shell command using a package name derived from a process name without sanitising shell metacharacters, and executes it with shell=True.

Impact

A local user with write access to certain directories can escalate privileges to root on the minion, and the same technique could potentially be used to escape a container or, under certain circumstances, be triggered by a remote attacker who can influence process names.

What the attacker needed

Local shell access on the minion; write access to a non-forbidden directory; master runs restartcheck

The fix

The vulnerability was fixed in SaltStack version 3002.5 and later, as indicated by the affected versions and the security fix release.

How it was found

  1. Find a writable directory not in SaltStack's forbidden list.
  2. Create a process whose name contains a command injection payload and that holds an open file descriptor to a file ending in '(deleted)' in that directory.
  3. On the master, run the restartcheck.restartcheck command.
  4. The injected command executes as root on the minion.

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.

SaltStack is a tool that manages many computers from a central master. A bug in one of its modules let a normal user on a managed computer trick the master into running commands as the root administrator. The user just needed to create a process with a special name and an open file, and then wait for the master to check which services need restarting.

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.