Summary
Capgo contains an authorization bypass in its public API key management handlers, allowing app-scoped keys to act outside their declared application scope.
When keys created with mode=all and limited_to_apps are not correctly enforced, a scoped key can enumerate, update, or delete sibling API keys for the same account, exposing account-level credential tampering risks.
Affected context
The vulnerability appears in Capgo deployments that rely on scoped public API keys for access control to key management endpoints (get/put/delete/post).
It is relevant when keys are created with mode=all and constrained via limited_to_apps, but authorization checks only evaluate limited_to_orgs and ignore the app-specific scope.
In such configurations, app-scoped keys may inadvertently gain broader control over API keys under the same account.
Exploit preconditions
- Attack surface: Public API key management endpoints (get, put, delete, post).
- Required access: Possession of an API key created with
mode=alland restricted usinglimited_to_apps. - Trigger point: Invoking key management handlers where authorization checks validate
limited_to_orgsbut omitlimited_to_apps. - Why exploitation is possible: The authorization model fails to enforce application-level scoping, so app-scoped keys are treated as if they have account-level privileges over sibling keys.
Why this happens
The underlying issue is an incomplete authorization check, mapped to CWE-269: Improper Privilege Management.
The system models fine-grained scopes using attributes such as limited_to_apps and limited_to_orgs, but the enforcement logic in key management handlers only evaluates organization-level constraints.
Because application-level restrictions are not consulted, app-scoped credentials effectively inherit broader capabilities than intended, breaking the principle of least privilege and allowing horizontal privilege escalation within the same account.
Potential impact
- An app-scoped API key may enumerate sibling API keys under the same account.
- Attackers could update or rotate other API keys, potentially disrupting legitimate integrations.
- Malicious deletion of keys can cause service outages or denial of access for other applications.
- Unauthorized creation of broadly scoped keys could escalate privileges to effective account-level control.
General mitigation guidance
Mitigation typically focuses on tightening privilege management and ensuring scope-aware authorization for all credential operations.
Useful defensive patterns include:
- Enforcing both organization-level and application-level constraints in all key management paths, with explicit checks for
limited_to_appswhen keys claim app-specific scope. - Modeling permissions in a central authorization layer so that business rules for scope evaluation are not duplicated or inconsistently applied across handlers.
- Designing API keys with least-privilege defaults, avoiding broad
mode=allcapabilities unless strictly necessary. - Applying defense-in-depth controls by logging and monitoring key-management actions, and limiting who or what can call administrative endpoints.
How teams detect issues like this
Detection strategies often rely on reviewing authorization logic and monitoring key management behavior:
- Static analysis or manual code review to confirm that all scope attributes (e.g., app-level, org-level, role-level) are consistently enforced across create, read, update, and delete operations.
- Policy-based checks in CI to flag handlers that bypass central authorization routines or perform ad hoc privilege checks.
- Runtime monitoring of API key management endpoints for anomalies, such as app-scoped keys performing account-level operations.
- Automated security testing or fuzzing focused on role and scope combinations to identify cases where constraints are not applied.

