StackStorm - From Originull to RCE - CVE-2019-9580
The StackStorm REST API reflected a malformed Origin header as 'Access-Control-Allow-Origin: null', granting full CORS privileges to the null origin. An attacker could trick an authenticated user into visiting a malicious page that reads and writes to the API, leading to remote code execution on managed servers.
quitten.github.io
Published on quitten.github.io
StackStorm (aka “IFTTT for Ops”) is event-driven automation for auto-remediation, security responses, troubleshooting, deployments, and more. In this blogpost I will describe how can you cause RCE on targeted servers which only requires an authenticated user browse to malicious webpage.
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 server reflected a malformed Origin header as 'null' in Access-Control-Allow-Origin instead of rejecting it, and also allowed credentials, so any page with a null origin could make authenticated cross-origin requests.
Impact
An attacker could read and modify StackStorm actions and workflows and execute commands on any server accessible by the StackStorm agent, but the exploit required the victim to open a local file or use a browser-specific bypass to get a null origin from a web page.
What the attacker needed
Victim is authenticated to StackStorm; victim opens a malicious file or link; attacker can host a malicious page
The fix
The vulnerability was fixed in StackStorm versions 2.9.3 and 2.10.3.
How it was found
- Send a malformed Origin header to the StackStorm REST API and observe the response includes Access-Control-Allow-Origin: null.
- Create a page that runs JavaScript in a null origin context, for example using a data: URL or javascript: scheme.
- From that page, use fetch with credentials to call the StackStorm API and read the response.
- Use the API to create or update actions and workflows, or execute the core.remote action to run commands on managed hosts.
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.
Websites use a rule called CORS to decide which other websites can read their data. StackStorm mistakenly trusted a special 'null' origin, which a malicious page can pretend to be. So an attacker could make a logged-in user's browser send requests to StackStorm and read the responses, then run commands on servers.
What is CORS?
A permissive cross-origin policy lets another site read responses with the user's credentials.