GHSA-XWHM-9623-6R35
RBAC bypass — cross-camera image disclosure via image_path in export endpoints
Texto original en inglés · Ver en español
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-XWHM-9623-6R35 divulgada · CVSS 6.5 (GitHub) | |
| Monitoreo | Detectada | Ingresó al índice | |
| Monitoreo | Verificada | Última verificación contra las fuentes |
Summary
Frigate's role-based access control (`auth.roles`) lets an admin restrict a user to a subset of cameras. Every endpoint that returns or acts on camera-scoped data enforces this via `require_camera_access()` / `get_allowed_cameras_for_filter()`.
The recording-export endpoints accept a second, independent field, `image_path`, used to seed a new export's thumbnail from an existing image. This field is sanitized only for path-traversal containment under `CLIPS_DIR` (`_sanitize_existing_image()`)—never checked against the camera the RBAC dependency just authorized. `CLIPS_DIR` is one shared directory for all cameras, so a user restricted to camera A can create a legitimate export for camera A (passing the ACL check) while pointing `image_path` at a file under camera B's directory.
The background export worker (`RecordingExporter.save_thumbnail`) then does:
if self.user_provided_image is not None and os.path.isfile(self.user_provided_image):
shutil.copy(self.user_provided_image, thumb_path) # frigate/record/export.py:589
return thumb_pathwith no check that `self.user_provided_image` actually belongs to `self.camera`. The copied file becomes the thumbnail of the requester's own authorized export, which they can then legitimately download—exfiltrating image content from a camera (or the `faces/` biometric training directory) they were never granted access to.
This is a "two independently secure features compose insecurely" bug: the path-traversal hardening and the per-camera RBAC were each done correctly in isolation, but nothing cross-checks them against each other for this field.
Affected Code (file:line, current `master`)
- `frigate/api/export.py:131-145` — `_sanitize_existing_image()`: validates only traversal/containment under `CLIPS_DIR`, never per-camera scope.
- `frigate/api/export.py:636-786` (`export_recordings_batch`, `POST /exports/batch`) — per-item camera ACL check at `frigate/api/export.py:666-675`, completely independent of `image_path` sanitization at `frigate/api/export.py:680-686`.
- `frigate/api/export.py:802-829` (`export_recording`, `POST /export/{camera_name}/start/{start_time}/end/{end_time}`) — same pattern: `require_camera_access` gates `camera_name`, while `body.image_path` is sanitized independently.
- `frigate/api/export.py:943-967` (`export_recording_custom`, `POST /export/{camera_name}/customize/start/{start}/end/{end}`) — same pattern.
- `frigate/record/export.py:583-590` (`RecordingExporter.save_thumbnail`) — the sink: unconditional `shutil.copy(self.user_provided_image, thumb_path)`.
- `frigate/record/export.py:896-928` (`RecordingExporter.run`) — confirms the copy and `Export.insert()` (persisting `thumb_path`) happen before any FFmpeg video-encoding step.
Proof of Concept
Reproduced end-to-end against the real `frigate.api.fastapi_app.create_fastapi_app()` production app factory via FastAPI's `TestClient` (real ASGI request handling), a real temporary SQLite DB migrated with Frigate's own `peewee_migrate` migrations, and the real `RecordingExporter` background thread performing a real `shutil.copy()` of a real file on disk.
Only the unrelated ML/detection dependency stack (`cv2`, TensorFlow, ONNX Runtime, etc.) was stubbed—none of that code is in the vulnerable path.
Setup
config = {
"auth": {
"roles": {
"limited_user": ["front_door"]
}
},
"cameras": {
"front_door": {...},
"back_door": {...},
},
}
# back_door's private thumbnail, NOT accessible to limited_user:
open(
f"{CLIPS_DIR}/thumbs/back_door/private.jpg",
"wb",
).write(SECRET_BYTES)Attack
As `limited_user`, send a real HTTP request through the production app:
POST /exports/batch
X-Remote-Role: limited_user
Content-Type: application/json
{
"items": [
{
"camera": "front_door",
"start_time": ...,
"end_time": ...,
"image_path": "/.../clips/thumbs/back_door/private.jpg"
}
]
}Observed Result
[attack] response status=202
{
'success': True,
'export_id': 'front_door_xfw459',
...
}
[verify] Export DB row:
camera=front_door
thumb_path=.../export/front_door_xfw459.webp
[verify] thumbnail file contents:
b'BACK_DOOR_PRIVATE_CAMERA_SNAPSHOT_...'
!!! VULNERABLE: back_door's private image was copied into
limited_user's own front_door export thumbnail !!!
[verify] GET /exports/front_door_xfw459 (as limited_user) -> 200
[verify] thumb_path=.../export/front_door_xfw459.webp
(their own export — legitimately downloadable)`limited_user` never had `back_door` in their allow-list at any point. The request was never rejected for the mismatched `image_path`, and the leaked bytes are verifiable byte-for-byte in the DB-recorded, self-downloadable thumbnail.
Impact
Any user with export-creation rights on at least one camera can exfiltrate an arbitrary file from anywhere under `CLIPS_DIR`, including:
- Other cameras' clips and thumbnails, including cameras restricted to administrators.
- The `faces/` directory used for face-recognition training photos of named individuals.
This is a confidentiality-only issue; no integrity or availability impact was identified.
This is also not a regression of the existing path-traversal protection: containment outside `CLIPS_DIR` remains fixed. The issue is specifically a scoping/cross-check gap between filesystem containment and per-camera authorization.
Suggested Fix
In `_sanitize_existing_image()` (or at its call sites), additionally require that the resolved image path's camera-name component—matching how `media_auth.py` already performs directory-based camera parsing elsewhere in the codebase—equals the export item's own `camera` / `camera_name`.
Reject the request if the path belongs to a different camera or to a non-camera-scoped directory unless that directory is explicitly authorized.
This would mirror the existing check at `export.py:666-675`, ensuring that authorization of the export's `camera` field also constrains the user-controlled `image_path`.
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 |
0.18.0Arsenal 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-xwhm-9623-6r35Las referencias externas se muestran para copiar: cve.llama.ec no lo redirige a otros sitios.
