Skip to content
RCE Advisory Advanced CVE-2021-32829

GHSL-2021-065: Post-authentication Remote Code Execution (RCE) in ZStack REST API - CVE-2021-32829

The ZStack REST API evaluates a user-supplied Groovy script in a sandbox that can be bypassed via Java annotations, allowing any authenticated user to execute arbitrary commands on the server.

Alvaro Muñoz Follow

Originally disclosed on GitHub Security Lab

ZStack REST API is vulnerable to post-authentication Remote Code Execution (RCE) via bypass of the Groovy shell sandbox

pwntester, on GitHub Security Lab

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 report has not been written yet. The Original tab links to the source.

How it worked

Root cause

The Groovy sandbox only restricts method calls and property access on certain object types, but it does not prevent code execution through Java annotations, which can be abused to bypass the sandbox.

What the attacker needed

Valid user account (any privilege level)

The fix

The issue was fixed in a later release.

How it was found

  1. Authenticate to the ZStack REST API as any non-privileged user or system admin.
  2. Send a GET request to the batch-queries endpoint with a crafted Groovy script in the 'script' parameter that uses an annotation to execute a command.
  3. Observe that the server returns an error but the command has been executed (e.g., a file is created).

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 report has not been written yet. The Original tab links to the source.

ZStack is a cloud management platform. Its REST API lets users run small scripts written in Groovy (a programming language that runs on Java). The developers tried to block dangerous actions with a sandbox, but a flaw in how Groovy handles annotations (special code markers) let attackers escape the sandbox and run system commands. Any logged-in user, even a low-privileged one, could exploit this to take full 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.

More by Alvaro Muñoz

View all

132 more disclosed reports, best first.

More from GitHub Security Lab

View all

The newest disclosed reports for this program.

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.