T05 · Unauthorized Access and Privilege Escalation
Error
- Location
- scripts/authorize.py:31
- Finding
- Authorization Requests Permissions Beyond the IVR Workflow's Requirements<![CDATA[ ## Vulnerability Details **File Location**: `scripts/authorize.py:31-34` **Vulnerability Type**: Excessive OAuth scope and violation of least privilege **Risk Level**: High ### Evidence ```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 Device Authorization flow requests a single bearer credential with permissions for image generation, video generation, music generation, wallet spending, artifact access, task cancellation, speech generation, and voice management. The declared IVR voice-pack workflow legitimately requires speech generation, voice discovery or cloning, task-result access, and—in the cloning workflow—artifact upload. Image, video, and music generation are unrelated to IVR prompt production. General wallet-spending authority and unrestricted task cancellation also exceed the narrowest privileges needed for the normal workflow. Because the bearer token is shared by the bundled MCP client, any code capable of reading the credential or issuing an authenticated MCP request inherits all granted scopes. The credential is therefore more valuable and damaging if compromised than a task-specific token would be. ### Attack Path 1. The user runs `scripts/authorize.py`. 2. The authorization page requests the complete scope set defined in `SCOPE`. 3. After approval, the broad bearer token is stored in `~/.beatra/credentials.json`. 4. An attacker compromises the package, a future package update, or another process running as the same user. 5. The attacker reads or uses the bearer credential through the client. 6. The attacker invokes unrelated image, video, or music generation operations, spends wallet credits, reads accessible artifacts or tasks, or cancels tasks. No direct token theft mechanism was found in the audited code; exploitation depends on compromise of a ...[truncated 503 chars]
- Remediation
- <![CDATA[ ## Remediation Suggestions 1. Replace the broad scope set with a least-privilege set limited to the operations required by this Skill. 2. Remove `images:generate`, `videos:generate`, and `music:generate`. 3. Avoid a general `wallet:spend` permission where the service can authorize only speech or voice-cloning purchases. 4. Request `tasks:cancel` only when the user explicitly initiates a cancellation workflow, preferably through incremental authorization. 5. Restrict artifact permissions to upload and read operations associated with this package's own voice samples and outputs. 6. Use package-scoped or operation-scoped tokens where supported. 7. Display the requested permissions and their purposes before opening the authorization page. 8. Add automated tests that fail if unrelated scopes are added to the IVR package. ]]>
