Contrast discovers zero-day flaw in popular Quarkus Java framework
The Quarkus Dev UI Config Editor accepted simple cross-origin POST requests without authentication or CSRF protection, allowing a malicious website to modify application properties. An attacker could change the JDBC URL to trigger remote code execution on the developer's machine.
Published on contrastsecurity.com
While preparing a talk for the recent DeepSec Conference about attacking the developer environment through drive-by localhost, I reviewed some popular Java frameworks to see if they were vulnerable.
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 Dev UI lacked origin checks and CSRF protection because the developers assumed that binding to localhost made it safe from web-based attacks.
Impact
A malicious website could silently execute code on a developer's machine, potentially leading to theft of credentials or source code, though the attack only affects developers running Quarkus in developer mode and requires them to visit a malicious site.
What the attacker needed
Quarkus running in developer mode; Victim visits a malicious website; No authentication required
How it was found
- Run the Quarkus application in developer mode.
- Visit a malicious website while Quarkus is running.
- The page's JavaScript sends a POST request to the Dev UI to modify the JDBC URL.
- The modified URL includes an INIT parameter that runs a script from an external site.
- The application reloads, the H2 database rebuilds, and the script executes.
- The script compiles a Java method and runs a command, such as opening the calculator.
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.
When developers run Quarkus in developer mode, a web interface on their own computer lets them change settings. Because it only listens on localhost, the Quarkus team assumed it was safe and added no login or request checks. A malicious website could quietly send a request to that interface and change a setting that makes the computer run harmful code.
What is RCE?
Running the attacker's code on the target's servers: through command or code injection, unsafe deserialisation or template injection.