Skip to content
RCE Write-up Advanced

Judge0 Sandbox Escape

Judge0's sandbox could be escaped because the application wrote files outside the sandbox and allowed command injection through newline characters in command-line arguments. An attacker with access to submit code could overwrite files on the host and execute commands as root, leading to full host compromise.

Daniel Cooper Follow

Published on tantosec.com

Judge0 is an open source service used to run arbitrary code inside a secure sandbox. The Judge0 website lists 23 clients using the service, with more than 300 self-hosted instances available on the public internet and potentially many more within internal networks.

Daniel Cooper, on tantosec.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 failed to properly sanitise user-controlled command-line arguments and performed file operations outside the sandbox without preventing symbolic link attacks.

Impact

An attacker could execute arbitrary commands as root on the host, leading to full system compromise.

What the attacker needed

Access to submit code to Judge0; ability to set command_line_arguments; default database password (for one variant)

The fix

The vulnerabilities were fixed in version v1.13.1 by changing the user the application runs as and patching specific bypasses, though the core arbitrary file write issue remains.

How it was found

  1. Submit code with a newline character in the command_line_arguments parameter to inject a command.
  2. Create a symlink named 'run' inside the sandbox directory using the gsub bypass.
  3. Use the symlink to overwrite the isolate binary with a malicious script.
  4. Trigger execution of the overwritten binary to run commands outside the sandbox.

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.

Judge0 is a service that runs code in a sandbox to keep it safe. The sandbox is like a locked box, but the program that manages it made mistakes: it let attackers sneak extra commands through newlines and write files outside the box. This meant an attacker could break out and run commands on the main computer.

What is RCE?

Running the attacker's code on the target's servers: through command or code injection, unsafe deserialisation or template injection.

More by Daniel Cooper

View all

1 more disclosed report, best first.

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.