GHSA-72J4-9QP5-HFRG
Cross-tenant build job control (cancel/start) via jobId parameter enables build sabotage (BOLA)
Ciclo de vida de la vulnerabilidad
| Fecha | Fase | Evento | Detalle |
|---|---|---|---|
| Divulgación | Publicada | GHSA-72J4-9QP5-HFRG divulgada | |
| Monitoreo | Detectada | Ingresó al índice | |
| Monitoreo | Verificada | Última verificación contra las fuentes |
### Summary
An authenticated user who has app.build_native permission for any app they control can invoke start and cancel actions against an arbitrary builder job by providing a victim jobId in the URL while supplying an app_id they are authorized for. The API does not verify that the jobId belongs to the provided app_id (or the same tenant/org) before issuing privileged builder commands using the server-held builder API key.
This allows cross-tenant build sabotage (DoS) and potentially unauthorized compute/billing actions.
### Details
Affected routes:
- POST /build/start/:jobId (requires JSON body { "app_id": "<app>" })
- POST /build/cancel/:jobId (requires JSON body { "app_id": "<app>" })
The handlers authorize based only on attacker-controlled app_id:
supabase/functions/_backend/public/build/start.ts
- checkPermission(c, 'app.build_native', { appId }) is performed only for the supplied appId
- then calls builder: POST ${BUILDER_URL}/jobs/${jobId}/start using BUILDER_API_KEY
- no lookup/binding of jobId → build_requests.app_id / owner_org before the builder call
supabase/functions/_backend/public/build/cancel.ts
- same pattern; calls builder: POST ${BUILDER_URL}/jobs/${jobId}/cancel using BUILDER_API_KEY
- updates DB by .eq('builder_job_id', jobId) after builder action (RLS may fail, but the builder action already executed)
Route wiring (shows attacker-controlled app_id usage):
- supabase/functions/_backend/public/build/index.ts routes /build/start/:jobId and /build/cancel/:jobId
### PoC
Prerequisite: attacker has a valid API key with app.build_native for their own app. The attacker also has/obtains a target jobId (e.g., from logs/support artifacts/screenshots/etc.).
Cancel arbitrary job
API="https://api.capgo.app"
KEY="<attacker_capgkey_with_build_permission>"
MY_APP="<attacker_app_id>"
JOB="<victim_or_other_job_id>"
curl -sk --http2 -i -X POST "$API/build/cancel/$JOB" \
-H "capgkey: $KEY" \
-H "content-type: application/json" \
--data "{\"app_id\":\"$MY_APP\"}"_Observed behavior (confirmed)_
- Returns HTTP/2 200 and JSON indicating cancellation:
<img width="732" height="233" alt="image" src="https://github.com/user-attachments/assets/fb8f71b0-8f05-45c5-a798-f151e84b8191" />
Start arbitrary job (builder reached)
API="https://api.capgo.app"
KEY="<attacker_capgkey_with_build_permission>"
MY_APP="<attacker_app_id>"
JOB="<victim_or_other_job_id>"
curl -sk --http2 -i -X POST "$API/build/start/$JOB" \
-H "capgkey: $KEY" \
-H "content-type: application/json" \
--data "{\"app_id\":\"$MY_APP\"}"_Observed behavior (confirmed)_
- Returns a builder_error that reflects builder state for the target jobId (e.g., job is expired, cannot start), demonstrating the API invoked the builder using the privileged builder API key.
<img width="864" height="296" alt="image" src="https://github.com/user-attachments/assets/2fbe86cd-96c6-41a0-b232-f43a89adb321" />
Impact
- Cross-tenant DoS / sabotage: attackers can cancel other tenants’ active builds if they learn a jobId.
- Unauthorized build control: attackers can trigger start attempts on jobs they do not own (builder is contacted and responds based on job state).
- Potential cost/billing impact if builder actions are metered.
- Potential side-channel: detailed builder errors may reveal job state.
Recommended Fix
Before calling builder start/cancel:
- Fetch build_requests row by builder_job_id = :jobId (server-side).
- Verify the row belongs to the same tenant and matches the request context:
- build_requests.app_id === appId and/or build_requests.owner_org matches caller org
- If mismatch or missing row: return 404 (avoid leaking job existence).
- Consider removing client-supplied app_id entirely for start/cancel and deriving app_id from the build_requests row.
Incluye detalles técnicos publicados por el investigador. Úselos solo para validar y corregir sus propios sistemas.
Rangos afectados
Estado del parche por paquete
| Paquete / producto | Estado | Corregida en | Desde divulgación | Última versión |
|---|---|---|---|---|
npmcapgo |
Corregida | 12.128.2 | — | — |
12.128.2Arsenal público
Sin exploits, módulos ni PoC públicos conocidos a la fecha de verificación.
https://github.com/Cap-go/capgo.app/security/advisories/GHSA-72j4-9qp5-hfrgLas referencias externas se muestran para copiar: cve.llama.ec no lo redirige a otros sitios.
