Unveiling Rhinos Blind Spot
Apigee's JavaScript sandbox (Rhino) could be bypassed by passing a custom Java object from a JavaCallout policy into a JavaScript policy via a flow variable. An attacker with the ability to deploy policies could execute arbitrary system commands on the Apigee server.
Published on infosecwriteups.com
Welcome to the first post in a series where I’ll be diving into the security research I conducted on Apigee throughout 2023. I spent a lot of time exploring the ins and outs of this platform, and my work even caught the attention of Google Bug Hunters.
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 ClassShutter allowed any class whose name started with an allowed package prefix, and objects could be shared between policies via flow variables, so a malicious Java class placed in an allowed package could be instantiated and used from JavaScript to bypass the sandbox.
Impact
An attacker could execute arbitrary commands on the Apigee server, leading to system compromise, data exfiltration, and further attacks.
What the attacker needed
Ability to deploy Apigee API proxies with custom policies
The fix
The vulnerability was fixed (as stated in the text).
How it was found
- Create a JavaCallout policy with a custom Java class in an allowed package that stores an instance in a flow variable.
- Create a JavaScript policy that retrieves the object from the flow variable and calls its method to run a command.
- Deploy the API proxy with both policies and send a request to trigger the exploit.
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 lets developers run custom code (Java, JavaScript, Python) inside API proxies. The JavaScript sandbox was supposed to block access to dangerous Java classes, but a custom Java class could be named to pass the filter and then handed to JavaScript, which could call its methods. This let an attacker run system commands 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.