T05 · Unauthorized Access and Privilege Escalation
Error
- Location
- scripts/authorize.py:32
- Finding
- Overprivileged Shared Device Token and Unrestricted MCP Tool Dispatch<![CDATA[ ## Vulnerability Details **File Location**: `scripts/authorize.py:32-37`; `scripts/mcp_client.py:1462-1483` **Vulnerability Type**: Excessive authorization scope and unrestricted privileged tool access **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" ) ``` The generic command dispatcher accepts any caller-supplied MCP tool name: ```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 SKU comparison workflow needs image generation, optional artifact upload, model lookup, and task-management operations. The authorization request additionally obtains video, music, speech, voice-write, general wallet-spend, and other shared capabilities that are unrelated to creating SKU comparison charts. The client also provides a generic `call` command without a package-specific allowlist. Consequently, any MCP tool exposed to the shared full-scope bearer token can be selected by name. The safety restrictions in `SKILL.md` are instructional controls rather than an enforceable authorization boundary. This violates least privilege at both layers: 1. The bea ...[truncated 1249 chars]
- Remediation
- <![CDATA[ ## Remediation Suggestions 1. Issue a package-scoped token containing only the permissions required for: - model-card lookup; - image generation and editing; - explicitly approved artifact upload; - task read and user-requested cancellation; - narrowly scoped billing reads. 2. Remove video, music, speech, voice-write, and other unrelated permissions. 3. Avoid granting generic `wallet:spend`; bind charging authorization to the specific approved image operation. 4. Add a local allowlist for the exact MCP tool names used by this Skill and reject all others before opening a session. 5. Enforce the same package-level tool restrictions on the server. Local validation alone is not a security boundary. 6. Use separate credentials for separate packages or capabilities instead of one full-scope token shared by every package. 7. Require explicit user confirmation before expanding an existing credential's scope. ]]>
