T05 · Unauthorized Access and Privilege Escalation
Error
- Location
- scripts/authorize.py:34
- Finding
- Over-Privileged Shared Bearer Credential and Unrestricted Tool Dispatch<![CDATA[ ## Vulnerability Details **File Location**: `scripts/authorize.py:34-36`; `scripts/mcp_client.py:1513-1517` **Vulnerability Type**: Excessive OAuth scopes and unrestricted authenticated MCP tool selection **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 command-line dispatcher accepts an arbitrary MCP tool name: ```python call = subparsers.add_parser("call", help="Call one tool with a JSON object on stdin") call.add_argument("tool_name") ``` That tool name is sent directly in an authenticated request: ```python return session.request( 2, "tools/call", {"name": tool_name, "arguments": arguments}, ) ``` ### Technical Analysis The declared purpose of this Skill is to animate a kitchen photograph into a video. Its legitimate requirements include uploading an artifact, discovering compatible video models, generating a video, reading relevant task results, and performing necessary billing operations. The requested credential additionally grants unrelated capabilities, including: - Image generation - Music generation - Speech generation - Voice reading and writing - Broad artifact and task access - Task cancellation The credential is shared across Beatra Skills rather than being isolated to this package. In addition, `mcp_client.py call` performs no local allowlist validation before loading the shared bearer token and submitting a requested tool name. This violates least privilege. Any local process or Agent instruction capable of invoking the bundled client can attempt an unrelated MCP tool call under the broader account authorization. Whether a particular call ultimately succeeds also depends on server-side tool availability and authorization enforcement, but the local client does not constrain calls to the Skill's declared function. ...[truncated 1230 chars]
- Remediation
- <![CDATA[ ## Remediation Suggestions 1. Replace the shared full-scope token with a package-specific, least-privilege credential. 2. Remove scopes unrelated to this Skill, particularly: - `images:generate` - `music:generate` - `speech:generate` - `voices:read` - `voices:write` 3. Narrow artifact and task permissions to resources created by this package or installation where the service supports resource-scoped authorization. 4. Add a local allowlist of permitted MCP tools, such as the exact model, upload, video, task, wallet, and registration operations required by the documented workflow. 5. Reject unknown tool names before reading the credential or creating an MCP session. 6. Separate read-only wallet and task operations from billable or destructive permissions where supported. 7. Require explicit user confirmation immediately before any billable or destructive operation. 8. Add server-side enforcement binding the credential to the package slug and approved tool set; local validation alone should not be the security boundary. 9. Rotate existing shared credentials after deploying reduced scopes. ]]>
