Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Disable dynamic Groovy scripting by marking Groovy as not sandboxed #9655

Closed
clintongormley opened this issue Feb 11, 2015 · 4 comments
Closed

Comments

@clintongormley
Copy link

Elasticsearch versions 1.3.0-1.3.7 and 1.4.0-1.4.2 have vulnerabilities in the Groovy scripting engine. The vulnerability allows an attacker to construct Groovy scripts that escape the sandbox and execute shell commands as the user running the Elasticsearch Java VM.

We have been assigned CVE-2015-1427 for this issue.

Versions 1.3.8 and 1.4.3 disable sandboxing for Groovy by default. As a consequence, dynamic script execution is disabled for Groovy. In other words, inline Groovy scripts will not be accepted as part of a request, and will not be retrieved from the .scripts index. Groovy scripts can still be used if they are stored in files in the config/scripts directory.

Users should upgrade to 1.3.8 or 1.4.3. Users that do not want to upgrade can address the vulnerability by setting script.groovy.sandbox.enabled to false in config/elasticsearch.yml and restarting the node.

Groovy dynamic scripting disabled in:

@bjm88
Copy link

bjm88 commented Mar 25, 2015

We had this security issue exploited against our UAT/test AWS instance. Production ES cluster is behind firewall, but UAT/test env was not. I suspect a scanning of port 9200 for ES is how we were identified. In elastic search logs we saw the below, you see the use groovy script to get java Runtime and do exec. In our case they put a udp bot in our /tmp folder likely to launch udp port 80 DOS attacks.

org.elasticsearch.search.SearchParseException: [caredox_demo_medications][4]: from[-1],size[1]: Parse Failure [Failed to parse source [{"size":1,"script_fields":{"exp":{"script":"java.lang.Math.class.forName("java.io.BufferedReader").getConstructor(java.io.Reader.class).newInstance(java.lang.Math.class.forName("java.io.InputStreamReader").getConstructor(java.io.InputStream.class).newInstance(java.lang.Math.class.forName("java.lang.Runtime").getRuntime().exec("chmod 777 /tmp/bvxz.fp").getInputStream())).readLines()","lang": "groovy"}}}]]

@jiamo
Copy link

jiamo commented Sep 28, 2015

elasticsearch-1.7.2 set script.disable_dynamic: false. The tool from https://github.com/Svti/ElasticSearchEXP still can success exec command.

@dakrone
Copy link
Member

dakrone commented Sep 28, 2015

elasticsearch-1.7.2 set script.disable_dynamic: false. The tool from
https://github.com/Svti/ElasticSearchEXP still can success exec
command.

This is if you enable dynamic scripting (which is off by default). If
you enable dynamic scripting you will need to protect Elasticsearch by
other means (binding to localhost only, or using a firewall).

@jiamo
Copy link

jiamo commented Sep 28, 2015

Can elastisseach scripts only identify like "script" : "ctx._source.counter += count", and disable script in the https://github.com/Svti/ElasticSearchEXP ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants