-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA256 NEFARIOUSPLAN-CANONICAL-V1 {"body_md":"## The dispatcher routes by method name\n\nThe Fax/SMS module's entry point is `interface/modules/custom_modules/oe-module-faxsms/index.php`. Every request to that path runs through `AppDispatch::__construct()`, which calls `dispatchActions()`:\n\n```php\nprivate function dispatchActions(): void\n{\n $action = $this->getQuery('_ACTION_COMMAND');\n $route = explode('/', ($action ?? ''));\n $serviceType = $this->getQuery('type');\n if (count($route ?? []) === 2) {\n $serviceType = $route[0];\n $action = $route[1] ?: $action;\n }\n // ... service-type plumbing ...\n if ($action) {\n if (method_exists($this, $action)) {\n $this->setResponse(\n call_user_func(array($this, $action), array())\n );\n } else {\n $this->setHeader(\"HTTP/1.0 404 Not Found\");\n die(xlt(\"Requested\") . ' ' . text($action) . ' ' . xlt(\"or service is not found.\"));\n }\n }\n}\n```\n\n`method_exists($this, $action)` is the entire dispatch table. Any public method whose name a caller can guess and supply in `_ACTION_COMMAND` is reachable. No allowlist, no decorator, no annotation, no `@route` marker. The arguments passed are `array()`, so methods that read their inputs from the global request via `$this->getRequest(...)` work fine; methods that declare formal parameters get nulls and usually error.\n\nThe abstract base class declares:\n\n```php\nabstract function authenticate(): string|int|bool;\n```\n\nwith a docblock that reads, verbatim:\n\n> Each service client must implement its own authenticate() method.\n> This is where we decide if the user has the right to use the client\n> service based on specific criteria required for its type, vendor and API.\n> At minimum, a specific ACL should be checked with\n> verifyAcl($sect = 'patients', $v = 'docs', $u = ''): bool.\n\nThe contract is that each implementer of the abstract class will, inside each method exposed to the dispatcher, call its own `authenticate()` and branch on the return. The contract is a docblock. The dispatcher does not read docblocks.\n\n## `disposeDocument` is one of the twenty-three\n\nHere is the vulnerable method as it shipped through 7.0.3.4, in `interface/modules/custom_modules/oe-module-faxsms/src/Controller/EtherFaxActions.php`:\n\n```php\npublic function disposeDocument(): string\n{\n $response = ['success' => false, 'message' => '', 'url' => ''];\n $where = $this->getRequest('file_path') ?? $this->getSession('where');\n\n if (empty($where)) {\n die(xlt('Problem with download. Use browser back button'));\n }\n\n $content = $this->getRequest('content', '');\n $action = $this->getRequest('action');\n\n if ($action == 'download') {\n $this->sendFile($where);\n sleep(2);\n unlink($where);\n exit;\n }\n // ... setup branch elided ...\n}\n\nprivate function sendFile(string $filePath): void\n{\n ob_end_clean();\n header(\"Cache-Control: public\");\n header(\"Content-Description: File Transfer\");\n header(\"Content-Disposition: attachment; filename=\" . basename($filePath));\n header(\"Content-Type: application/pdf\");\n header(\"Content-Transfer-Encoding: binary\");\n header('Content-Length: ' . filesize($filePath));\n\n readfile($filePath);\n exit;\n}\n```\n\nThe exploit chain is a single authenticated GET request:\n\n```http\nGET /interface/modules/custom_modules/oe-module-faxsms/index.php\n ?site=default\n &type=fax\n &_ACTION_COMMAND=disposeDocument\n &file_path=/etc/passwd\n &action=download\nCookie: PHPSESSID=\n```\n\nThe dispatcher reads `_ACTION_COMMAND=disposeDocument`, calls `method_exists($this, 'disposeDocument')`, gets true, and dispatches. The method reads `file_path` from `$_REQUEST` via `getRequest`. The method does not call `authenticate()`. It does not call `verifyAcl()`. There is no path canonicalization, no allowed-root check, no extension check, no per-caller ownership lookup. The only effective gate on `$where` is the implicit one inside `sendFile`'s `filesize()` and `readfile()` calls: the path has to resolve to a file the web server's user can read.\n\nThen `readfile()` runs. Then `unlink()` runs.\n\n## `file_exists()` is the entire authorization decision\n\nThis is **existence-is-authorization**: the handler is given a caller-supplied identifier (an absolute path string), checks that the named resource is reachable (the file exists and is readable as the web user), and treats the reachability as the authorization decision. The path is the credential. The file system's read permissions for the `www-data` user are the access-control list.\n\nThe pattern shipped a sibling instance a month ago in [Divi Form Builder](/posts/divi-form-builder-cve-2026-5118-administrator-existed): a role-creation handler whose entire authorization check was `isset($wp_roles->roles[$role])`. `administrator` existed on every WordPress install in the world, and the existence was the gate.\n\nOpenEMR's `disposeDocument` is the file-system-walked variant. The space the caller can enumerate is not WordPress roles; it is the absolute path space of the web server's filesystem. `/etc/passwd` exists on every Linux install. `sites/default/sqlconf.php` exists on every OpenEMR install. The fact that the file is readable as `www-data` is the entire authorization check.\n\n## The session was the trusted channel. The trusted channel was the operand to the right of `??`.\n\nRead the right-hand side of the assignment:\n\n```php\n$where = $this->getRequest('file_path') ?? $this->getSession('where');\n```\n\nThree methods up in the same file, `viewFax()` writes a freshly downloaded fax to `{$faxStoreDir}/Fax_{$docId}.pdf` and pins the path into the session with `$this->setSession('where', $file_name)`. The intended flow is: a user clicks \"view fax\", `viewFax()` (which does call `authenticate()`) fetches the fax from the EtherFax API, writes the bytes to a fax-store directory, pins the path into the session, then renders a UI with a \"download\" button. The button POSTs back to `disposeDocument`, which reads the session-pinned path and serves it, then unlinks it. The function's name describes the second half of the legitimate flow: dispose of, as in clean up, the freshly downloaded fax.\n\nThe session is the trusted channel. It was written by a producer that itself called `authenticate()`. The request parameter is the bypass.\n\nPHP's `??` operator returns its left operand if non-null, otherwise its right. The developer wrote `getRequest('file_path') ?? getSession('where')` and read it as \"use the request value if the caller passed one, otherwise use the session value the producer pinned.\" Both halves of that reading are accurate. Both halves of that reading also mean the same thing: the request always wins.\n\nRun the legitimate UI flow, with `viewFax` having pinned `Fax_42.pdf` into the session, then have the caller submit a forged GET that supplies `file_path=/etc/passwd`. The session value is irrelevant. The request operand resolves first. The trusted channel was the operand the developer wrote as the default, and the default does not matter when the caller controls the operand to its left.\n\n## The PoC is operator-flavored, not scanner-flavored\n\nThe published exploit, `doany1/CVE-2026-24849`, is a single-target Python tool with an interactive read loop. The login routine handles CSRF priming and the cookie-jar quirks of OpenEMR's session-ID rotation. The session-validation routine probes a specific path before doing anything destructive:\n\n```python\n# Confirm auth + that the vulnerable module is reachable by reading a\n# safe, root-owned probe file (its unlink() fails, so it is not deleted).\n_, status = read_file(sess, target, site, \"/etc/hostname\")\n```\n\n`/etc/hostname` is root-owned and its parent directory is not writable as `www-data`, so the post-read `unlink()` fails silently. The author chose a probe file specifically so the confirmation step would not delete a fax document by accident. The README's destructive-behaviour warning makes the operator's safety check explicit:\n\n> `disposeDoc()` calls `unlink($where)` **after** reading the file. Reading a file the web-server user is allowed to delete **will remove it**. Target **root-owned** files (e.g. `/etc/passwd`, `sqlconf.php` on most installs) their parent directory isn't writable by the web user, so the `unlink()` fails and the file survives. Be deliberate about what you point this at.\n\nThe exploit author had to read the function name to know what to warn the operator about. The function is named after what it does. It disposes of documents. It will dispose of `sites/default/documents/00001/scan_2024.pdf` on the way out, because the documents directory is writable as `www-data`, and the patient document goes with the read.\n\nThe PoC's interactive loop, the credentials-bad versus module-not-enabled discrimination, the cookie-jar discipline, the probe-then-loot sequence, the single-target flow: this is a tool built for an operator camping on a specific OpenEMR install. The disclaimer at the bottom of the README is theater. The structure of the tool is the testimony.\n\n## The patch closes the CVE. It does not close the dispatcher.\n\nThe 7.0.4 patch on `disposeDocument` adds three layers because the original had zero:\n\n```diff\n public function disposeDocument(): string\n {\n+ if (!$this->authenticate()) {\n+ http_response_code(403);\n+ return json_encode(['success' => false, 'message' => xlt('Unauthorized')]);\n+ }\n+\n $response = ['success' => false, 'message' => '', 'url' => ''];\n- $where = $this->getRequest('file_path') ?? $this->getSession('where');\n+ $where = (string)($this->getRequest('file_path') ?? $this->getSession('where') ?? '');\n\n if (empty($where)) {\n- die(xlt('Problem with download. Use browser back button'));\n+ return json_encode(['success' => false, 'message' => xlt('No file path specified')]);\n }\n+ $allowedRoot = realpath($this->baseDir) ?: $this->baseDir;\n+ $targetPath = $this->normalizePath($where);\n+\n+ if (!$this->isPathAllowed($targetPath, $allowedRoot)) {\n+ error_log(\"SECURITY: Fax disposeDocument path violation: {$targetPath}\");\n+ http_response_code(403);\n+ return json_encode(['success' => false, 'message' => xlt('Access denied')]);\n+ }\n```\n\nLayer one is the `authenticate()` call the abstract base class always documented as required. Layer two is path confinement: `isPathAllowed(targetPath, realpath($this->baseDir))` confines the operation to the module's own fax-store root. Layer three, in the setup branch, is an extension allowlist of `pdf`, `tif`, `tiff`, `txt`.\n\nThe same audit on the patched class still shows the dispatcher exposing methods that do not call `authenticate()`. `forwardFax` (which calls `$this->client->sendFax(...)` with a phone number and content from the request), `sendSMS`, `chartDocument`, `chartFaxDocument`, `getNotificationLog`, `getCallLogs`, `setFaxDeleted`, and `sendEmail` are still reachable through `_ACTION_COMMAND` against an authenticated session, each takes attacker-controlled request parameters, and each is exactly what the abstract base class's docblock was telling the implementer to gate. The dispatcher in 7.0.4 still routes by `method_exists`. The contract still lives in the docblock.\n\nCVE-2026-24849 is the implementer of the abstract `AppDispatch` class forgetting to write four lines at the top of `disposeDocument`. The fix is to write the four lines. The pattern that admits the same forgetting at every other method on the class, on every other class that extends `AppDispatch`, on every other public method any future maintainer adds to either, is the framework's decision to dispatch by name and document the gate as a per-implementer convention.\n\nA docblock cannot enforce a contract. A method-name dispatcher cannot infer one.\n\nPoC: [doany1/CVE-2026-24849](https://github.com/doany1/CVE-2026-24849)","closing_line":"The patch added `authenticate()` to `disposeDocument`. The contract that every method authenticates was a docblock. The dispatcher does not read docblocks.","hook_md":"OpenEMR's Fax/SMS module ships a class called `EtherFaxActions` that extends an abstract base class called `AppDispatch`. The base class declares `abstract function authenticate(): string|int|bool;` with a docblock reading \"Each service client must implement its own authenticate() method... At minimum, a specific ACL should be checked with verifyAcl().\" Twenty-three of the twenty-seven public methods on `EtherFaxActions` never call `authenticate()`. The dispatcher routes by method name.\n\nCVE-2026-24849 names one of the twenty-three.","post_id":575,"slug":"openemr-faxsms-cve-2026-24849-dispatcher-routes-by-method-name","title":"CVE-2026-24849: OpenEMR's Fax Dispatcher Routes By Method Name. authenticate() Was The Implementer's Choice.","type":"initial","unreadable_sentence":"Twenty-three of the twenty-seven public methods on EtherFaxActions never call authenticate(). The dispatcher routes by method name. CVE-2026-24849 names one of the twenty-three."} -----BEGIN PGP SIGNATURE----- iHUEARYIAB0WIQRf0htP5+SjynlxywneZjl4jgkQJgUCarV91wAKCRDeZjl4jgkQ JvmYAQDgDZyasmz8GyVZWjYc+7DNF2A6KEZS8FeJY7coLXxP2AEA9M6kDj9G+SSh GD3gKUp0DqLOqaE9TJXXCjcwZNGOJgQ= =nU5C -----END PGP SIGNATURE-----