The dispatcher routes by method name
The 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():
private function dispatchActions(): void
{
$action = $this->getQuery('_ACTION_COMMAND');
$route = explode('/', ($action ?? ''));
$serviceType = $this->getQuery('type');
if (count($route ?? []) === 2) {
$serviceType = $route[0];
$action = $route[1] ?: $action;
}
// ... service-type plumbing ...
if ($action) {
if (method_exists($this, $action)) {
$this->setResponse(
call_user_func(array($this, $action), array())
);
} else {
$this->setHeader("HTTP/1.0 404 Not Found");
die(xlt("Requested") . ' ' . text($action) . ' ' . xlt("or service is not found."));
}
}
}
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.
The abstract base class declares:
abstract function authenticate(): string|int|bool;
with a docblock that reads, verbatim:
Each service client must implement its own authenticate() method.
This is where we decide if the user has the right to use the client
service based on specific criteria required for its type, vendor and API.
At minimum, a specific ACL should be checked with
verifyAcl($sect = 'patients', $v = 'docs', $u = ''): bool.
The 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.
disposeDocument is one of the twenty-three
Here is the vulnerable method as it shipped through 7.0.3.4, in interface/modules/custom_modules/oe-module-faxsms/src/Controller/EtherFaxActions.php:
public function disposeDocument(): string
{
$response = ['success' => false, 'message' => '', 'url' => ''];
$where = $this->getRequest('file_path') ?? $this->getSession('where');
if (empty($where)) {
die(xlt('Problem with download. Use browser back button'));
}
$content = $this->getRequest('content', '');
$action = $this->getRequest('action');
if ($action == 'download') {
$this->sendFile($where);
sleep(2);
unlink($where);
exit;
}
// ... setup branch elided ...
}
private function sendFile(string $filePath): void
{
ob_end_clean();
header("Cache-Control: public");
header("Content-Description: File Transfer");
header("Content-Disposition: attachment; filename=" . basename($filePath));
header("Content-Type: application/pdf");
header("Content-Transfer-Encoding: binary");
header('Content-Length: ' . filesize($filePath));
readfile($filePath);
exit;
}
The exploit chain is a single authenticated GET request:
GET /interface/modules/custom_modules/oe-module-faxsms/index.php
?site=default
&type=fax
&_ACTION_COMMAND=disposeDocument
&file_path=/etc/passwd
&action=download
Cookie: PHPSESSID=<any-valid-openemr-session>
The 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.
Then readfile() runs. Then unlink() runs.
file_exists() is the entire authorization decision
This 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.
The pattern shipped a sibling instance a month ago in Divi Form Builder: 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.
OpenEMR'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.
The session was the trusted channel. The trusted channel was the operand to the right of ??.
Read the right-hand side of the assignment:
$where = $this->getRequest('file_path') ?? $this->getSession('where');
Three 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.
The session is the trusted channel. It was written by a producer that itself called authenticate(). The request parameter is the bypass.
PHP'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.
Run 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.
The PoC is operator-flavored, not scanner-flavored
The 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:
# Confirm auth + that the vulnerable module is reachable by reading a
# safe, root-owned probe file (its unlink() fails, so it is not deleted).
_, status = read_file(sess, target, site, "/etc/hostname")
/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:
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.
The 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.
The 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.
The patch closes the CVE. It does not close the dispatcher.
The 7.0.4 patch on disposeDocument adds three layers because the original had zero:
public function disposeDocument(): string
{
+ if (!$this->authenticate()) {
+ http_response_code(403);
+ return json_encode(['success' => false, 'message' => xlt('Unauthorized')]);
+ }
+
$response = ['success' => false, 'message' => '', 'url' => ''];
- $where = $this->getRequest('file_path') ?? $this->getSession('where');
+ $where = (string)($this->getRequest('file_path') ?? $this->getSession('where') ?? '');
if (empty($where)) {
- die(xlt('Problem with download. Use browser back button'));
+ return json_encode(['success' => false, 'message' => xlt('No file path specified')]);
}
+ $allowedRoot = realpath($this->baseDir) ?: $this->baseDir;
+ $targetPath = $this->normalizePath($where);
+
+ if (!$this->isPathAllowed($targetPath, $allowedRoot)) {
+ error_log("SECURITY: Fax disposeDocument path violation: {$targetPath}");
+ http_response_code(403);
+ return json_encode(['success' => false, 'message' => xlt('Access denied')]);
+ }
Layer 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.
The 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.
CVE-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.
A docblock cannot enforce a contract. A method-name dispatcher cannot infer one.
PoC: doany1/CVE-2026-24849