# CVE-2021-25646: Authenticated users can override system configurations in their requests which allows them to execute arbitrary code.

> Authenticated users can bypass disabled JavaScript execution settings to run arbitrary code on the server.

- **Severity:** High 8.8 (`CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H`)
- **Exploited in the wild:** Not known
- **Login needed:** Any signed-in user
- **Attackable:** Over the internet
- **Victim action needed:** Not needed
- **Fix available:** Yes
- **Published:** 29 Jan 2021
- **Updated:** 13 Feb 2025
- **Also known as:** GHSA-wrqf-rrrw-w3mg

## What is CVE-2021-25646?

CVE-2021-25646 is a high-severity code injection vulnerability in Apache Druid, published on 29 Jan 2021. Any signed-in user can exploit it over the network, with no action from the victim.

### Official description

Apache Druid includes the ability to execute user-provided JavaScript code embedded in various types of requests. This functionality is intended for use in high-trust environments, and is disabled by default. However, in Druid 0.20.0 and earlier, it is possible for an authenticated user to send a specially-crafted request that forces Druid to run user-provided JavaScript code for that request, regardless of server configuration. This can be leveraged to execute code on the target machine with the privileges of the Druid server process.

## Which versions are affected by CVE-2021-25646?

2 open source packages ship an affected version, including org.apache.druid:druid. It affects 1 product.


| Package | Ecosystem | Affected | Fixed in |
| --- | --- | --- | --- |
| `org.apache.druid:druid` | Maven | All versions | 0.20.1 |
| `org.apache.druid:druid` | Maven | All versions | 0.20.1 |

Products: Apache Druid.

## How do I fix CVE-2021-25646?

Upgrade org.apache.druid:druid to 0.20.1 or later.

## Is CVE-2021-25646 being exploited?

It is not confirmed as exploited in the wild, but public exploit code for CVE-2021-25646 exists.

Public exploit code:

- Alibaba-Nacos-Unauthorized/ApacheDruid-RCE_CVE-2021-25646/MS-Exchange-SSRF-CVE-2021-26885/Oracle-WebLogic-CVE-2021-2109_RCE/RG-CNVD-2021-14536/RJ-SSL-VPN-UltraVires/Redis-Unauthorized-RCE/TDOA-V11.7-GetOnlineCookie/VMware-vCenter-GetAnyFile/yongyou-GRP-U8-XXE/Oracle-WebLogic-CVE-2020-14883/Oracle-WebLogic-CVE-2020-14882/Apache-Solr-GetAnyFile/F5-BIG-IP-CVE-2021-22986/Sonicwall-SSL-VPN-RCE/GitLab-Graphql-CNVD-2021-14193/D-Link-DCS-CVE-2020-25078/WLAN-AP-WEA453e-RCE/360TianQing-Unauthorized/360TianQing-SQLinjection/FanWeiOA-V8-SQLinjection/QiZhiBaoLeiJi-AnyUserLogin/QiAnXin-WangKangFirewall-RCE/金山-V8-终端安全系统/NCCloud-SQLinjection/ShowDoc-RCE (github_poc): https://github.com/1n7erface/PocList
- Apache Druid 远程代码执行;检测脚本 (github_poc): https://github.com/yaunsky/cve-2021-25646
- Apache Druid remote code execution vulnerability - Apache Druid 远程代码执行漏洞利用 CVE-2021-25646 (github_poc): https://github.com/j2ekim/CVE-2021-25646
- CVE-2021-25646 Apache Druid 远程代码执行 漏洞检测和利用工具 (github_poc): https://github.com/k7pro/CVE-2021-25646-exp
- https://github.com/Vulnmachines/Apache-Druid-CVE-2021-25646 (github_poc): https://github.com/Vulnmachines/Apache-Druid-CVE-2021-25646
- CVE-2021-25646 Apache Druid 远程代码执行漏洞 Wker脚本 (github_poc): https://github.com/givemefivw/CVE-2021-25646

## Other vulnerabilities in Apache Druid

- [CVE-2026-23906](https://insights.sbomify.com/CVE-2026-23906/): Apache Druid: Authentication Bypass via LDAP Anonymous Bind (critical 9.8)
- [CVE-2025-59390](https://insights.sbomify.com/CVE-2025-59390/): Apache Druid: Kerberos authenticaton chooses a cryptographically unsecure secret if not configured explicitly. (critical 9.8)
- [CVE-2021-26919](https://insights.sbomify.com/CVE-2021-26919/): Apache Druid Authenticated users can execute arbitrary code from malicious MySQL database systems. (high 8.8)
- [CVE-2024-45537](https://insights.sbomify.com/CVE-2024-45537/): Apache Druid: Users can provide MySQL JDBC properties not on allow list (medium 6.5)
- [CVE-2021-36749](https://insights.sbomify.com/CVE-2021-36749/): Druid ingestion system Authenticated users can read data from other sources than intended (medium 6.5)

## Fix prompt for AI coding agents

```text
Check this codebase for CVE-2021-25646 and fix it if it is affected.

What it is: CVE-2021-25646 is a high-severity code injection vulnerability in Apache Druid, published on 29 Jan 2021. Any signed-in user can exploit it over the network, with no action from the victim.
Exploitation: It is not confirmed as exploited in the wild, but public exploit code for CVE-2021-25646 exists.

Affected packages and fixed versions:
- org.apache.druid:druid (Maven): affected all versions; fixed in 0.20.1
- org.apache.druid:druid (Maven): affected all versions; fixed in 0.20.1

Task:
1. Search the dependency manifests and lockfiles (for example package.json, package-lock.json, requirements.txt, poetry.lock, uv.lock, pom.xml, build.gradle, go.mod, Cargo.lock, Gemfile.lock) and any Dockerfiles for the affected packages, including transitive dependencies.
2. If an affected version is in use, upgrade it to the fixed version for its release line with the project's package manager, so the lockfile is regenerated. Prefer the smallest upgrade that fixes it.
3. If there is no fix, or the upgrade would break the build, do not guess: explain the risk and the safest workaround instead.
4. Run the tests and summarise what changed and why.
5. If nothing in the project is affected, say so and change nothing.

Reference: https://insights.sbomify.com/CVE-2021-25646/ (Markdown: https://insights.sbomify.com/CVE-2021-25646/index.md)
```

## Sources

- CVE record: https://www.cve.org/CVERecord?id=CVE-2021-25646
- NVD: https://nvd.nist.gov/vuln/detail/CVE-2021-25646
- OSV: https://osv.dev/vulnerability/CVE-2021-25646

---
From sbomify Insights: https://insights.sbomify.com/CVE-2021-25646/
Summaries are generated and may contain mistakes; the official description above is the record.
