SaltStack API vulnerabilities
The Salt API had an authenticated argument injection in its SSH client and an unauthenticated arbitrary file write via the wheel_async client and a path traversal in pillar_roots.write. An attacker could execute commands or write files, potentially leading to remote code execution.
dozer.nz
Published on dozer.nz
In November 2020 after seeing a pre-auth RCE (CVE-2020-16846, CVE-2020-25592) get dropped for Salt API, I wanted to find my own. This resulted in CVE-2021-3197, CVE-2021-25281 and CVE-2021-25282, which I detail in this post.
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 SSH client passed user-supplied parameters directly to the ssh command without sanitising argument separators, and the wheel_async client lacked an authentication check while pillar_roots.write allowed path traversal.
Impact
An authenticated attacker could execute arbitrary commands via argument injection, and an unauthenticated attacker could write arbitrary files, potentially leading to remote code execution as root.
What the attacker needed
Valid credentials for argument injection; at least one roster host defined; no authentication for file write
How it was found
- Send a POST request to /run with client=ssh and a crafted ssh_port parameter containing a tab and an SSH option.
- The injected option causes SSH to execute an arbitrary command via ProxyCommand.
- Send a POST request to /run with client=wheel_async and fun=pillar_roots.write, using a path traversal to write a crontab file.
- Wait for the cron job to execute and create the file /tmp/rce4.
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 computers. Its API lets users run commands on those computers. The API had two flaws: one let a logged-in user sneak extra options into a command that connects to other machines, and another let anyone write files on the server without logging in. By writing a scheduled task file, an attacker could run their own commands as the root user.
What is RCE?
Running the attacker's code on the target's servers: through command or code injection, unsafe deserialisation or template injection.