GHSA-G292-GRP6-8QWV
Stored XSS via SVG upload in Documents & Files (served inline as image/svg+xml), introduced in 5.0.16
CVSS:3.1/AV:N/AC:L/PR:L/UI:R/S:C/C:L/I:L/A:N
Fuente: GitHub
Ciclo de vida de la vulnerabilidad
| Fecha | Fase | Evento | Detalle |
|---|---|---|---|
| Divulgación | Publicada | GHSA-G292-GRP6-8QWV divulgada · CVSS 5.4 (GitHub) | |
| Monitoreo | Detectada | Ingresó al índice | |
| Monitoreo | Verificada | Última verificación contra las fuentes |
Summary
Since 5.0.16, a user with upload rights on a Documents & Files folder can upload an `.svg` file. Admidio serves it from the file's view link with `Content-Type: image/svg+xml`, `Content-Disposition: inline`, no `X-Content-Type-Options` and no CSP. A script inside the SVG therefore runs on the Admidio origin for anyone who opens that link. In a public folder, that includes visitors who are not logged in.
Reproduced on the official Docker Hub image `admidio/admidio:v5.0.16` and on `master` @ `7a3e6bf`, with script execution confirmed in headless Chrome on both. Not reproducible on `v5.0.15` or `v5.0.2` (official images), which reject the `.svg` upload.
Details
The problem has two parts:
- Upload accepts SVG (new in 5.0.16). Document uploads (`system/file_upload.php:143-149`) are checked against the extension allow-list `FileSystemUtils::allowedFileExtension()` (`src/Infrastructure/Plugins/UploadHandlerFile.php:65`), which is the keys of `$iconFileExtension`. PR #2144 (merged 2026-09-12) added `svg` to that list (`src/Infrastructure/Utils/FileSystemUtils.php:99` in v5.0.16) with `'viewable' => false`. The PR description says this flag was set "to force download and prevent potential inline script execution (XSS)".
- Download ignores that flag. `src/Documents/Service/DocumentsService.php` `downloadFile()` (line 68; headers at 96-98 in v5.0.16, 85-87 on master) chooses `inline` purely from the `view` request parameter.
- It never calls `File::isViewableInBrowser()`, so the `viewable => false` flag has no effect.
- It sets no `nosniff` header.
- The file list links every file with `view=1` (`src/UI/Presenter/DocumentsPresenter.php:579` in v5.0.16, `:580` on master).
So the protection the PR intended is not in effect. The project previously decided to disallow SVG uploads for exactly this reason (issue #1106, "Disallow upload of svg files because of xss attacks", 2021), so this behaviour is not intended.
### Relation to prior advisories
No published Admidio advisory covers SVG or inline serving of documents. GHSA-95cq-p4w2-32w5 (CVE-2026-32756) is a CSRF-error path that skipped the extension check to write `.php` files (RCE). The documents advisories CVE-2026-47230/47231/47226 and GHSA-m9h6-8pqm-xrhf concern access control and path handling on rename/move/delete/add. This report is an allow-listed type served inline.
Proof of concept
Setup (stock demo data): the folder `documents_demo` is public. As administrator, grant the role "2. Jugendmannschaft" / "2. youth team" the upload right on that folder (folder permissions). The uploader is the demo user `Mitglied` / `Member`: a member of that role and of "Member", with no administrator or documents-administrator role. In the scripted run this grant was written directly as the `adm_roles_rights_data` row (`folder_upload`, role 5, folder 1) that the permissions dialog stores.
- As that user, `POST /system/file_upload.php?module=documents_files&mode=upload_files&uuid=<folder uuid>` with `adm_csrf_token` and `files[]=poc.svg`, where `poc.svg` is `<svg xmlns="http://www.w3.org/2000/svg"><script>document.documentElement.setAttribute("data-ambit","FIRED:"+document.location.origin)</script></svg>`. The response lists the file and has no `error` field.
- `GET /modules/documents-files.php?mode=download&file_uuid=<uuid>&view=1` returns `Content-Type: image/svg+xml` and `Content-Disposition: inline`, with no `X-Content-Type-Options` and no `Content-Security-Policy`, and the script unchanged.
- The same request without any session cookie returns HTTP 200 with the same inline SVG (public folder).
- Opening that URL in headless Chrome with no session runs the script: the rendered DOM carries `data-ambit="FIRED:<Admidio origin>"` (`http://127.0.0.1:8093` for the v5.0.16 instance, `http://127.0.0.1:8091` for master).
Steps 1-4 were executed as written on v5.0.16 (official image) and on master. On v5.0.15 and v5.0.2 (official images), step 1 fails with `SYS_FILE_EXTENSION_INVALID` ("Dateien dieses Dateityps sind auf dem Server nicht erlaubt."), so nothing further happens.
Control and fix: with the patch below applied to v5.0.16 and to master, the same SVG is served `Content-Disposition: attachment` with `X-Content-Type-Options: nosniff`, and headless Chrome does not run the script. A PNG document is still served `inline` as `image/png` both with and without the patch. Reverting the patch restores inline SVG serving. A self-contained reproduction script (fresh local instance, one PASS/FAIL assertion per claim) is available on request.
Impact
Any user who has been given upload rights on a folder (a per-folder, per-role right; demonstrated with a non-administrator role) can store JavaScript that runs on the Admidio origin for anyone who opens the file's view link. In a public folder that includes visitors who are not logged in. Demonstrated: the script executes on the origin. Not separately demonstrated, but the usual consequence of same-origin script: when a logged-in user (for example an administrator) opens the link, the script can make requests as that user.
### Remediation
In `downloadFile()`:
- honour `isViewableInBrowser()`, so types marked not viewable, such as svg, are sent as attachments;
- always send `X-Content-Type-Options: nosniff`.
The patch below is against master `7a3e6bf`; it also applies unchanged (offset +11) to v5.0.16. It passes `php -l` and was verified on both. Optionally, also send a restrictive CSP on file downloads.
diff --git a/src/Documents/Service/DocumentsService.php b/src/Documents/Service/DocumentsService.php
index 9277fb5..2649feb 100644
--- a/src/Documents/Service/DocumentsService.php
+++ b/src/Documents/Service/DocumentsService.php
@@ -75,7 +75,13 @@ class DocumentsService
// determine filesize
$fileSize = filesize($completePath);
- if ($inline) {
+ // Only serve inline when the file type is a browser-safe type to display (the
+ // 'viewable' flag in FileSystemUtils). Types such as SVG carry active content
+ // (image/svg+xml can embed <script>) and MUST NOT be rendered inline on the
+ // Admidio origin, or an upload-right holder can store same-origin XSS. Anything
+ // not explicitly viewable is forced to a download, and content-type sniffing is
+ // disabled so the browser cannot re-interpret an attachment as active content.
+ if ($inline && $file->isViewableInBrowser()) {
$content = 'inline';
} else {
$content = 'attachment';
@@ -83,6 +89,7 @@ class DocumentsService
// Create appropriate header information of the file
header('Content-Type: ' . $file->getMimeType());
+ header('X-Content-Type-Options: nosniff');
header('Content-Length: ' . $fileSize);
header('Content-Disposition: ' . $content . '; filename="' . $file->getValue('fil_name') . '"');
I would appreciate a CVE being requested for this issue.
### Credits
Please credit as: Dylan McGuinness (GitHub @dylanzonix), Ambit Security (finder, reporter).
Incluye detalles técnicos publicados por el investigador. Úselos solo para validar y corregir sus propios sistemas.
Desglose de métricas
Versiones afectadas
5.0.16Estado del parche por paquete
| Paquete / producto | Estado | Corregida en | Desde divulgación | Última versión |
|---|---|---|---|---|
Packagistadmidio/admidio |
Sin parche | — | — | — |
Arsenal público
Sin exploits, módulos ni PoC públicos conocidos a la fecha de verificación.
https://github.com/Admidio/admidio/security/advisories/GHSA-g292-grp6-8qwvLas referencias externas se muestran para copiar: cve.llama.ec no lo redirige a otros sitios.
