T05 · Unauthorized Access and Privilege Escalation
Error
- Location
- scripts/authorize.py:34
- Finding
- Overprivileged Shared Device Token and Unrestricted MCP Tool Invocation<![CDATA[ ## Vulnerability Details **File Location**: `scripts/authorize.py:34-38`; `scripts/mcp_client.py:1455-1469` **Vulnerability Type**: Excessive authorization scope and missing tool allowlist **Risk Level**: High ### Complete Code Snippet ```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 interface also 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") ``` ```python assert tool_name is not None return session.request( 2, "tools/call", {"name": tool_name, "arguments": arguments}, ) ``` ### Technical Analysis The declared purpose of this Skill is to generate and edit classroom art-demo images. That workflow legitimately requires image generation, relevant artifact operations, model discovery, and task monitoring. However, the authorization request also grants: - Video generation - Music generation - Speech generation - Voice read and write operations - General wallet spending - Task cancellation across the shared connection These permissions exceed the minimum privileges necessary for the Skill’s image-generation function. The resulting token is shared through `~/.beatra/credentials.json`, and the client does not constrain `call` to a package-specific allowlist. Any tool name supplied by the caller is forwarded to the remote MCP service. This violates least-privilege principles. Although the reviewed Skill instructions constrain intended use, those instructions are not an access-control boundary. ### Attack Path 1. The user authorizes the Skill. 2. `scripts/authorize.py` requests the full scope shown above. 3. Beatra returns a bearer token containing permissions unrelated to art-demo image generation. 4. The token is stored in `~/.beatra/credentials.json`. ...[truncated 869 chars]
- Remediation
- <![CDATA[ ## Remediation Suggestions 1. Replace the shared full-scope token with a package-specific, least-privilege credential. 2. Restrict authorization to the capabilities needed by this Skill, such as: - Image generation and editing - Model-card discovery - User-selected artifact upload and required artifact reads - Reading this Skill’s tasks - Cancellation only if cancellation is an intended feature - Narrowly scoped spending limited to approved image operations 3. Remove video, music, speech, and voice permissions. 4. Add a local allowlist before forwarding `tools/call`. Reject all tools except the explicitly supported set, for example: - `beatra.models.list` - `beatra.images.generate` - `beatra.images.edit` - `beatra.assets.upload` - `beatra.tasks.get` - `beatra.tasks.list` - `beatra.tasks.cancel` - Required read-only wallet operations 5. Enforce equivalent package and operation restrictions on the server, because a local allowlist alone can be bypassed by other clients holding the token. 6. Separate read-only account operations from billable operations and require fresh user approval or a constrained capability token for spending. ]]>
