T05 · Unauthorized Access and Privilege Escalation
Error
- Location
- scripts/a2a_server.py:37
- Finding
- Unauthenticated Network Exposure of the Privileged Main Agent## Vulnerability Details **File Location**: `scripts/a2a_server.py:37-43`, `scripts/a2a_server.py:111-174`, `scripts/a2a_server.py:207` **Vulnerability Type**: Missing authentication and violation of least privilege **Risk Level**: Critical ### Vulnerable Code ```python def check_auth(self) -> bool: if not self.required_token: return True auth_header = self.headers.get('Authorization', '') if auth_header.startswith('Bearer '): return auth_header[7:] == self.required_token return False ``` ```python def handle_message_send(self, params: Dict[str, Any], request_id: str) -> Dict[str, Any]: message = params.get('message', {}) parts = message.get('parts', []) # Extract text text = "" for part in parts: if part.get('type') == 'text': text = part.get('text', '') break if not text: return { "jsonrpc": "2.0", "error": {"code": -32602, "message": "No text in message"}, "id": request_id } # Call OpenClaw agent print(f"[A2A] Received: {text}") try: result = subprocess.run( ['openclaw', 'agent', '--agent', 'main', '--message', text, '--json'], capture_output=True, text=True, timeout=120 ) if result.returncode == 0: try: agent_response = json.loads(result.stdout) response_text = agent_response.get('content', result.stdout) except json.JSONDecodeError: response_text = result.stdout else: response_text = f"Error: {result.stderr}" print(f"[A2A] Response: {response_text[:100]}...") except subprocess.TimeoutExpired: response_text = "Error: Agent timeout" except Exception as e: ...[truncated 2026 chars]
- Remediation
- ## Remediation Suggestions - Require authentication by default and refuse to start without an authentication configuration when binding to a non-loopback address. - Bind to `127.0.0.1` by default; require an explicit secure option to bind to external interfaces. - Route remote requests to a dedicated least-privileged agent rather than `main`. - Disable command execution, unrestricted file access, secret access, and other high-risk tools for the remote-facing agent. - Add an authorization policy that limits callers to explicitly approved capabilities. - Require user approval before performing sensitive operations initiated by remote messages. - Use a constant-time token comparison and support token rotation, expiration, and revocation. - Add request rate limits, audit logging, and network-level access controls. - Change the documented quick start to a secure authenticated configuration.
