Skip to content
RCE Write-up Advanced

Breaking the Sandbox

The PythonScript policy in Apigee used Java Permissions to block direct command execution, but the exposed flow object provided access to an internal execution context whose submitTask method ran a Runnable without those restrictions. An attacker with the ability to deploy a PythonScript policy could execute arbitrary commands on the server.

bugs.exposed

Published on bugs.exposed

Apigee Sandbox Research

The author, on bugs.exposed

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 internal execution context object exposed through the flow object allowed task submission that bypassed the Java Permissions enforced on the normal PythonScript execution path.

Impact

An attacker who can deploy a PythonScript policy could execute arbitrary commands on the server, potentially leading to access to the server and its data.

What the attacker needed

Ability to deploy a PythonScript policy

How it was found

  1. Deploy a PythonScript policy that uses the flow object to call getExecutionContext.
  2. Use Java reflection to list the methods of the execution context and find submitTask.
  3. Create a Runnable class whose run method executes a system command.
  4. Submit an instance of that class using the single-argument overload of submitTask.
  5. Observe outbound requests to a Canarytoken URL, confirming command execution.

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.

Apigee is a system for managing APIs, and it lets you add small Python scripts to customise how requests are handled. Those scripts are supposed to run in a sandbox, a restricted environment that stops them from running system commands or opening network connections. The researcher found that one of the objects given to the script, called flow, had a hidden method that could run code outside the sandbox, so a malicious script could take control of 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.