T05 · Unauthorized Access and Privilege Escalation
- Location
- scripts/authorize.py:34
- Finding
- Authorization Token Requests Capabilities Beyond the Hiring-Video Workflow<![CDATA[ ## Vulnerability Details **File Location**: `scripts/authorize.py:34-38` **Vulnerability Type**: Excessive OAuth/device-token authorization scope **Risk Level**: Medium ### Complete Code Snippet ```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 declared workflow requires artifact upload/read access, voice selection or cloning, speech synthesis, video generation, task management, and limited wallet visibility or payment authorization. The requested token additionally receives capabilities such as: - `images:generate` - `music:generate` - Generic `mcp:tools` - Broad `wallet:spend` Image and music generation are not part of the declared hiring-avatar workflow. A broadly scoped spending capability also provides more authority than a package-specific or operation-specific payment grant would provide. Because the token is shared between Beatra Skills and stored as a reusable bearer credential, unnecessary scopes increase the consequences of local credential disclosure, client compromise, or unintended tool invocation. This violates the principle of least privilege even though the authorization is shown to the user through a device-authorization flow. ### Attack Path 1. The user authorizes the Skill through `scripts/authorize.py`. 2. Beatra issues a bearer token containing all scopes listed in `SCOPE`. 3. An attacker obtains the token through a local compromise, weak Windows ACL, malicious future update, or another process running as the user. 4. The attacker submits authenticated MCP requests using the stolen token. 5. Subject to server-side tool availability, the attacker invokes unrelated image or music generation operations or other paid operations covered by the broad token. 6. Charges and generated content can extend beyond the hiring-video functionality the user in ...[truncated 373 chars]
- Remediation
- <![CDATA[ ## Remediation Suggestions 1. Remove `music:generate` and `images:generate` unless a documented workflow actually requires them. 2. Replace generic `mcp:tools` access with an allowlist of the exact tools needed by this package. 3. Replace broad `wallet:spend` authority with operation-specific payment authorization or narrowly scoped spending grants. 4. Separate read-only wallet access from paid-operation authorization. 5. Issue package-specific credentials rather than sharing one full-scope credential across unrelated Skills. 6. Validate returned scopes as a subset of the minimum required scopes rather than requiring the current broad set. 7. Display the exact requested capabilities and their financial implications before device authorization. 8. Add automated tests that fail when newly requested scopes are not mapped to a documented workflow operation. ]]>
