GHSA-JQWR-VGW4-JMV7
SSRF via unvalidated Web Push subscription endpoint (any authenticated user, not just admin)
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:N/A:N
Fuente: GitHub
Ciclo de vida de la vulnerabilidad
| Fecha | Fase | Evento | Detalle |
|---|---|---|---|
| Divulgación | Publicada | GHSA-JQWR-VGW4-JMV7 divulgada · CVSS 5 (GitHub) | |
| Monitoreo | Detectada | Ingresó al índice | |
| Monitoreo | Verificada | Última verificación contra las fuentes |
Vulnerability Details
File: `frigate/api/notification.py` (registration sink), `frigate/comms/webpush.py` (send sink)
CWE: CWE-918 — Server-Side Request Forgery (SSRF)
Root Cause
`POST /notifications/register` accepts an arbitrary JSON object (`sub`, a Web Push
`PushSubscription`) from the client and stores it verbatim into `User.notification_tokens` --
there is no validation that `sub["endpoint"]` is a URL belonging to a legitimate push service
(e.g. `fcm.googleapis.com`, `updates.push.services.mozilla.com`). The only gate on this route is
`Depends(allow_any_authenticated())` -- any logged-in user, including the most restricted
custom role scoped to a single camera, can call it:
# frigate/api/notification.py
@router.post(
"/notifications/register",
dependencies=[Depends(allow_any_authenticated())], # NOT admin-only
...
)
def register_notifications(request: Request, body: dict = None):
...
sub = json.get("sub")
if not sub:
return JSONResponse(..., status_code=400)
User.update(notification_tokens=User.notification_tokens.append(sub)).where(
User.username == username
).execute()Whenever a notification is later due to fire for that user (e.g. a motion/person detection alert
on a camera they have permission to view -- which they can trigger themselves, or simply wait
for), `frigate/comms/webpush.py`'s `_process_notifications()` reads `endpoint` straight out of
the stored subscription and has `pywebpush.WebPusher` issue a real HTTP POST to it, with a
10-second timeout and no destination restriction:
# frigate/comms/webpush.py -- _process_notifications
for pusher in self.web_pushers[notification.user]:
endpoint = pusher.subscription_info["endpoint"] # attacker-controlled, from `sub`
headers = self.claim_headers[endpoint[: endpoint.index("/", 10)]].copy()
...
resp = pusher.send(headers=headers, ttl=notification.ttl, data=json.dumps({...}), timeout=10)No scheme restriction, no domain allowlist, and no private-IP/link-local/cloud-metadata block
exists anywhere on this path (verified by grepping the full text of both files for
`urlparse`/`ipaddress`/`allowlist`/`private` -- none found).
Attack Scenario
- Attacker has any authenticated Frigate account -- even a custom role restricted to one
- Attacker calls:
{"sub": {"endpoint": "http://169.254.169.254/latest/meta-data/iam/security-credentials/",
"keys": {"p256dh": "<valid P-256 point>", "auth": "<16 random bytes>"}}}
```
(or any internal-only service the attacker cannot otherwise reach -- e.g. go2rtc's internal
API on `127.0.0.1:1984`, or any RFC1918 host on the deployment's internal network)
3. Attacker triggers (or waits for) any detection event on `decoy_camera`, which they are
legitimately permitted to view -- enough to queue a notification for their user.
4. `_process_notifications` fires the queued notification and issues a real HTTP POST to the
attacker's chosen `endpoint`, from the Frigate server itself.
Impact
Any Frigate deployment with `notifications.enabled` (or per-camera notifications enabled) and any
valid authenticated session -- no admin role required -- can be made to issue outbound HTTP
POST requests to arbitrary internal/private/link-local/cloud-metadata addresses. Depending on
network placement this can reach internal services not otherwise exposed (cloud IMDS for
credential theft, other containers/services on the same Docker network as Frigate).
Dynamic Verification
Confirmed via real-code-import pytest (not simulated): a local HTTP listener stood in for an
internal-only service; a malicious subscription (with a real generated P-256 keypair, so Web
Push encryption is realistic, not stubbed) was registered through the actual
`POST /notifications/register` FastAPI route via TestClient, authenticated as role `viewer`
(confirming the non-admin gate); the subscription was read back from the real database exactly as
production code does; then a real `pywebpush.WebPusher` was constructed from the stored
subscription and `.send(...)` called with the identical argument shape
`_process_notifications()` uses. Result: the local listener received an HTTP POST on the exact
attacker-chosen path, confirming the full chain end-to-end.
Recommended Fix
Validate `sub["endpoint"]` at registration time against an allowlist of known Web Push service
hosts (or at minimum: require `https://`, reject private/loopback/link-local addresses per
RFC1918/RFC4193/`169.254.0.0/16`, and resolve + re-check the destination IP to prevent
DNS-rebinding around the allowlist):
from urllib.parse import urlparse
import ipaddress, socket
ALLOWED_PUSH_HOSTS = {
"fcm.googleapis.com",
"updates.push.services.mozilla.com",
"wns2-*.notify.windows.com",
}
def _validate_push_endpoint(endpoint: str) -> bool:
parsed = urlparse(endpoint)
if parsed.scheme != "https":
return False
host = parsed.hostname or ""
if not any(host == h or host.endswith("." + h.lstrip("*.")) for h in ALLOWED_PUSH_HOSTS):
return False
try:
ip = ipaddress.ip_address(socket.gethostbyname(host))
if ip.is_private or ip.is_loopback or ip.is_link_local or ip.is_reserved:
return False
except OSError:
return False
return TrueReject registration (400) if `_validate_push_endpoint(sub["endpoint"])` is false.
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 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-jqwr-vgw4-jmv7Las referencias externas se muestran para copiar: cve.llama.ec no lo redirige a otros sitios.
