T05 · Unauthorized Access and Privilege Escalation
Error
- Location
- scripts/authorize.py:28
- Finding
- OAuth Device Token Requests Permissions Beyond the Skill's Functional Requirements<![CDATA[ ## Vulnerability Details **File Location**: `scripts/authorize.py:28-31` **Vulnerability Type**: Excessive OAuth authorization 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 workflow requires image generation, video generation, artifact handling, model and task inspection, and billing-related operations. The authorization scope also grants unrelated capabilities, including: - Music generation - Speech generation - Voice reading and writing - Broad wallet spending - Task cancellation These permissions are not necessary to create three wedding storyboard keyframes and one opening video. The documentation also identifies the resulting credential as a shared, full-scope Device Token in `references/mcp-connection.md:8-10`: ```text They share the one full-scope Device Token stored in `~/.beatra/credentials.json`. ``` This violates least-privilege principles. Because the credential is shared by multiple Beatra Skills, compromise of this Skill or its update channel could expose capabilities and tasks outside this package's intended workflow. ### Attack Path 1. The user runs `scripts/authorize.py`. 2. The authorization request asks the user to approve the complete scope defined in `SCOPE`. 3. Beatra returns a bearer token containing unrelated generation, wallet, voice-management, and task-cancellation permissions. 4. The token is stored in `~/.beatra/credentials.json`. 5. Any malicious replacement client, compromised local process, or attacker who obtains the token can invoke unrelated Beatra operations. 6. The attacker can spend credits on music or speech generation, modify voice resources, or cancel tasks belonging to other workflows that share the credential. ### Impact Assessment Successful abuse cou ...[truncated 460 chars]
- Remediation
- <![CDATA[ ## Remediation Suggestions 1. Replace the full shared scope with a package-specific least-privilege scope. 2. Retain only permissions demonstrably required by this workflow, such as: - Image generation - Video generation - Required artifact upload/read operations - Model and task reads - Narrow billing or wallet-read access when requested 3. Remove music, speech, voice-write, unrelated voice-read, broad wallet-spend, and task-cancellation permissions unless a documented workflow explicitly requires them. 4. Separate read-only wallet access from billable-generation authorization where the API permits it. 5. Avoid sharing one full-account bearer token across unrelated Skills. Use package-scoped credentials or server-enforced package authorization boundaries. 6. Display the requested capabilities to the user before authorization and explain why each permission is required. 7. Add automated tests that reject authorization scope additions not mapped to declared Skill functionality. ]]>
