GHSL-2020-227: Server-Side Template Injection leading to unauthenticated Remote Code Execution in SCIMono - CVE-2021-21479
SCIMono's custom constraint validators interpolate attacker-controlled schema IDs into error messages that support Java EL expressions, allowing unauthenticated remote code execution. An attacker can send a crafted request to evaluate arbitrary Java code on the server.
Originally disclosed on GitHub Security Lab
A Server-Side Template Injection was identified in SCIMono enabling attackers to inject arbitrary Java EL expressions, leading to unauthenticated Remote Code Execution (RCE) vulnerability.
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
Custom constraint validators pass untrusted input into a message template that supports Java EL evaluation, enabling code execution.
Impact
An unauthenticated attacker could execute arbitrary code on the server.
What the attacker needed
SCIMono server with Bean Validation enabled; No authentication required
The fix
The issue was fixed in version 0.0.19.
How it was found
- Modify the example server to enable Bean Validation and add a dummy Schemas callback.
- Send a request with a non-existing schema ID containing an EL expression.
- Observe the evaluated result in the error response.
- Send a request with an EL expression that runs a system command.
- Observe the process object in the error response, proving 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 report has not been written yet. The Original tab links to the source.
The server builds error messages by inserting user input into a template. That template language can run Java code, so a malicious input makes the server execute commands. No login is needed.
What is RCE?
Running the attacker's code on the target's servers: through command or code injection, unsafe deserialisation or template injection.