GHSA-X36C-M2CV-M5VW
Arbitrary server file read via `<img src>` in the eCard message (any logged-in member)
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-X36C-M2CV-M5VW divulgada · CVSS 6.5 (GitHub) | |
| Monitoreo | Detectada | Ingresó al índice | |
| Monitoreo | Verificada | Última verificación contra las fuentes |
Summary
When a member sends an eCard, Admidio takes every `<img src="...">` in the message body, converts it to a local filesystem path, and reads that file into the outgoing mail with PHPMailer's `addEmbeddedImage()`. Nothing restricts which paths can be read. Any logged-in member can therefore have the server read any file the web server can read and email its contents to the member's own account. In testing, a user whose only role is "Member" received `adm_my_files/config.php` (including the database password) and `/etc/passwd` this way.
Reproduced on the official Docker Hub images `admidio/admidio:v5.0.16`, `v5.0.15` and `v5.0.2`, and on `master` @ `7a3e6bf`.
Details
In `src/Photos/ValueObject/ECard.php`, `sendEcard()` (lines 174-208 in v5.0.16, 174-210 on master), each `src` taken from the message HTML goes through `StringUtils::strMultiReplace` (THEME_URL becomes THEME_PATH, ADMIDIO_URL becomes ADMIDIO_PATH) and is then passed to `$email->addEmbeddedImage($imgServerPath, ...)`.
- An absolute path is left unchanged by that replacement and read verbatim.
- There is no allow-list, `realpath` containment, or traversal check.
- PHPMailer's own base-directory guard from `msgHTML()` never runs, because `addEmbeddedImage()` is called directly.
The `ecard_message` field is purified with HTMLPurifier's default config, which keeps `<img>` with an absolute `src`. The purified value is what reaches `sendEcard()` (v5.0.16 `modules/photos/ecard_send.php:156,198`; master `modules/photos.php:302`), so the attack does not depend on any sanitizer bypass.
The code comment above the loop says the images are "extracted from the template so that they can be sent as attachments", i.e. the feature exists to embed the template and album images. I found no documentation or issue describing embedding other server files; a search of the issue tracker for eCard/image embedding returned nothing related, so I believe this behaviour is unintended.
In the PoC the recipient is the sender's own account (it is offered in the recipient list), so the mail is delivered to the email address on the attacker's own profile.
### Relation to prior advisories
- GHSA-m3vp-3jjm-gpmx (CVE-2026-41655, fixed in 5.0.9) is a traversal in the `ecard_template` filename. This report is about the message body's `<img src>` and the `addEmbeddedImage` sink, a different parameter and sink; it reproduces on 5.0.15 and 5.0.16, which contain that fix.
- GHSA-4wr4-f2qf-x5wj (CVE-2026-32757, fixed in 5.0.7) was the raw, unpurified `ecard_message` being used. This report works with the purified message: it reproduces on 5.0.15, 5.0.16 and master, where the purified value is used.
Proof of concept
The attacker is logged in as a user whose only role is the default "Member" (demo data user, organisation DEMO). The endpoint differs by version:
| Version | Form (provides `adm_csrf_token`) | Send |
|---|---|---|
| v5.0.2, v5.0.15, v5.0.16 | `GET /modules/photos/ecards.php?photo_uuid=<album>&photo_nr=1` | `POST /modules/photos/ecard_send.php` |
| master @ 7a3e6bf | `GET /modules/photos.php?mode=ecard&photo_uuid=<album>&photo_nr=1` | `POST /modules/photos.php?mode=ecard_send` |
The send request body is the same on all versions:
adm_csrf_token=<token> photo_uuid=<any visible album> photo_nr=1 ecard_template=postcard.tpl
ecard_recipients[]=<attacker's own user uuid>
ecard_message=<p>a<img src="/opt/app-root/src/adm_my_files/config.php">b<img src="/etc/passwd"></p>(`/opt/app-root/src` is the install path in the official Docker image.)
The response is `{"status":"success",...}`. The mail is addressed to the attacker's own profile email. It contains two inline parts named `config.php` and `passwd`; decoded, they are the Admidio config (including `$g_adm_pw`) and `/etc/passwd` (`root:x:0:0:...`).
Controls (each run on every version above):
- With `src="https://example.com/x.png"`, the response is `{"status":"error"}` with a message naming the URL ("Could not access file: https://example.com/x.png" on master; the same message in German, "Zugriff auf folgende Datei fehlgeschlagen: ...", on the v5.0.x demo organisation), and nothing is read from disk.
- An eCard with a plain message still sends, and the album photo is embedded as an image part.
With the patch below applied (to the files of the official v5.0.16 and v5.0.2 images, and to master), neither secret file is embedded, the plain eCard still sends and the album photo is still embedded. Reverting the patch restores the file read. A self-contained reproduction script (fresh local instance, one PASS/FAIL assertion per claim) is available on request.
Impact
Any logged-in member can read files that the web server user can read. Demonstrated: the database credentials in `adm_my_files/config.php` and `/etc/passwd`. Not demonstrated, but follows from the disclosed credentials where the database is reachable: access to the whole Admidio database. Only reading files was demonstrated; nothing was modified.
### Remediation
Embed only files whose `realpath` lies inside `adm_my_files/photos` or the active theme directory. The patch below is against master `7a3e6bf`; it also applies unchanged (offset -2) to v5.0.16 and v5.0.2. It passes `php -l`, blocks both files, and keeps legitimate eCards working.
diff --git a/src/Photos/ValueObject/ECard.php b/src/Photos/ValueObject/ECard.php
index f01d066..dd60b6a 100644
--- a/src/Photos/ValueObject/ECard.php
+++ b/src/Photos/ValueObject/ECard.php
@@ -204,8 +204,28 @@ class ECard
$imageSized->copyToFile(null, $imgServerPath);
}
+ // Only embed files that physically reside in the ecard photo folder or the
+ // theme directory. Without this check an attacker can put an arbitrary local
+ // path (e.g. "/etc/passwd" or the adm_my_files/config.php that holds the DB
+ // credentials) into an <img src> of the message and have it read from disk and
+ // base64-encoded into the outgoing mail.
+ $allowedRoots = array(
+ realpath(ADMIDIO_PATH . FOLDER_DATA . '/photos'),
+ defined('THEME_PATH') ? realpath(THEME_PATH) : false
+ );
+ $realImgPath = realpath($imgServerPath);
+ $imageAllowed = false;
+ if ($realImgPath !== false) {
+ foreach ($allowedRoots as $allowedRoot) {
+ if ($allowedRoot !== false && str_starts_with($realImgPath, $allowedRoot . DIRECTORY_SEPARATOR)) {
+ $imageAllowed = true;
+ break;
+ }
+ }
+ }
+
// Attach the picture to the mail
- if ($imgName !== 'none.jpg' && $imgName !== '') {
+ if ($imageAllowed && $imgName !== 'none.jpg' && $imgName !== '') {
$cid = md5(uniqid($imgName . time(), true));
$result = $email->addEmbeddedImage($imgServerPath, $cid, $imgName, 'base64', 'image/' . $imgType);
if ($result) {I would appreciate a CVE being requested for this issue.
### Credits
Please credit as: Dylan McGuinness, 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
Rangos afectados
Estado 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-x36c-m2cv-m5vwLas referencias externas se muestran para copiar: cve.llama.ec no lo redirige a otros sitios.
