T05 · Unauthorized Access and Privilege Escalation
Error
- Location
- scripts/authorize.py:33
- Finding
- Overprivileged Shared Authorization with Unrestricted MCP Tool Dispatch## Vulnerability Details **File Location**: `scripts/authorize.py:33-37`; `scripts/mcp_client.py:1463-1483` **Vulnerability Type**: Excessive OAuth scope and unrestricted privileged tool invocation **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 declared workflow primarily requires text-to-speech generation, voice and model discovery, artifact access, and task-result retrieval. Authorization nevertheless requests unrelated capabilities for image, video, and music generation, voice mutation, general wallet spending, and task cancellation. The command-line client also accepts an arbitrary `tool_name` and forwards it to the remote MCP endpoint without enforcing a package-specific allowlist. Consequently, the local client does not constrain use of the bearer credential to the operations documented by this Skill. The credential is shared across installed Beatra Skills. This increases the security boundary affected by compromise: inj ...[truncated 1355 chars]
- Remediation
- ## Remediation Suggestions 1. Replace the shared full-scope token with a package-specific, least-privilege credential. 2. Remove image, video, music, broad wallet-spend, voice-write, and task-cancel scopes unless a documented workflow requires them. 3. Implement a strict local allowlist for this Skill, such as model listing, voice listing, speech synthesis, authorized asset upload, task retrieval, and explicitly requested wallet reads. 4. Separate read-only, paid, and destructive tools into distinct authorization levels. 5. Require explicit user confirmation immediately before every paid, destructive, or account-mutating call. 6. Bind server-side authorization to the package identity rather than trusting client-provided source metadata. 7. Do not allow one compromised Skill to reuse a credential issued to unrelated Skills.
