T05 · Unauthorized Access and Privilege Escalation
Error
- Location
- scripts/authorize.py:32
- Finding
- Overprivileged Shared Device Token and Unrestricted Tool Dispatch<![CDATA[ ## Vulnerability Details **File Location**: `scripts/authorize.py:32-35`; `scripts/mcp_client.py:1450-1467` **Vulnerability Type**: Excessive authorization scope and missing client-side tool allowlist **Risk Level**: High ### Complete Code Snippet ```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" ) ``` ```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 nutrition-panel still images from seller-provided facts. Its legitimate operations include image generation and editing, optional artifact upload, model discovery, task inspection, limited task cancellation, and billing or wallet reads. The requested Device Token is substantially broader. It grants video generation, music generation, speech generation, voice read/write access, general wallet spending, and artifact/task capabilities shared across Beatra packages. The bundled client also accepts an arbitrary tool name and forwards it through `tools/call` without enforcing a package-specific allowlist. The combination violates least privilege: a component intended for nutrition-panel images receives ...[truncated 1714 chars]
- Remediation
- <![CDATA[ ## Remediation Suggestions 1. Replace the full-scope shared token with a package-specific, least-privilege token. 2. Restrict authorization to the capabilities required by this Skill, such as: - Image generation and editing. - Artifact upload/read for explicit user-selected references and outputs. - Model listing. - Task reads and narrowly controlled cancellation. - Read-only wallet and billing access. 3. Remove video, music, speech, and voice scopes. 4. Separate read-only wallet access from wallet-spending authorization. 5. Add an explicit client-side allowlist for accepted tool names, for example: - `beatra.models.list` - `beatra.images.generate` - `beatra.images.edit` - `beatra.assets.upload` - `beatra.tasks.get` - `beatra.tasks.list` - `beatra.tasks.cancel` - Required read-only wallet tools 6. Reject every tool not present in the package allowlist before opening a network connection. 7. Require explicit user confirmation immediately before every billable operation and task cancellation. 8. Avoid sharing one bearer token across packages with different privilege requirements. ]]>
