T05 · Unauthorized Access and Privilege Escalation
Error
- Location
- scripts/bridge.py:523
- Finding
- Unauthenticated Outbound Call Creation Using Privileged Twilio Credentials<![CDATA[ ## Vulnerability Details **File Location**: `scripts/bridge.py`, lines 523-557 **Vulnerability Type**: Missing authentication and authorization on a privileged API endpoint **Risk Level**: Critical ### Vulnerable Code ```python @router.post("/call") async def make_call(request: Request): """Initiate an outbound call via Twilio → Gemini Live.""" body = await request.json() to = body.get("to") greeting = body.get("greeting", "") from_number = body.get("from", config.twilio_from) record = body.get("record", config.default_record) if not to: return {"error": "Missing 'to' parameter"} if not twilio_client: return {"error": "Twilio client not initialized (missing auth token)"} # Build TwiML for outbound call twiml_url = f"{config.public_url}/twiml" status_url = f"{config.public_url}/call-status" try: call = twilio_client.calls.create( to=to, from_=from_number, url=twiml_url, status_callback=status_url, status_callback_event=["initiated", "ringing", "answered", "completed"], record=record, ) logger.info(f"Outbound call initiated: {call.sid} to {to}") return {"call_sid": call.sid, "to": to, "from": from_number, "status": "initiated"} except Exception as e: logger.error(f"Failed to create call: {e}") return {"error": str(e)} ``` ### Technical Analysis The `/gemini-live/call` endpoint initiates calls through a Twilio client configured with the operator's account credentials. It does not require an API key, authenticated session, signed request, or authorization decision. The request body directly controls the destination number and can also request a source number. The endpoint therefore exposes a paid, privileged telephony operation to any client that can reach the service. The bridge is documented as internet-accessible, making this defect particularl ...[truncated 1700 chars]
- Remediation
- <![CDATA[ ## Remediation Suggestions 1. Require strong authentication for `/call`, such as a validated service API key, OAuth2 access token, or mutually authenticated TLS. 2. Add authorization that limits call creation to explicitly permitted users or services. 3. Do not allow callers to provide an arbitrary source number. Select it server-side from an approved configuration or validate it against a strict allowlist. 4. Validate destination numbers using a telephone-number parser and require canonical E.164 formatting. 5. Apply destination and geographic allowlists where the deployment does not require arbitrary calling. 6. Add per-principal and global rate limits, concurrent-call limits, spending controls, and anomaly alerts. 7. Return appropriate HTTP status codes without exposing raw provider exception text. 8. Add audit records containing the authenticated principal, destination, call SID, and authorization outcome. 9. Consider requiring a short-lived, purpose-bound authorization token for every outbound call request. ]]>
