Exploiting CVE-2021-25770: A Server-Side Template Injection in YouTrack
YouTrack's notification template preview feature allowed administrators to inject Freemarker template expressions, and a known sandbox bypass in Freemarker 2.3.23 enabled remote code execution. An attacker with admin access could execute arbitrary commands on the server.
synacktiv.com
Published on synacktiv.com
Rédigé par Vincent Herbulot - 11/02/2021 - dans Exploit, Pentest - Téléchargement
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
Impact
An attacker with administrative privileges could execute arbitrary commands on the server, leading to full compromise.
What the attacker needed
Admin access to YouTrack
The fix
The vulnerability was fixed by updating YouTrack to version 2020.5.3123, which uses Freemarker 2.3.30 with a StrictMemberAccessPolicy.
How it was found
- Install the vulnerable YouTrack version using Docker.
- Access the administrative panel and find the Notification Templates feature.
- Send a POST request to the preview endpoint with a template containing a simple expression to confirm injection.
- Use a Freemarker sandbox bypass payload to execute the 'id' command.
- Observe the command output in the response.
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.
YouTrack lets administrators customise email notifications using templates. The template engine, Freemarker, can run code if you put special expressions in the template. The version used had a flaw that let an attacker break out of the safety sandbox and run system commands.
What is RCE?
Running the attacker's code on the target's servers: through command or code injection, unsafe deserialisation or template injection.