Summary
Capgo before 12.128.2 exposes unauthenticated security definer RPC functions that act as API key validity oracles and leak user UUIDs and permission information.
An attacker using only the public API key can validate compromised keys, enumerate users and apps, and infer permission levels, amplifying the impact of any leaked credentials.
Affected context
This vulnerability arises in Capgo deployments where unauthenticated clients can invoke security definer RPC functions over the public API.
Specifically affected are the get_user_id and get_org_perm_for_apikey functions, which reveal whether an API key is valid and disclose user UUIDs and organizational permissions.
The issue is most relevant in environments that rely on API keys for access control, and where keys may be shared, logged, or otherwise exposed outside strict secrecy channels.
Exploit preconditions
- Attack surface: Public-facing Capgo RPC API endpoints callable with a public API key
- Required access: Ability to send unauthenticated requests using the public API key
- Trigger point: Invocation of
get_user_idorget_org_perm_for_apikeywith candidate API keys or identifiers - Why exploitation is possible: The security definer functions run with elevated privileges and return detailed validity and identity information without enforcing an authentication boundary
Why this happens
The root cause maps to CWE-200: Information Exposure, where sensitive operational data is returned to untrusted callers.
In this case, security definer RPC functions are designed to introspect API keys and permissions but fail to restrict who can call them or what information is disclosed.
As a result, they inadvertently expose key validity oracles, user UUIDs, and permission metadata, turning internal access-control logic into an externally consumable information channel.
Potential impact
- Attackers can validate whether leaked or guessed API keys are still active or correctly scoped
- Adversaries may enumerate users and associated apps by correlating user UUID disclosures
- Threat actors can map organizational permission levels, improving targeted attack planning
- Increased actionability of previously low-value credential leaks, enabling more efficient account takeover attempts
General mitigation guidance
Effective mitigation focuses on tightening information boundaries around authentication and authorization logic.
Common patterns include:
- Restricting sensitive RPC functions to authenticated and authorized callers, or removing public exposure entirely
- Minimizing data returned from introspection endpoints, avoiding direct disclosure of UUIDs or detailed permission structures
- Designing API key validation mechanisms that do not provide binary oracles to unauthenticated users, and that respond with generic, non-informative messages
- Applying least-privilege to security definer functions so they operate within narrowly scoped roles aligned with their intended use
- Establishing clear policies for what identity and permission data may be exposed via public APIs, and codifying these rules in design reviews
How teams detect issues like this
Organizations can detect similar information exposure issues by:
- Reviewing RPC and API endpoint definitions for security definer or elevated-privilege functions callable without authentication
- Using static analysis or schema inspection to flag endpoints that return identity, key validity, or permission metadata to unauthenticated clients
- Conducting focused code reviews around authentication and key management logic, checking for oracular responses and excessive detail in error messages
- Applying API governance policies that require classification of returned data and explicit approval for exposing identifiers and permissions externally
- Leveraging automated API security testing tools to probe endpoints for enumeration and oracle behaviors under unauthenticated conditions

