GHSA-HH3J-7G2F-43J2
go2rtc WebSocket live stream camera access bypass (role-restricted users)
Texto original en inglés · Ver en español
Ciclo de vida de la vulnerabilidad
| Fecha | Fase | Evento | Detalle |
|---|---|---|---|
| Divulgación | Publicada | GHSA-HH3J-7G2F-43J2 divulgada | |
| Divulgación | Modificada | Última actualización del registro | |
| Monitoreo | Detectada | Ingresó al índice | |
| Monitoreo | Verificada | Última verificación contra las fuentes |
Vulnerability Details
File: `frigate/api/media_auth.py` (lines 74–98, 266–268)
CWE: CWE-862 — Missing Authorization
Severity: Medium
CVSS: 6.5 (CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:N/A:N)
Root Cause
Frigate uses nginx `auth_request` to enforce both authentication and camera-level
authorization. Camera-level access is checked in `deny_response_for_media_uri()`
inside the `/auth` subrequest handler.
`resolve_media_uri()` handles three media root paths — `recordings`, `clips`,
`exports` — and returns `MediaAuthResolution.UNKNOWN` for all other roots:
# frigate/api/media_auth.py:74-98
def resolve_media_uri(uri, frigate_config=None):
parts = [p for p in uri.split("/") if p]
root = parts[0]
if root == "recordings": return _resolve_recording(parts)
if root == "clips": return _resolve_clip(parts, frigate_config)
if root == "exports": return _resolve_export(parts)
return MediaAuthResolution.UNKNOWN, None # ← /live/ paths reach hereWhen `UNKNOWN` is returned, no camera-level check is performed:
# frigate/api/media_auth.py:266-268
if resolution == MediaAuthResolution.UNKNOWN:
return None # pass through — no camera denyThe go2rtc WebSocket live-stream endpoints are proxied by nginx:
# docker/main/rootfs/usr/local/nginx/conf/nginx.conf:202-217
location /live/mse/api/ws {
include auth_request.conf; # checks authentication only
proxy_pass http://go2rtc/api/ws;
}
location /live/webrtc/api/ws {
include auth_request.conf; # checks authentication only
proxy_pass http://go2rtc/api/ws;
}go2rtc itself has no per-stream auth configured, and the `src` query
parameter (which names the camera) is never parsed by the `/auth` handler.
The FastAPI dependency `require_go2rtc_stream_access` that DOES enforce
camera-level checks only covers the REST endpoint
`GET /go2rtc/streams/{stream_name}` — not the nginx-proxied WebSocket paths.
For comparison, `/live/jsmpeg/<camera>` is NOT vulnerable because
`ws_has_camera_access()` is called per-frame in
`frigate/output/camera.py:128` before each WebSocket broadcast.
Attack Scenario
Prerequisites: Frigate with `auth.enabled: true` and custom roles defined:
auth:
roles:
north_team:
- north_camera
cameras:
north_camera: ...
south_camera: ...- Attacker is an authenticated user with role `north_team` (allowed: `north_camera` only)
- Attacker opens WebSocket:
- nginx `auth_request` → JWT valid, role `north_team` → `/auth` returns 202
- `deny_response_for_media_uri("/live/mse/api/ws", "north_team", config)` → `UNKNOWN` → `None`
- nginx proxies to go2rtc `http://127.0.0.1:1984/api/ws?src=south_camera`
- go2rtc streams `south_camera` live video to attacker
Impact
A role-restricted authenticated user can view live video from any configured
camera, bypassing the camera allowlist restriction. The attacker needs to know
the camera name, which can be enumerated via `GET /api/go2rtc/streams`
(that endpoint correctly enforces camera access, but returns stream names).
Recommended Fix
Add a `live` path handler in `resolve_media_uri()` that extracts the camera
name from the `src` query parameter and returns `MediaAuthResolution.CAMERA`:
# In frigate/api/auth.py — parse X-Original-URL query params and pass to deny check
# OR in frigate/api/media_auth.py — extend deny_response_for_media_uri to accept
# a full URL so it can read ?src= for /live/ paths.
# Simplest fix: handle /live/ in resolve_media_uri with query string support:
if root == "live":
# /live/mse/api/ws?src=<camera_name> or /live/webrtc/api/ws?src=<camera>
src = query_params.get("src")
if src:
return MediaAuthResolution.CAMERA, src
return MediaAuthResolution.UNKNOWN, NoneAlternative: enable token-based auth in go2rtc `server.auth` configuration
so each stream requires a camera-specific token that the auth middleware mints.
Verification
Dynamic proof via verbatim extraction of `deny_response_for_media_uri()` logic
from `frigate/api/media_auth.py` — 7/7 checks confirm bypass on HEAD (≥ v0.17.1):
- `deny_response_for_media_uri("/live/mse/api/ws?src=forbidden_cam", "restricted_role", config)` returns `None` (not `403`)
- Same check for `/recordings/forbidden_cam/...` correctly returns `403`
- `resolve_media_uri("/live/mse/api/ws")` → `UNKNOWN` — camera name ignored entirely
---
Update — 2026-08-16: Regression confirmed on "patched" v0.17.2
This advisory's metadata currently lists `v0.17.2` as the patched version. That is
incorrect — the same missing-authorization gap is still exploitable on v0.17.2,
just relocated after a refactor removed `frigate/api/media_auth.py` entirely.
New location of the same bug:
- `frigate/api/auth.py` — the generic `/auth` subrequest handler (function `auth()`,
~line 569) validates the JWT and returns `remote-role`, but never inspects the
original request URL/query string to determine which camera is being requested.
- nginx's internal `/auth` location (`docker/main/rootfs/usr/local/nginx/conf/auth_location.conf`)
*does* forward the full original URL via `X-Original-URL` (including `?src=<camera>`) —
so the data needed for a per-camera check reaches the handler, but the handler
ignores it.
- `location /live/mse/api/ws` and `location /live/webrtc/api/ws` in
`docker/main/rootfs/usr/local/nginx/conf/nginx.conf` (lines ~199-215) still only run
the generic `auth_request /auth;` before proxying straight to go2rtc — no camera-scoped
dependency (like `require_go2rtc_stream_access`, which is wired only to the separate
`GET /go2rtc/streams/{stream_name}` REST route) sits in this path.
Net effect: identical to the original report — a role-restricted authenticated
user can still open `/live/mse/api/ws?src=<any_camera>` or
`/live/webrtc/api/ws?src=<any_camera>` and stream video from a camera outside their
`auth.roles` allowlist, on the version currently marked as patched.
Re-verification method: Real-code-import pytest driving the actual FastAPI
`/auth` route through `TestClient` (not a hand-copied reimplementation) —
`create_encoded_jwt()` mints a JWT for a role scoped to `north_camera` only, then
`GET /auth` is called with `X-Original-URL` set exactly as nginx's
`auth_location.conf` forwards it (e.g.
`https://.../live/mse/api/ws?src=south_camera`). Result: 202 Accepted
returned for `src=south_camera` under the `north_team`-scoped JWT — identical to
the response for the allowed camera `north_camera` — confirming no camera-scoped
check occurs in this path. A negative control (identical request with no JWT
cookie) correctly returns 401, ruling out a broken test harness. 3/3 tests pass.
Suggested fix (updated for the current code): `auth()` in `frigate/api/auth.py`
should parse the `X-Original-URL` header's query string when the resolved path is
`/live/mse/api/ws` or `/live/webrtc/api/ws`, extract `src`, and deny (401/403) if the
authenticated user's role does not include that camera in `auth.roles` — mirroring the
check already present in `require_go2rtc_stream_access()` for the REST route, or in
`ws_has_camera_access()` used for `/live/jsmpeg/`.
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 |
|---|---|---|---|---|
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-hh3j-7g2f-43j2Las referencias externas se muestran para copiar: cve.llama.ec no lo redirige a otros sitios.
