GHSA-3XM3-Q2FJ-X8RQ
SVG sanitization bypass via filename extension, and unvalidated curation paths
Texto original en inglés · Ver en español
CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:N/I:H/A:N
Fuente: GitHub
Ciclo de vida de la vulnerabilidad
| Fecha | Fase | Evento | Detalle |
|---|---|---|---|
| Divulgación | Publicada | GHSA-3XM3-Q2FJ-X8RQ divulgada · CVSS 6.5 (GitHub) | |
| Monitoreo | Detectada | Ingresó al índice | |
| Monitoreo | Verificada | Última verificación contra las fuentes |
Summary
Two issues affecting installations that let non-trusted users upload media or crop curations through a Filament panel.
- SVG sanitization could be bypassed by renaming the file. Sanitization was gated on the client-supplied filename extension while upload acceptance and the served content type were both decided from the file's contents, so SVG markup uploaded under another name (`payload.txt`) was stored without being sanitized and could later be served as `image/svg+xml`.
- The curation modal wrote to a client-supplied path. The crop payload was consumed unvalidated, letting a panel user overwrite files elsewhere inside the storage disk.
Neither issue is exploitable by an unauthenticated visitor. Both require an account that can reach the media library.
Issue 1 — SVG sanitization bypass via filename extension
`Uploader` decided whether to sanitize with `Curator::isSvg($file->getClientOriginalExtension())`. Acceptance, however, is content-based (the `mimetypes:` rule reads the detected type), and `image/svg+xml` is accepted by default. Uploading SVG markup as `payload.txt` therefore passed validation, skipped the sanitizer, and was stored raw with `ext = 'txt'`.
At serving time, `MediaController` streamed non-Glide media with Flysystem's sniffed type. libmagic reports `image/svg+xml` for SVG markup regardless of filename, so the stored payload was returned as `Content-Type: image/svg+xml` with an inline disposition. `X-Content-Type-Options: nosniff` does not help, because the server declares the type itself.
Impact. Script in the payload executes in the application's origin *only* if a victim is induced to open the signed media URL as a top-level document. It does not fire during normal use of the panel: the View action opens the media's direct storage URL, which a web server types from the `.txt` extension, and every in-panel display uses `<img>`, where SVG script does not execute. This is why the rating is Moderate rather than High.
This bypassed the fix shipped in GHSA-8vm9-f75m-5h2m. `curator:sanitize-svgs` did not catch the affected rows either, because it selected on `ext` alone.
Affected code paths. `Components\Forms\Uploader` (all lines) and `CuratorUtils::importMedia` (5.x/4.x), which performed no SVG sanitization at all. The 3.x uploader already gated on the detected type and was never affected on the upload side; only its serving layer was.
*Per-issue score:* `CVSS:3.1/AV:N/AC:H/PR:L/UI:R/S:C/C:L/I:L/A:N` (4.7)
Issue 2 — Unvalidated curation payload
`CuratorCuration::saveCuration()` consumed the client payload without validation:
- `key` is concatenated into the storage path. Flysystem rejects only traversal that escapes the disk root, so `../../other` still resolves onto a sibling inside it — including the source media the curation was cropped from.
- `format` selected the image encoder unchecked.
- `canvasData.naturalWidth` / `naturalHeight` were used as divisors with no zero guard, so a crafted payload raised an unhandled error.
Writes are confined to the storage disk and the content must be something the image encoder can produce, so this is a file-overwrite and integrity issue rather than a path to code execution.
*Per-issue score:* `CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:N/I:H/A:N` (6.5) — used as the advisory score, as the higher of the two.
Patches
Upgrade to 5.3.2, 4.2.1, or 3.7.11.
The fix is layered, so a spoofed filename cannot route around it and pre-existing rows are neutralised without a migration:
- Sanitization now runs when either the extension or the detected type says SVG, in both the uploader and the import helper.
- The serving layer pins `Content-Type` from the stored extension rather than the sniffed bytes, and forces a download when the extension is unknown and the sniff would render as a document.
- `curator:sanitize-svgs` now selects on the detected type as well as the extension.
- The curation payload is validated before anything is written.
Remediation for existing media
After upgrading, re-scan stored media:
php artisan curator:sanitize-svgs --dry-run # report only
php artisan curator:sanitize-svgsThis rewrites SVG content in place, including rows stored under a non-`.svg` extension. The serving-layer change already prevents those rows from being rendered as documents, so the scan is cleanup rather than the primary fix.
3.x users: this command previously looped indefinitely on libraries with more than 100 SVG records and never completed. That is fixed in 3.7.11, so a scan that appeared to hang on an earlier version should be re-run.
Workarounds
Without upgrading:
- Remove `image/svg+xml` from the accepted file types, per field with `->acceptedFileTypes()` or globally with `Curator::acceptedFileTypes()`.
- Restrict media upload and curation permissions to trusted users.
Credit
Reported privately by Afsana Alijabarova (@afa114 https://github.com/afa114), who also supplied reproduction steps, patch suggestions, and a corrected severity assessment for Issue 1 before we had begun triage.
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 |
|---|---|---|---|---|
Packagistawcodes/filament-curator |
Corregida | 3.7.11, 4.2.1, 5.3.2 | — | — |
3.7.114.2.15.3.2Arsenal público
Sin exploits, módulos ni PoC públicos conocidos a la fecha de verificación.
https://github.com/awcodes/filament-curator/security/advisories/GHSA-3xm3-q2fj-x8rqLas referencias externas se muestran para copiar: cve.llama.ec no lo redirige a otros sitios.
