T05 · Unauthorized Access and Privilege Escalation
Error
- Location
- scripts/authorize.py:34
- Finding
- Excessive OAuth Scopes and Unrestricted MCP Tool Invocation<![CDATA[ ## Vulnerability Details **File Location**: `scripts/authorize.py:34-37`; `scripts/mcp_client.py:1463-1480` **Vulnerability Type**: Violation of least privilege **Risk Level**: High ### Vulnerable Code ```python SCOPE = ( "mcp:tools artifacts:write images:generate videos:generate music:generate " "speech:generate voices:read voices:write wallet:spend tasks:read artifacts:read tasks:cancel" ) ``` ```python def _run_command(command: str, tool_name: str | None = None) -> dict[str, Any]: session = _session_with_registration( state_dir=Path.home() / ".beatra", post_json=_default_post_json, ) if command == "tools": return session.request(2, "tools/list", {}) try: arguments = json.load(os.sys.stdin) except json.JSONDecodeError as exc: raise RuntimeError("Tool arguments on stdin must be one JSON object") from exc if not isinstance(arguments, dict): raise RuntimeError("Tool arguments on stdin must be one JSON object") assert tool_name is not None return session.request( 2, "tools/call", {"name": tool_name, "arguments": arguments}, ) ``` ### Technical Analysis The Skill is declared as an RFP-cover image generator, but its authorization request includes unrelated permissions for video, music, speech, voice modification, generic wallet spending, and task cancellation. These permissions exceed the minimum capabilities needed to generate and optionally edit image covers. The bundled client compounds this issue by accepting any caller-supplied MCP tool name. It does not enforce a local allowlist corresponding to the Skill's documented operations. Consequently, any process or agent instruction able to invoke the bundled client can attempt unrelated operations using the shared full-scope bearer token. The credential is shared among Beatra Skills, increasing the potential blast radius if the client, instructions, or local environment are compromis ...[truncated 1285 chars]
- Remediation
- <![CDATA[ ## Remediation Suggestions 1. Replace the broad scope with the minimum permissions required for this Skill: - Image generation and image editing. - Model-price lookup. - Required artifact upload and result retrieval. - Read-only task polling. - Narrow read-only wallet access where explicitly requested. 2. Remove video, music, speech, voice-write, generic wallet-spend, and task-cancel scopes unless a documented workflow requires them. 3. Use per-Skill credentials or audience-restricted capability tokens instead of one shared full-scope device token. 4. Add a strict local allowlist in `_run_command`, rejecting any tool outside the documented RFP-cover workflow. 5. Separate read-only and billable operations and require explicit user confirmation immediately before each billable operation. 6. Have the server enforce package-specific tool policies rather than relying exclusively on client-side restrictions. 7. Display the exact requested scopes to the user on the authorization page before approval. ]]>
