T05 · Unauthorized Access and Privilege Escalation
Error
- Location
- scripts/authorize.py:31
- Finding
- Authorization Requests Permissions Beyond the Skill's Functional Requirements<![CDATA[ ## Vulnerability Details **File Location**: `scripts/authorize.py:31-34` **Vulnerability Type**: Excessive OAuth device-token scope **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 broad authorization model is also explicitly documented in `references/installation-and-auth.md:72-74`: ```text One approval covers image, video, music, speech, upload, model, and task tools. ``` ### Technical Analysis The declared function of this Skill is to upload authorized blackboard photographs and generate one image-to-video clip for each photograph. However, the authorization request includes permissions for unrelated capabilities, including: - Music generation - Speech generation - Voice generation - Voice data read and write access - General image generation - Broad MCP tool access - Wallet spending - Artifact reading - Task cancellation Some permissions, such as video generation, artifact upload, task reads, and potentially wallet reads, are reasonably connected to the declared workflow. Music, speech, and voice permissions are not required for silent blackboard animation. The resulting bearer credential is also shared among Beatra Skill packages through `~/.beatra/credentials.json`. This increases the consequence of credential compromise because a single token grants access to substantially more functionality than this Skill needs. This violates the principle of least privilege. Even if the additional permissions are not used by the current code, obtaining them expands the available attack surface and the privileges exposed through token theft, malicious updates, or another process running under the same user. ### Attack Path 1. The user runs `scripts/authorize.py`. 2. The authorization helper requests the entire hardcoded `SCOPE`. 3. The user approves ...[truncated 1148 chars]
- Remediation
- <![CDATA[ ## Remediation Suggestions 1. Replace the hardcoded full scope with the smallest package-specific scope required for: - Uploading the input photograph - Reading compatible model information - Generating an image-to-video result - Reading the resulting task - Cancelling a task only when cancellation is supported by the workflow - Reading wallet information only when explicitly requested 2. Remove music, speech, voice, and unrelated image-generation permissions. 3. Separate wallet-read and wallet-spend permissions if the service supports distinct scopes. 4. Issue a package-specific credential instead of sharing one full-scope token among every installed Beatra Skill. 5. Require explicit reauthorization if the package later introduces a capability requiring a new scope. 6. Present the exact requested scopes and their purposes to the user before authorization. 7. Add automated tests that compare the requested scope against an allowlist derived from the Skill's declared operations. ]]>
