GHSA-W3C4-957Q-2JW4
SSRF via webpush endpoint validation bypass — registration-time check does not match send-time resolution/redirect behavior
Texto original en inglés · Ver en español
CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:C/C:L/I:L/A:N
Fuente: GitHub
Ciclo de vida de la vulnerabilidad
| Fecha | Fase | Evento | Detalle |
|---|---|---|---|
| Divulgación | Publicada | GHSA-W3C4-957Q-2JW4 divulgada · CVSS 6.4 (GitHub) | |
| Monitoreo | Detectada | Ingresó al índice | |
| Monitoreo | Verificada | Última verificación contra las fuentes |
### Summary
The webpush notification endpoint's SSRF validator
(_validate_push_endpoint, frigate/api/notification.py:31-85, added
in commit ad79e666e) validates the subscription endpoint URL as a
string once at registration time. The actual send path
(frigate/comms/webpush.py:299-322) POSTs to the stored URL verbatim
via pywebpush, which resolves DNS fresh at send time and follows
redirects. Two distinct bypass classes allow any authenticated user,
including restricted/viewer roles, to cause the Frigate server to
send outbound requests to internal or arbitrary hosts.
Details
Bypass class 1 — non-canonical IPv4 forms: the validator uses
ipaddress.ip_address(hostname) to detect private IPs, but glibc's
getaddrinfo (used at actual connection time) accepts forms that
ipaddress.ip_address() rejects as malformed and therefore does not
flag as private.
Live-verified accept/resolve pairs:
Endpoint Validator Resolves to
https://127.0.0.1/fcm/send/tok reject 127.0.0.1
https://127.1/fcm/send/tok ACCEPT 127.0.0.1
https://0x7f.1/fcm/send/tok ACCEPT 127.0.0.1
https://0177.0.0.1/fcm/send/tok ACCEPT 127.0.0.1
https://169.254.169.254.nip.io/fcm/send/tok ACCEPT 169.254.169.254
Bypass class 2 — redirect escape: an attacker registers their own
legitimately valid public HTTPS endpoint (passes all registration-time
checks). When Frigate later sends a notification, the attacker's
server responds with a 302 redirect. The actual send call follows the
redirect to any scheme/host/port — the HTTPS/port-443 constraints only
exist in the registration-time validator, not the send-time request.
This converts a blind SSRF into attacker-steered GET/POST requests
against arbitrary internal URLs.
Test coverage gap: test_webpush_registration.py tests only the pure
validator function in isolation — it correctly pins rejection of
canonical IP literals, .local/.internal/.home.arpa suffixes, wrong
ports, and embedded credentials. It contains zero tests for
non-canonical IPv4 encodings, zero for hostname-to-IP resolution
behavior, and zero for redirect behavior at send time. Every rejected
case in the test suite has an accepted sibling that behaves identically
on the wire.
PoC
Live-tested with a real frigate.api.notification.router mounted in
FastAPI, a real User model on SQLite, real HTTP via TestClient, as an
authenticated user with restricted role "patrol":
Step 1 — control, canonical private IP correctly rejected:
POST /notifications/register
{"sub": {"endpoint": "https://127.0.0.1/fcm/send/tok", ...}}
-> 400 {"success": false, "message": "Invalid subscription: endpoint
must not use a private address"}
Step 2 — bypass, non-canonical form accepted:
POST /notifications/register
remote-user: restricted, remote-role: patrol
{"sub": {"endpoint": "https://127.1/fcm/send/tok", ...}}
-> 200 {"success": true, "message": "Successfully saved token."}
Step 3 — persisted:
[{"endpoint": "https://127.1/fcm/send/tok", ...}]
Step 4 — send path attempted with valid EC keys (real pywebpush call):
ConnectionError: HTTPSConnectionPool(host='127.1', port=443)...
[Errno 111] Connection refused
The connection-refused error confirms the send attempt actually
dialed the loopback-resolved address 127.0.0.1 — the SSRF payload was
delivered to the intended internal target, with only ordinary user
registration privilege required.
### Impact
Any authenticated user, including restricted/viewer-role accounts,
can register a webpush subscription that causes the Frigate server to
make outbound requests to internal network addresses or, via the
redirect bypass, to attacker-steered arbitrary destinations. The
outbound requests carry a JSON body containing camera names,
detected-object labels, zones, GenAI summaries, event IDs, and
thumbnail paths. Because the attacker supplies their own p256dh/auth
encryption keys during registration, they can decrypt any response
data captured. Internal state-changing GET endpoints reachable via
the redirect bypass are also exposed.
### Suggested Fix
Resolve the hostname at validation time via socket.getaddrinfo() and
apply ipaddress.is_global() to every resolved address rather than
parsing the literal hostname string. Additionally, either re-validate
the resolved address at send time, or construct the pywebpush request
using a session with redirects disabled
(requests.Session(); session.post(..., allow_redirects=False)).
Consider purging or flagging pre-existing stored subscriptions that
fail the new check on upgrade.
Please credit this report to Mayssare Amakhtari (GitHub: @cy3erm).
Incluye detalles técnicos publicados por el investigador. Úselos solo para validar y corregir sus propios sistemas.
Desglose de métricas
Rangos afectados
Estado del parche por paquete
| Paquete / producto | Estado | Corregida en | Desde divulgación | Última versión |
|---|---|---|---|---|
pypifrigate |
Sin parche | — | — | 0.7.0 no afectada |
Arsenal público
Sin exploits, módulos ni PoC públicos conocidos a la fecha de verificación.
https://github.com/blakeblackshear/frigate/security/advisories/GHSA-w3c4-957q-2jw4Las referencias externas se muestran para copiar: cve.llama.ec no lo redirige a otros sitios.
