Summary
StudioCMS contains an authorization flaw where any authenticated user with at least Editor role can generate API tokens for arbitrary user accounts, including owners and administrators.
By abusing the /studiocms_api/dashboard/api-tokens endpoint, an attacker can escalate privileges and operate with higher-level permissions than intended.
Affected context
This vulnerability occurs in StudioCMS deployments that expose the dashboard API for managing user API tokens.
Specifically, the /studiocms_api/dashboard/api-tokens endpoint accepts a target user identifier from the request and issues a token bound to that user, but does not properly verify that the requesting user is authorized to act on that target account.
Any environment where Editor-level accounts exist and can access this endpoint is potentially affected, even if administrative actions are intended to be restricted.
Exploit preconditions
- Attack surface: Application dashboard API endpoint (
/studiocms_api/dashboard/api-tokens) - Required access: Valid StudioCMS account with at least Editor role and access to the dashboard API
- Trigger point: Submitting a token creation request for another user's ID (e.g., owner/admin) through the API
- Why exploitation is possible: The endpoint relies on user-supplied identifiers without enforcing a proper authorization check that binds the operation to the caller's own account or role, enabling Insecure Direct Object Reference (CWE-639) and Missing Authorization (CWE-863).
Why this happens
The core issue is a missing, or insufficient, authorization check when handling token creation requests.
The API accepts a target user ID from the client and uses it directly to create an API token for that user, without confirming that the caller is permitted to manage tokens for that account.
This pattern maps to CWE-639: Insecure Direct Object Reference, where internal identifiers (user IDs) are exposed and trusted, and CWE-863: Missing Authorization, where the system authenticates the caller but fails to verify that they are authorized for the requested action.
The bug reflects a common design flaw where resource ownership or administrative boundaries are not enforced at the controller or service layer, allowing lower-privileged users to perform actions reserved for higher-privileged accounts.
Potential impact
- An Editor-level user could generate API tokens for owner or admin accounts.
- Attackers may obtain effective admin-level API access without knowing admin credentials.
- Compromise of content management functions, including creation, modification, or deletion of content.
- Potential reconfiguration of site settings, user management, or plugin integration actions exposed via the API.
- Lateral movement within the application by impersonating other privileged accounts.
General mitigation guidance
Effective mitigation focuses on robust, centralized authorization and strict binding between callers and the resources they operate on:
- Enforce ownership checks: limit token creation to the caller's own account unless the caller holds an explicit administrative role with delegated management rights.
- Implement role- and permission-based access control on all token management endpoints, ensuring only designated roles can create or manage tokens for others.
- Avoid trusting client-supplied user identifiers; derive the effective user context from the authenticated session or token wherever feasible.
- Introduce a consistent authorization layer or middleware that validates both who is calling and which resource they are allowed to affect.
- Apply the principle of least privilege to API tokens, constraining scopes and limiting the blast radius of any single token.
- Consider logging and alerting for sensitive actions such as cross-account token creation attempts, even when authorized.
How teams detect issues like this
Detection strategies generally focus on authorization gaps and abnormal token usage patterns:
- Static analysis and code review:
- Flag controller or route handlers where user or resource IDs are taken directly from request parameters and used to perform sensitive actions without explicit authorization checks.
- Look for token-related endpoints that do not verify ownership or role-based permissions before acting on a target user.
- Use a consistent security annotation or middleware pattern and identify endpoints that bypass or omit it.
- Automated security testing:
- Integrate authorization test cases into API test suites, attempting to perform privileged operations (e.g., token creation for other users) from lower-privileged accounts.
- Utilize dynamic application security testing focused on IDOR and authorization flaws around user and token management APIs.
- Logging and monitoring:
- Record all token creation events with caller identity, target user ID, and source IP.
- Establish anomaly detection rules for cross-account token creation, particularly when initiated by non-admin roles.

