T05 · Unauthorized Access and Privilege Escalation
- Location
- scripts/authorize.py:30
- Finding
- Overprivileged Device Token and Unrestricted MCP Tool Invocation<![CDATA[ ## Vulnerability Details **File Location**: `scripts/authorize.py:30-33`; `scripts/mcp_client.py:1463-1482`; `scripts/mcp_client.py:1488-1490` **Vulnerability Type**: Excessive authorization scope and unrestricted privileged tool dispatch **Risk Level**: High ### Evidence `scripts/authorize.py:30-33` requests a broad authorization scope: ```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` accepts an arbitrary tool name and forwards it to the authenticated MCP service: ```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}, ) ``` `scripts/mcp_client.py:1488-1490` exposes the unrestricted tool selector: ```python call = subparsers.add_parser("call", help="Call one tool with a JSON object on stdin") call.add_argument("tool_name") ``` ### Technical Analysis The declared function is serialized webnovel narration. Its minimum legitimate permissions include speech generation, voice selection or cloning, narrowly scoped artifact upload/read access, and task status reads. The authorization request additionally obtains image, video, and music generation, broad wallet spending, artifact access ...[truncated 1885 chars]
- Remediation
- <![CDATA[ ## Remediation Suggestions 1. Replace the shared full-scope authorization with a package-specific least-privilege token. 2. Restrict this Skill to the exact required capabilities, such as: - Speech generation. - Voice listing and, only when requested, voice cloning. - Narrowly scoped artifact upload/read operations. - Task creation/status reads for this Skill's own jobs. 3. Remove image, video, and music generation scopes. 4. Separate wallet reads from spending authorization; require explicit user approval immediately before spending. 5. Do not grant task cancellation by default. Request or enable it only after an explicit cancellation instruction. 6. Add a strict local allowlist in `_run_command`, rejecting every tool not required by this Skill. 7. Prefer server-enforced package/tool restrictions in addition to local checks. 8. Use separate credentials for different packages so compromise of one Skill cannot exercise every capability associated with the shared connection. 9. Add tests that verify unrelated MCP tool names are rejected before any authenticated network request is sent. ]]>
