Skip to content
RCE Write-up Advanced

Hack the Stack with LocalStack: Code Vulnerabilities Explained

LocalStack lacked authentication and allowed cross-origin requests, so an attacker could use CSRF to reconfigure the edge router to forward requests to an attacker-controlled host, creating a persistent SSRF and XSS. This could then be chained with a command injection in the dashboard to execute arbitrary system commands on the developer's machine.

blog.sonarsource.com

Published on blog.sonarsource.com

LocalStack is a popular open source application that provides an easy-to-use test framework for cloud applications. It enables you to host a fully functional AWS cloud setup in your local network for developing and testing cloud and serverless apps.

The author, on blog.sonarsource.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 application trusted all requests from the local network without authentication and allowed cross-origin requests, and it concatenated user input into a shell command without sanitisation.

Impact

An attacker could completely compromise the local LocalStack instance and execute arbitrary system commands on the developer's machine, and could steal AWS credentials from forwarded requests.

What the attacker needed

Victim uses LocalStack; victim visits a malicious website; LocalStack dashboard is active

The fix

The vulnerabilities were left unpatched by the vendor, who assessed the risk as limited; they should be fixed by adding authentication, restricting CORS, sanitising output, and avoiding shell command concatenation.

How it was found

  1. The victim visits a malicious website controlled by the attacker.
  2. JavaScript on the site sends cross-site requests to the victim's LocalStack instance.
  3. The attacker uses these requests to change LocalStack configuration, setting the hostname to an attacker-controlled IP and disabling in-memory forwarding.
  4. The attacker's server responds with an XSS payload, which is printed unsanitised, creating persistent XSS.
  5. The attacker uses the XSS to call the dashboard endpoint with a crafted function name that injects a system command.

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.

LocalStack is a tool that lets developers run a fake version of Amazon's cloud services on their own computer. The report found that a malicious website could quietly send commands to this local tool because it had no login and allowed requests from any website. By chaining several weaknesses, an attacker could take over the developer's computer.

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.