T05 · Unauthorized Access and Privilege Escalation
- Location
scripts/authorize.py:34- Finding
Full-Scope Shared Device Token Exceeds the Skill's Functional Requirements
- Content
View full analysis
Vulnerability Details
File Location:
scripts/authorize.py:34-37
Vulnerability Type: Excessive authorization 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 resulting credential is deliberately shared between Beatra Skills, as documented in
references/mcp-connection.md:8-10:text They share the one full-scope Device Token stored in `~/.beatra/credentials.json`.Technical Analysis
The Skill's declared paid capability is limited to six public Xiaohongshu lookup operations and related task polling. It does not need permission to generate images, videos, music, or speech; write voices; write arbitrary artifacts; spend wallet funds generally; inspect unrelated tasks or artifacts; or cancel tasks.
Nevertheless, authorization requests all of these capabilities in one shared bearer token. The code also rejects a credential unless it contains the complete broad scope set, preventing operation with a narrower token.
This violates least-privilege principles. Because the credential is shared between packages, compromise of this Skill, a future update, or another component able to execute the bundled client can expose authority extending well beyond Xiaohongshu lookup.
Attack Path
- The user runs
scripts/authorize.py. - The helper requests the complete scope set shown above.
- The user approves a single full-scope Device Token.
- The token is stored in
~/.beatra/credentials.jsonand reused by the bundled client. - Malicious or compromised Skill code invokes unrelated Beatra tools using the bearer token.
- Those calls may spend credits, create media or artifacts, inspect account resources, or cancel unrelated tasks.
Impact Assessment
...[truncated 482 chars]
- The user runs
- Remediation
View remediation
Remediation Suggestions
- Issue a package-specific token instead of a shared full-scope device token.
- Limit authorization to the exact public-social lookup operations and task polling required by this Skill.
- Remove image, video, music, speech, voice-write, generic artifact-write, generic wallet-spend, and task-cancellation scopes.
- Permit the client to accept narrower credentials rather than requiring equality with the complete scope set.
- Apply server-side authorization policies based on the package identity; client-side instructions alone are insufficient.
- Display the exact requested privileges to the user before opening the authorization page.
- Separate paid-operation authority from non-billable lookup-discovery and verification authority.
