/

CVE-2026-56232

Severity:

HIGH RISK

(8.8)

Authorization Bypass (CWE-863) in Capgo Subkey Scoping

CVE-2026-56232

Deferred

Vulnerability type

Category:

Authorization Bypass

CWE:

CWE-863

Impact:

Privilege Escalation and Unauthorized Access

Severity:

HIGH RISK

(8.8)

CVSS version:

3.1

Catch this CVE while code is being written

Detect vulnerable code directly in pull requests, so CVEs are fixed before merge.

Summary

Capgo before 12.128.2 contains an authorization bypass in its middleware key handling, where subkey scope constraints are not properly enforced.

By abusing the x-limited-key-id header, attackers can cause downstream routes to run under a less restricted parent key instead of the intended scoped subkey, enabling unauthorized access to organization- or app-limited resources.

Affected context

This vulnerability appears in environments using Capgo middleware key functionality to enforce subkey scoping based on organization or application constraints.

It is relevant where the x-limited-key-id header is trusted to select scoped subkeys, and downstream route handlers rely on these subkeys for enforcing limited_to_orgs and limited_to_apps restrictions.

The risk is higher in APIs or services that expose sensitive operations under parent keys and depend on subkeys for fine-grained authorization.

Exploit preconditions

  • Attack surface: HTTP(S) endpoints protected by Capgo middlewareKey logic.
  • Required access: Ability to send requests with custom headers, particularly x-limited-key-id, using a valid key and subkeys owned by the attacker.
  • Trigger point: Invocation of middlewareKey where the x-limited-key-id header is processed and the effective key context for the request is derived.
  • Why exploitation is possible: The middleware fails to enforce limited_to_orgs and limited_to_apps constraints on subkeys referenced by x-limited-key-id, causing the unrestricted parent key to be applied to downstream route handlers instead of the scoped subkey.

Why this happens

The underlying issue is a flawed authorization control flow where the system trusts a header-driven selection of subkeys without revalidating the associated scope constraints.

Instead of ensuring that the effective key context honors limited_to_orgs and limited_to_apps, the middlewareKey implementation allows a referenced subkey to resolve back to its parent key, which may lack those limitations.

This maps to CWE-863 (Incorrect Authorization), where access control decisions are made based on incomplete or incorrect authorization data, allowing operations to proceed with broader privileges than intended.

Potential impact

  • Attackers can access data or operations restricted to specific organizations that their scoped subkeys should not reach.
  • Attackers may interact with applications outside the intended limited_to_apps scope.
  • Fine-grained authorization boundaries can be bypassed, leading to privilege escalation from scoped subkeys to parent key capabilities.
  • Misuse of administrative or management APIs that rely on subkey scoping for multi-tenant isolation.

General mitigation guidance

Effective mitigation focuses on enforcing authorization constraints consistently across all key and subkey resolution paths.

Defensive patterns include:

  • Ensuring that any header-driven selection of keys or subkeys is accompanied by explicit checks of limited_to_orgs and limited_to_apps before constructing the effective authorization context.
  • Designing middleware such that parent keys cannot silently replace or override subkey scopes for downstream handlers.
  • Centralizing access control logic so that route handlers validate the effective key scope rather than trusting upstream assumptions.
  • Applying least-privilege principles to keys and subkeys, limiting parent key capabilities where possible to reduce blast radius if scoping fails.

How teams detect issues like this

Detection commonly involves:

  • Reviewing middleware and authorization code paths to ensure that scoped keys and subkeys are not upgraded to broader contexts without explicit policy checks.
  • Using static analysis or linters to flag constructs where request headers can influence authorization state without corresponding scope validation.
  • Implementing audit logging that records which key or subkey is used for each request, including its associated organization/app scopes, and monitoring for anomalies where scoped subkeys appear to grant parent-level access.
  • Enforcing security policies during code review that require centralized authorization enforcement and prohibit implicit fallback from scoped subkeys to parent keys.

Sources

SourceLink
github.comgithub.com/Cap-go/capgo/security/advisories/GHSA-2h89-vcvx-5pvh
vulncheck.comvulncheck.com/advisories/capgo-subkey-scope-bypass-in-middlewarekey-via-x-limited-key-id-header

Frequently asked

questions

It is exploitable wherever clients can influence the x-limited-key-id header and possess valid keys or subkeys; any such client can potentially escalate from a scoped subkey to its parent key's permissions.

The attacker needs the ability to send authenticated requests using their own keys or subkeys and control the x-limited-key-id header. No direct access to other tenants' keys is required to trigger the authorization bypass.

The safest fix is to enforce consistent authorization checks on the effective key context, ensuring that limited_to_orgs and limited_to_apps constraints are applied after any key or subkey selection and cannot be overridden by parent keys.

Prevention relies on centralizing authorization logic, treating headers and other selectors as untrusted inputs, performing explicit scope validation for every request, and embedding these checks into automated testing and code review practices.

Find out what's already
exploitable in your codebase.