T05 · Unauthorized Access and Privilege Escalation
- Location
- scripts/authorize.py:34
- Finding
- Authorization Requests Privileges Beyond the Skill's Declared Functionality<![CDATA[ ## Vulnerability Details **File Location**: `scripts/authorize.py:34-37` **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 is declared as a classroom duty-board image generator. Its legitimate functionality requires image generation and editing, optional reference-image upload, model lookup, billing access, and limited task management. The requested authorization scope additionally includes: - `videos:generate` - `music:generate` - `speech:generate` - `voices:read` - `voices:write` These privileges are unrelated to generating duty-board images. The package documentation explicitly confirms that a single approval covers image, video, music, speech, upload, model, and task tools in `references/installation-and-auth.md:73-74`. This violates the principle of least privilege. The credential is also shared across Beatra Skills, which increases the consequences if the token or bundled client is misused. ### Attack Path 1. The user runs `scripts/authorize.py`. 2. The script requests the complete scope defined by `SCOPE`. 3. The user approves the device authorization. 4. Beatra returns a bearer token containing permissions for unrelated media and voice operations. 5. The token is stored in `~/.beatra/credentials.json`. 6. A malicious instruction, compromised future update, or local process with access to the token invokes unrelated paid media or voice tools. 7. The request executes with privileges that were unnecessary for the duty-board task. ### Impact Assessment An attacker able to misuse the credential could potentially: - Generate images, videos, music, and speech. - Read or modify voice-related resources. - Upload artifacts. - Spend wallet credits. - Read a ...[truncated 225 chars]
- Remediation
- <![CDATA[ ## Remediation Suggestions 1. Replace the full shared scope with a package-specific least-privilege scope. 2. Request only the capabilities necessary for this Skill, such as: - Image model listing. - Image generation and editing. - Artifact upload and retrieval. - Read-only wallet pricing or balance access where required. - Task read access and user-authorized cancellation. 3. Remove video, music, speech, and voice-write permissions. 4. Separate read-only permissions from paid or state-changing permissions. 5. Use a package-specific credential rather than a shared full-scope device token. 6. Display the exact requested permissions to the user before opening the authorization page. 7. Add automated tests that fail if unrelated scopes are added to this image-only package. ]]>
