T05 · Unauthorized Access and Privilege Escalation
Error
- Location
- scripts/authorize.py:30
- Finding
- Device authorization requests permissions beyond the Skill's declared image-card functionality<![CDATA[ ## Vulnerability Details **File Location**: `scripts/authorize.py:30-33` **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" ) ``` ### Technical Analysis The Skill's declared purpose is to create still image cards from user-provided customer-service scripts. Its legitimate operations include image generation and editing, model and task queries, optional reference-image upload, and limited billing queries. The requested device-token scope additionally permits video, music, speech, and voice operations, general artifact access, task cancellation, and wallet spending. These unrelated permissions violate the principle of least privilege. Although the broad authorization is mentioned in `references/installation-and-auth.md`, disclosure alone does not make the additional privileges necessary. The bearer token is shared through `~/.beatra/credentials.json`. Any package component or same-user process that obtains this token consequently receives all authorized capabilities rather than only those required by this Skill. ### Attack Path 1. The user runs `scripts/authorize.py` to activate the image-card Skill. 2. The helper requests the complete scope defined in `SCOPE`. 3. After approval, Beatra returns a bearer token containing the broad authorization. 4. The token is saved in `~/.beatra/credentials.json`. 5. Compromised package code, a malicious future update, or another same-user process reads the token. 6. The token is used to invoke unrelated paid media operations, access artifacts or tasks, spend credits, or cancel tasks. ### Impact Assessment Successful abuse may permit: - generation of unrelated video, music, speech, and voice content; - wallet-credit spending outside the image-card workflow; - read ...[truncated 388 chars]
- Remediation
- <![CDATA[ ## Remediation Suggestions 1. Replace the shared full-scope token with a package-specific token restricted to: - required image generation and editing operations; - narrowly scoped model and task reads; - explicit reference-asset upload; - only the billing reads needed by the documented workflow. 2. Remove video, music, speech, voice-write, broad artifact access, task cancellation, and wallet-spend scopes unless a concrete Skill feature requires each permission. 3. Separate read-only and billable permissions where the service supports capability-specific authorization. 4. Present the exact requested permissions before approval and require fresh consent when a new capability is added. 5. Add server-side enforcement binding the credential to the package identity and approved tool allowlist. 6. Rotate existing broad credentials after introducing reduced-scope authorization. ]]>
