T05 · Unauthorized Access and Privilege Escalation
- Location
scripts/authorize.py:33- Finding
Overly Broad Authorization Scope and Unrestricted MCP Tool Dispatch
- Content
View full analysis
Vulnerability Details
File Location:
scripts/authorize.py:33-36;scripts/mcp_client.py:1463-1482
Vulnerability Type: Excessive privileges and unrestricted remote tool selection
Risk Level: HighVulnerable Code
scripts/authorize.py:33-36: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:1463-1482: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 functionality is professional headshot generation and editing. It legitimately requires image generation, artifact upload, task tracking, and potentially spending authorization. However, the requested bearer-token scope also grants video generation, music generation, speech generation, voice creation and modification, and general wallet spending.
The bundled client compounds this excessive scope by accepting an arbitrary MCP tool name from the command line. It does not enforce an allowlist limited to the image and task operations documented by the Skill. Consequently, possession of or access to the client and shared ...[truncated 2037 chars]
- Remediation
View remediation
Remediation Suggestions
- Replace the shared full-scope token with a package-specific, least-privilege credential.
- Remove unrelated permissions, including:
videos:generatemusic:generatespeech:generatevoices:readvoices:write
- Narrow wallet authorization to package-specific image operations where supported, rather than granting general spending capability.
- Add a local allowlist in
_run_command, permitting only the tools required by this Skill, such as the documented image transform/edit, asset upload, model query, billing, and task-management operations. - Reject unknown tool names before creating a remote session or attaching the bearer token.
- Separate administrative operations such as installation registration from paid creative-operation credentials.
- Add automated tests verifying that unrelated video, music, speech, and voice tools are denied locally and remotely.
- Display the exact requested capabilities during authorization so users can make an informed approval decision.
