Summary
Capgo suffers from a broken object level authorization flaw in its build control endpoints, allowing users to operate on build jobs they do not own.
When an authenticated user with the app.build_native permission can reference arbitrary jobId values, they may start or cancel builder jobs for other tenants, leading to cross-tenant build disruption and unauthorized compute usage.
Affected context
This vulnerability appears in Capgo's backend API where build lifecycle actions are exposed via POST endpoints. It affects deployments where:
- The /build/start/:jobId and /build/cancel/:jobId routes are available to authenticated users with app.build_native permission.
- Authorization checks rely only on app_id from the request body without tying it to the jobId in the URL.
- Builder API keys are managed server-side and used automatically to issue privileged commands to the build infrastructure.
Under these conditions, users may be able to influence build jobs outside their own apps, tenant, or organization boundaries.
Exploit preconditions
- Attack surface: Capgo HTTP API endpoints:
- POST /build/start/:jobId
- POST /build/cancel/:jobId
- Required access: Valid authenticated account with app.build_native permission for at least one app they control.
- Trigger point: Sending a request with a legitimate app_id in the body while specifying a victim jobId in the URL path.
- Why exploitation is possible: The handler authorizes based only on the attacker-controlled app_id and does not verify that the referenced jobId is associated with that app or tenant, allowing privileged builder commands to be executed on foreign jobs using a server-held builder API key.
Why this happens
The underlying bug class is broken object level authorization, where access control is performed at the resource type level but not at the individual object level. The API trusts the app_id in the request body as sufficient proof of ownership, yet fails to confirm that the jobId in the path belongs to that same app or tenant.
This maps to CWE-285 (Improper Authorization), as authorization logic does not enforce object/tenant scoping. The insecure pattern is relying on a single attribute (app_id) for authorization without correlating it to the target resource identifier (jobId) before performing privileged actions with internal credentials.
Potential impact
- Authenticated users can start build jobs for other tenants' applications without consent.
- Attackers may cancel or sabotage in-progress builds belonging to victims, causing denial of service in CI/CD workflows.
- Unauthorized consumption of compute resources can occur, potentially driving up billing for affected tenants.
- Build pipeline reliability and trust may be undermined, impacting release schedules and deployment integrity.
- Abuse of builder infrastructure could contribute to broader operational instability.
General mitigation guidance
Effective mitigation focuses on strengthening object-level authorization and tenant isolation rather than just checking generic permissions. Common secure patterns include:
- Ensuring every build-related action verifies that the jobId being operated on is owned by the requesting principal's app, tenant, or organization before issuing commands.
- Deriving app_id and tenant context from trusted server-side data (e.g., from the job record or authentication token) instead of relying on client-supplied values.
- Applying a consistent authorization layer that enforces resource-to-tenant mappings for all multi-tenant objects, including builder jobs.
- Using least-privilege principles for internal builder API keys, scoping their usage to validated jobs and preventing cross-tenant access by design.
- Designing APIs to minimize the need for clients to specify sensitive foreign identifiers and favor server-side lookups based on authenticated context.
How teams detect issues like this
Detection commonly involves reviewing authorization logic and resource ownership checks for multi-tenant APIs. Useful approaches include:
- Static analysis rules or custom linters that flag endpoints where client-supplied identifiers (e.g., jobId, app_id) are used in sensitive operations without a corresponding ownership validation query.
- Security-focused code reviews that examine controller/handler methods, ensuring they confirm associations between path parameters and authenticated tenant context before invoking privileged services.
- Logging and monitoring for anomalous patterns, such as users controlling jobs outside their organization or frequent operations on unrelated jobIds.
- Enforcement of architecture-level policies that require centralized authorization middleware for all object-level operations, with automated checks in CI to prevent bypasses.
- Periodic multi-tenant abuse assessments and penetration tests focusing on object-level access controls for build and pipeline infrastructure.

