T05 · Unauthorized Access and Privilege Escalation
- Location
- scripts/authorize.py:34
- Finding
- Overprivileged Shared Device Token and Unrestricted MCP Tool Dispatch<![CDATA[ ## Vulnerability Details **File Location**: `scripts/authorize.py:34-38`; unrestricted tool dispatch at `scripts/mcp_client.py:1463-1481` **Vulnerability Type**: Excessive authorization scope and missing client-side tool allowlist **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 bundled client subsequently accepts any MCP tool name supplied through its command-line interface: ```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 workflow requires uploading user-selected assets, optionally cloning a voice, synthesizing speech, generating talking videos, inspecting models, and reading task results. The requested authorization additionally grants unrelated capabilities such as `images:generate` and `music:generate`. The credential is shared among Beatra Skills and includes permission to spend wallet credits, read artifacts, generate media, and cancel tasks. The client does not restrict `tool_name` to the small set required by this Skill. Consequently, compromise of the package or its update channel would expose all server-si ...[truncated 1488 chars]
- Remediation
- <![CDATA[ ## Remediation Suggestions 1. Replace the shared full-scope credential with a package-specific, least-privilege token. 2. Remove permissions that are not required by this Skill, particularly `images:generate` and `music:generate`. 3. Review whether broad artifact reads and task cancellation are required; grant them only if the corresponding workflow is used. 4. Add a hardcoded client-side allowlist for this package, such as: - `beatra.assets.upload` - `beatra.models.list` - `beatra.voices.list` - `beatra.voices.clone` - `beatra.speech.synthesize` - `beatra.videos.animate` - Required task and wallet read operations 5. Reject all other tool names before reading or using the credential. 6. Enforce the same package-specific restrictions server-side so bypassing the local client does not restore excessive access. 7. Use separate authorization grants for materially different capabilities, especially wallet spending and voice cloning. ]]>
