llamaCVEVulnerability Intelligence
/
Advisory · GitHub · PyPI · frigate

GHSA-F4G2-5496-9233

Path traversal in face-recognition management endpoints (arbitrary file write via register, arbitrary file delete via delete)

Texto original en inglés · Ver en español

Sin parche publicado
Descargar PNG JSON
CVSS 3.1
3.8
Baja
CVSS:3.1/AV:N/AC:L/PR:H/UI:N/S:U/C:N/I:L/A:L Fuente: GitHub
ExplotaciónSin evidenciaNo figura en CISA KEV
Exploits públicos0Ninguno conocido
ParcheSin parcheEl fabricante no ha publicado corrección
Exposición70 dDesde la divulgación, 12 sept 2026, 8:45 a. m.
Detección67 dDesde la divulgación hasta su ingreso al índice
Decisión estimadaSeguir
Remediar en la ventana regular de mantenimiento
Estimación de Llama con el árbol SSVC de CISA a partir de vector CVSS 3.1 y la evidencia de explotación (sin evaluación oficial): sin explotación conocida, no automatizable e impacto técnico parcial. No hay versión corregida: aplique mitigaciones.
Hasta mi siesta tiene más impacto.Relájate, esto es más bajo que mi siesta.
Timeline

Ciclo de vida de la vulnerabilidad

Hoy
Divulgación
Publicada
Explotación
Remediación
Monitoreo
Detectada +1
12 sept 26
18 nov 26
21 nov 26
12 sept 26
30 sept 26
17 oct 26
4 nov 26
21 nov 26
FechaFaseEventoDetalle
Divulgación Publicada GHSA-F4G2-5496-9233 divulgada · CVSS 3.8 (GitHub)
Monitoreo Detectada Ingresó al índice
Monitoreo Verificada Última verificación contra las fuentes
Resumen
Descripción del advisory
Texto original · GitHub · en inglés

Vulnerability Details

Files: `frigate/data_processing/real_time/face.py` (register sink), `frigate/embeddings/__init__.py` (delete sink)
CWE: CWE-22 — Improper Limitation of a Pathname to a Restricted Directory ("Path Traversal")

Root Cause

Two of Frigate's four face-management code paths in `frigate/api/classification.py` pass the
`name` path parameter straight through to `FACE_DIR`-relative filesystem operations with no
`sanitize_filename()` call and no post-join containment check — unlike their sibling functions
in the exact same file/class, which both correctly protect the identical parameter:

| Route | Sanitizes `name`? |
|---|---|
| `POST /faces/{name}/create` | ✅ `sanitize_filename(name.replace(" ", "_"))` |
| `PUT /faces/{old_name}/rename` | ✅ regex allowlist + `sanitize_filename` equality + `os.path.normpath(...).startswith(FACE_DIR)` |
| `POST /faces/{name}/register` | ❌ none |
| `POST /faces/{name}/delete` | ❌ none |

1. Arbitrary file write via `register_face`:

# frigate/api/classification.py:283-291
async def register_face(request: Request, name: str, file: UploadFile):
    ...
    context.register_face(name, await file.read())  # `name` unsanitized

# frigate/embeddings/__init__.py:190-197 — passthrough, still unsanitized
def register_face(self, face_name: str, image_data: bytes) -> dict[str, Any]:
    return self.requestor.send_data(
        EmbeddingsRequestEnum.register_face.value,
        {"face_name": face_name, "image": base64.b64encode(image_data).decode("ASCII")},
    )

# frigate/data_processing/real_time/face.py:392-401 — the sink
folder = os.path.join(FACE_DIR, label)          # label = request_data["face_name"], raw
file = os.path.join(folder, f"{label}_{datetime.datetime.now().timestamp()}.webp")
os.makedirs(folder, exist_ok=True)               # creates ANY directory, no containment check
with open(file, "wb") as output:
    output.write(thumbnail.tobytes())

2. Arbitrary file deletion via `delete_face_ids`:

# frigate/api/classification.py:350-362
def deregister_faces(request: Request, name: str, body: DeleteFaceImagesBody):
    ...
    context.delete_face_ids(name, map(lambda file: sanitize_filename(file), body.ids))
    # `name` itself is passed RAW -- only body.ids elements are sanitized

# frigate/embeddings/__init__.py:227-236 -- the sink
def delete_face_ids(self, face: str, ids: list[str]) -> None:
    folder = os.path.join(FACE_DIR, face)        # `face` = raw `name`, no sanitization
    for id in ids:
        file_path = os.path.join(folder, id)
        if os.path.isfile(file_path):
            os.unlink(file_path)                  # deletes the file
    if face != "train" and len(os.listdir(folder)) == 0:
        os.rmdir(folder)
Attack Scenario

Both routes require the admin role (`Depends(require_role(["admin"]))`).

An important, non-obvious routing detail: a literal `..` path segment (e.g.
`POST /faces/../delete`) is normalized away client-side by any RFC-3986-compliant HTTP client
(browsers, httpx, most HTTP libraries) *before the request is even sent*. The percent-encoded
form is not — `POST /faces/%2e%2e/delete` survives client-side normalization and Starlette
percent-decodes it server-side, *after* route matching, resolving `name == ".."`. (An embedded,
percent-encoded slash within the same `{name}` segment, e.g. `%2e%2e%2fsome_dir`, does not
survive — Starlette's router matches against the still-encoded path and 404s — so the reachable
payload is exactly the slash-free, single-level `..` escape, not a deeper multi-segment
traversal.) A raw/manually-crafted request (curl `--path-as-is`, Burp Repeater) can send either
form.

  1. `POST /faces/%2e%2e/register` with a multipart image attached → the server creates
  2. `POST /faces/%2e%2e/delete` with body `{"ids": ["<target-filename>"]}` → `folder =
Impact

An admin account (own, or compromised via another vector) can write an attacker-controlled image
file directly into `CLIPS_DIR`, or delete arbitrary files by name directly under `CLIPS_DIR` (and
potentially remove `CLIPS_DIR` itself if transiently empty) — bypassing the intended "faces only"
containment of this feature entirely. `PR:H` reduces CVSS from a hypothetical unauthenticated
case, but this is still a meaningful containment failure, and mirrors the same class of bug as
GHSA-hh3j-7g2f-43j2 ("the code that should scope an operation to one directory doesn't").

Dynamic Verification

Both sinks were dynamically confirmed via real-code-import pytest (not a hand-copied
reimplementation) — `EmbeddingsContext.delete_face_ids()` and
`FaceRealTimeProcessor.handle_request()`'s register_face branch were called directly, unmodified,
against a temp-directory sandbox with `FACE_DIR` monkeypatched, proving files land/are deleted
outside `FACE_DIR`. The routing-layer reachability of the `%2e%2e` payload was separately,
empirically confirmed against a live FastAPI/Starlette TestClient instance. A differential
control in the same test suite confirms the sibling `rename_face()` function correctly *rejects*
the identical payload via its existing containment check, proving this is a gap specific to
`register_face`/`delete_face_ids`, not a missing feature across the whole class.

Recommended Fix

Apply the exact containment pattern already implemented (and proven correct) in
`EmbeddingsContext.rename_face()` in the same file to both `register_face`'s sink and
`delete_face_ids`:

from pathvalidate import sanitize_filename

label = sanitize_filename(request_data["face_name"], replacement_text="_")
folder = os.path.normpath(os.path.join(FACE_DIR, label))
if not folder.startswith(os.path.normpath(FACE_DIR) + os.sep):
    raise ValueError(f"Invalid face name: {request_data['face_name']}")

Consider factoring `rename_face()`'s containment check into a shared helper so all four
face-management code paths (`create`, `register`, `delete`, `rename`) use one audited
implementation instead of independent (and here, missing) copies.

Vector CVSS 3.1

Desglose de métricas

Opción resaltada = valor del vector · izquierda = peor caso · GitHub
Vector de ataqueAV:N
RedAdyacenteLocalFísica
ComplejidadAC:L
BajaAlta
PrivilegiosPR:H
NingunoBajosAltos
InteracciónUI:N
NingunaRequerida
AlcanceS:U
CambiadoSin cambio
ConfidencialidadC:N
AltoBajoNinguno
IntegridadI:L
AltoBajoNinguno
DisponibilidadA:L
AltoBajoNinguno
Score de explotaciónQué tan fácil y probable es que la exploten
5.0/ 10Medio
Vector 5.0 (moderada) · sin evidencia de explotación.
Versiones

Rangos afectados

Afectada Corregida Última
frigate≤ 0.17.2
0.7.0
0.17.2
Remediación

Estado del parche por paquete

Paquete / productoEstadoCorregida enDesde divulgaciónÚltima versión
pypifrigate
Sin parche — — 0.7.0 afectada
Explotación

Arsenal público

Sin exploits, módulos ni PoC públicos conocidos a la fecha de verificación.

Referencias
Advisoryhttps://github.com/blakeblackshear/frigate/security/advisories/GHSA-f4g2-5496-9233

Las referencias externas se muestran para copiar: cve.llama.ec no lo redirige a otros sitios.