T05 · Unauthorized Access and Privilege Escalation
Error
- Location
- scripts/authorize.py:29
- Finding
- Overprivileged Device Authorization Grants Unrelated Media Capabilities<![CDATA[ ## Vulnerability Details **File Location**: `scripts/authorize.py`, lines 29–34 **Vulnerability Type**: Excessive OAuth/device-token privileges **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" ) ``` ### Technical Analysis The Skill is declared as a TikTok creator lookup and collaboration brief still generator. Its legitimate workflow requires public creator lookup, image operations, approved asset uploads, task access, and billing-related functionality. The requested authorization scope additionally grants: - `videos:generate` - `music:generate` - `speech:generate` - `voices:read` - `voices:write` These capabilities are unrelated to producing collaboration brief stills. The broad `mcp:tools` scope and `wallet:spend` permission further increase the impact because `scripts/mcp_client.py` exposes a generic tool-call interface that can submit arbitrary tool names and JSON arguments to the service. Although the token is stored with restrictive permissions on POSIX systems, secure storage does not correct excessive authorization. Any process or future compromised package code capable of using the credential can exercise all privileges represented by the token. ### Attack Path 1. The user runs `scripts/authorize.py`. 2. The authorization request asks the user to approve the complete `SCOPE` value. 3. Beatra issues a bearer token containing both necessary and unrelated media capabilities. 4. The token is saved in `~/.beatra/credentials.json`. 5. A local process, compromised future update, or other component with access to the credential invokes the bundled generic MCP client. 6. The caller submits unrelated video, music, speech, or voice operations. 7. Those operations can consume account credits or access voice-related resources outside the Skill’s declared pu ...[truncated 566 chars]
- Remediation
- <![CDATA[ ## Remediation Suggestions 1. Define a package-specific, least-privilege authorization scope. 2. Remove unrelated capabilities, including: - `videos:generate` - `music:generate` - `speech:generate` - `voices:read` - `voices:write` 3. Replace broad `mcp:tools` access with a server-enforced allowlist for only the operations used by this Skill. 4. Restrict task, artifact, and wallet permissions to resources created by this package where the service supports resource-scoped authorization. 5. Avoid sharing one full-scope token among unrelated Skills. Issue separate package-scoped credentials. 6. Display the exact requested capabilities on the approval page so users can make an informed authorization decision. 7. Add automated tests that fail when the requested scope includes capabilities not present in the Skill’s documented operation inventory. ]]>
