CVE-2021-25646: Getting Code Execution on Apache Druid
Apache Druid's JavaScriptDimFilter class could be tricked into enabling JavaScript execution via a specially crafted JSON key, allowing an attacker to run arbitrary JavaScript and achieve remote code execution. The vulnerability arises from Jackson's deserialization behaviour where an empty key matches a configuration property.
zerodayinitiative.com
Published on zerodayinitiative.com
Apache Druid is a high-performance, modern, real-time analytic database. Druid is designed for workflows where fast ad-hoc analytics, instant data visibility, or high concurrency are required.
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 root cause is that Jackson's deserialization maps an empty JSON key to the JavaScriptConfig parameter because it lacks a @JsonProperty annotation, allowing an attacker to override the configuration and enable JavaScript execution.
Impact
An attacker could execute arbitrary code with the privileges of the Druid server, potentially leading to full system compromise.
What the attacker needed
Network access to Druid server; Druid version before 0.20.1
How it was found
- Send an HTTP request to Druid with a JSON body containing a filter of type "javascript".
- Include an empty key ("") in the JSON to set the JavaScriptConfig, enabling JavaScript execution.
- Provide arbitrary JavaScript code in the "function" key.
- The server executes the JavaScript, leading to remote code 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 write-up has not been written yet. The Original tab links to the source.
Apache Druid is a database that can run JavaScript for filtering data, but this is normally turned off for safety. A flaw in how it reads JSON input let an attacker sneak in a setting that turned JavaScript back on, and then supply their own JavaScript code. That code would run on the server, giving the attacker control over the machine.
What is RCE?
Running the attacker's code on the target's servers: through command or code injection, unsafe deserialisation or template injection.