T05 · Unauthorized Access and Privilege Escalation
Error
- Location
- scripts/authorize.py:32
- Finding
- Overprivileged Shared Device Token and Unrestricted MCP Tool Invocation## Vulnerability Details **File Location**: `scripts/authorize.py:32-35`; `scripts/mcp_client.py:1463-1481` **Vulnerability Type**: Excessive authorization scope and insufficient local authorization enforcement **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 handler 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 Skill functionality is limited to generating and editing still-image cover sets. Nevertheless, the authorization request includes unrelated privileges for video generation, music generation, speech generation, voice creation, and generic MCP tool access. The credential is also shared between Beatra Skill packages. Consequently, compromise of this package, its updater, or another component able to read the token could expose all granted capabilities rather than only those needed for still-image production. The bundled client does not maintain a local allowlist of permitted MCP tool names. Its `call` command forwards an arbitrary tool name supplied on the command l ...[truncated 1459 chars]
- Remediation
- ## Remediation Suggestions 1. Replace the full shared scope with a least-privilege scope limited to: - Image generation and image editing. - Model-card reads. - Required artifact upload and read operations. - Task reads and user-requested cancellation. - Narrow billing reads or spending authority strictly required by approved generation. 2. Remove video, music, speech, and voice-write scopes from this Skill's authorization request. 3. Avoid using one full-scope token across unrelated Skill packages. Issue package-specific or capability-specific credentials. 4. Add a local allowlist in `_run_command`, permitting only the exact tools documented by this Skill, such as: - `beatra.models.list` - `beatra.images.generate` - `beatra.images.edit` - `beatra.assets.upload` - `beatra.tasks.get` - `beatra.tasks.list` - `beatra.tasks.cancel` - The documented wallet read operations 5. Reject all other tool names before sending a network request. 6. Require explicit user reauthorization when a future package version genuinely needs an additional capability. 7. Provide users with a clear authorization summary showing each requested capability and why it is required.
