Skip to content
RCE Write-up Advanced

When “1+1” Became $650 — Escaping a Sandbox in Groovy

The graph-search endpoint evaluated the user-supplied query as Groovy code, and although a sandbox blocked direct dangerous calls, an attacker could use the classloader to compile and run arbitrary code, leading to file read and environment variable disclosure.

0x1git Follow

Published on 0x1git.medium.com

I like telling stories about bugs that are interesting but not world-ending. This one felt like a good mix: straightforward to reason about, subtle in how the sandbox failed, and instructive because it shows how brittle blacklists are when you forget about classloaders and reflection.

0x1git, on 0x1git.medium.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 sandbox relied on a blacklist of dangerous method names, but Groovy's classloader and reflection features allowed bypassing those checks to execute arbitrary code.

Impact

An attacker could execute arbitrary code in-process, read local files and environment variables, but network restrictions and per-customer sandboxing limited further exploitation.

What the attacker needed

Access to the graph-search endpoint; ability to send POST requests

The fix

The sandbox should not rely on blacklists; it should use a proper security manager or isolate code execution to prevent classloader and reflection abuse.

How it was found

  1. Send a query containing a Groovy expression that uses the current classloader to parse a new class.
  2. Instantiate the new class and call a method that reads a file.
  3. Observe the file contents in the response.

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.

The application took a search query and ran it as a small program written in the Groovy language. A security filter tried to stop dangerous commands by name, but the attacker found another way to run code by using a feature that loads new classes. This let them read files 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.