T05 · Unauthorized Access and Privilege Escalation
- Location
scripts/authorize.py:34- Finding
Overprivileged Device Token Grants Unrelated Media and Account Capabilities
- Content
View full analysis
Vulnerability Details
File Location:
scripts/authorize.py, lines 34–37
Vulnerability Type: Excessive OAuth scope and violation of least privilege
Risk Level: HighVulnerable 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" )The declared Skill functionality requires text-to-speech generation, voice selection, optional voice cloning and sample upload, and access to the resulting tasks. The requested token additionally authorizes image, video, and music generation, unrestricted MCP tool access, wallet spending, broad artifact access, and task cancellation.
Technical Analysis
The authorization scope is a shared, full-account capability rather than a package-specific credential. This violates least privilege because compromise or misuse of this Skill grants access to operations unrelated to producing homeroom voice clips.
The broad
mcp:toolspermission is especially sensitive when combined with the unrestricted tool dispatcher inscripts/mcp_client.py. The client can attach the bearer credential to arbitrary MCP tool calls instead of limiting execution to the small set required by the Skill.Although the token is stored with restrictive POSIX permissions, secure storage does not compensate for excessive server-side privileges. Any code or instruction capable of invoking the bundled client inherits the complete authorization scope.
Attack Path
- The user runs
scripts/authorize.py. - The authorization flow requests the complete scope shown above.
- The returned bearer token is stored in
~/.beatra/credentials.json. - An attacker-controlled instruction, compromised package update, or unauthorized local caller invokes
scripts/mcp_client.py. - The client attaches the shared bearer token to the request.
- The caller uses ...[truncated 655 chars]
- The user runs
- Remediation
View remediation
Remediation Suggestions
- Replace the shared full-scope token with a package-specific, least-privilege credential.
- Restrict the default scope to text-to-speech, required model and voice reads, package-owned task reads, and narrowly scoped artifact creation.
- Request voice-cloning and upload privileges only when the user explicitly selects cloning.
- Remove image, video, music, broad artifact-read, wallet-spend, and task-cancellation scopes unless separately required and approved.
- Separate read-only wallet access from credit-spending authority.
- Restrict task reads and cancellation to tasks created by this package or installation.
- Display the exact requested permissions to the user before authorization.
