T05 · Unauthorized Access and Privilege Escalation
Error
- Location
- scripts/authorize.py:34
- Finding
- Overprivileged Device Authorization Combined with an Unrestricted Remote Tool Dispatcher## Vulnerability Details **File Location**: `scripts/authorize.py:34-37`; `scripts/mcp_client.py:1460-1476` **Vulnerability Type**: Excessive authorization scope and missing tool allowlist **Risk Level**: High ### Vulnerable Code `scripts/authorize.py:34-37`: ```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" ) ``` `scripts/mcp_client.py:1460-1476`: ```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’s declared purpose is to generate a retail playlist of instrumental music. Its legitimate operations require music generation, model lookup, task status retrieval, and limited billing inspection. Nevertheless, the authorization helper requests permissions for unrelated capabilities, including image generation, video generation, speech generation, voice management, artifact writing and reading, wallet spending, and task cancellation. This violates the principle of least privilege. The exposure is amplified by the generic `call` interface, which accepts an arbitrary MCP tool name and forwards it without a package-level allow ...[truncated 2045 chars]
- Remediation
- ## Remediation Suggestions 1. Replace the broad authorization scope with the minimum permissions required for this Skill: - Music generation. - Model-card lookup. - Task creation/status retrieval required for generated music. - Read-only wallet access only when the user requests balance or ledger information. - Task cancellation only if cancellation is an intentional, user-confirmed feature. 2. Remove image, video, speech, voice-management, general artifact, upload, and unrelated write permissions from this package’s default authorization profile. 3. Add a strict local allowlist before dispatching `tools/call`. The allowlist should contain only documented tools, such as: - `beatra.models.list` - `beatra.music.generate` - `beatra.tasks.get` - `beatra.tasks.list` - `beatra.wallet.get` - `beatra.wallet.ledger` - Any explicitly required cancellation tool, guarded by direct user confirmation 4. Reject all unrecognized tool names before establishing or using an authenticated session. Do not rely exclusively on server-side authorization. 5. If upload or other media capabilities are needed by future workflows, place them in separate packages or authorization profiles and request those scopes only after explicit, contextual user consent. 6. Add automated tests verifying that: - Every allowed tool is necessary for the declared workflow. - Unrelated tool names are rejected locally. - Read-only actions cannot invoke spending or write capabilities. - Scope changes fail review when they introduce capabilities not represented in the Skill documentation.
