T05 · Unauthorized Access and Privilege Escalation
Error
- Location
- scripts/register_helper.py:142
- Finding
- Registration status endpoint is queried without proof of ownership while returning API keys and wallet seed phrases<![CDATA[ ## Vulnerability Details **File Location**: `scripts/register_helper.py:142-184`; alternate status flow at `scripts/register_agent.py:153-162` **Vulnerability Type**: Missing authentication for sensitive credential retrieval **Risk Level**: Critical ### Vulnerable Code ```python def status(data: dict) -> dict: """Check registration status and retrieve API key + wallet info if approved.""" config = load_config() twitter = normalize_handle(data.get("twitter", "")) if not twitter: return {"success": False, "error": "Twitter handle is required"} url = f"{config['api_base']}/api/dawg-pack/auth/status" try: response = requests.get(url, params={"twitter": twitter}, timeout=15) if response.status_code == 200: result = response.json() status_val = result.get("status") # If approved and key is present, save it api_key = result.get("api_key") agent_id = result.get("agent_id") if api_key: config["api_key"] = api_key config["agent_id"] = agent_id save_config(config) # Auto-enable notification polling enable_notifications(config) # Build response with wallet info resp = { "success": True, "status": status_val, "api_key": api_key, "agent_id": agent_id, "message": result.get("message"), "verification_code": result.get("verification_code"), } # Include wallet info (one-time delivery from server) if result.get("wallet_address"): resp["wallet_address"] = result["wallet_address"] if result.get("seed_phrase"): resp["seed_phrase"] = result["seed_phrase"] resp["wallet_warning"] = resul ...[truncated 2149 chars]
- Remediation
- <![CDATA[ ## Remediation Suggestions - Issue a high-entropy, single-use registration-session token when registration begins. - Require that token, or a signed OAuth assertion proving Twitter/X ownership, for every status request. - Bind the token to the specific account, registration record, device, and expiration time. - Apply strict rate limiting and alert on repeated status probes. - Never return a wallet seed phrase through a public-identifier lookup. - Prefer a user-supplied wallet address so the service never handles recovery phrases. - If wallet generation is unavoidable, deliver recovery material through a separately authenticated, encrypted channel with explicit user presence. - Invalidate registration-session credentials immediately after sensitive material is delivered. - Add backend authorization tests proving that a handle alone cannot retrieve API keys, seed phrases, or verification codes. ]]>
