T05 · Unauthorized Access and Privilege Escalation
Error
- Location
- scripts/authorize.py:34
- Finding
- Overprivileged OAuth Scope Combined with an Unrestricted Remote Tool Dispatcher<![CDATA[ ## Vulnerability Details **File Location**: `scripts/authorize.py:34-38`; `scripts/mcp_client.py:1463-1481` **Vulnerability Type**: Excessive authorization and unrestricted access to remote tools **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 then permits the caller to supply an arbitrary remote 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 purpose of the Skill is to create store PA speech recordings, optionally including a consented voice clone and media upload. The requested authorization scope is substantially broader than that purpose. It includes image, video, and music generation, wallet spending, artifact access, and task cancellation. This violates least-privilege principles. The risk is amplified because `_run_command` does not enforce a package-specific allowlist. Any `tool_name` supplied on the command line is forwarded to Beatra using the shared bearer credential. Restrictions in `SKILL.md` are behavioral instructions rather than an executable authorization boundary and therefore ...[truncated 1328 chars]
- Remediation
- <![CDATA[ ## Remediation Suggestions 1. Replace the full shared scope with a package-specific least-privilege grant limited to: - Text-to-speech generation. - Voice listing and explicitly approved voice cloning. - Required artifact upload operations. - Model and task-status reads. - Read-only wallet access only when requested. 2. Do not grant image, video, or music generation to this package. 3. Separate wallet spending and task cancellation into explicit, narrowly scoped grants requiring user confirmation. 4. Add a strict local allowlist in `_run_command`, such as the exact `beatra.*` tools documented by this Skill. 5. Reject unknown tool names before loading the credential or creating a network session. 6. Apply server-side package/tool authorization so client-side restrictions are not the only control. 7. Consider using short-lived, package-bound access tokens rather than one full-scope token shared by all Beatra Skills. ]]>
