/

CVE-2026-24848

Severity:

CRITICAL RISK

(9.9)

Path Traversal File Write in OpenEMR EtherFax Document

CVE-2026-24848

Analyzed

Vulnerability type

Category:

Path Traversal / Arbitrary File Write

CWE:

CWE-22

Impact:

Remote Code Execution via Arbitrary File Write

Severity:

CRITICAL RISK

(9.9)

CVSS version:

3.1

Catch this CVE while code is being written

Detect vulnerable code directly in pull requests, so CVEs are fixed before merge.

Summary

OpenEMR's EtherFax document disposal functionality allows authenticated users to write arbitrary content to arbitrary locations on the server filesystem by abusing the disposeDocument() method.

When combined with the ability to upload PHP files into web-accessible directories, this can enable remote code execution through malicious web shells.

Affected context

This vulnerability occurs in OpenEMR deployments using the EtherFaxActions.php functionality where user-controlled input influences filesystem paths.

It is relevant when authenticated users can trigger disposeDocument() and the web server is configured to execute PHP files from writable directories.

The risk increases in shared or multi-user environments where untrusted or semi-trusted users have application-level accounts with access to document-related actions.

Exploit preconditions

  • Attack surface: HTTP(S) interface of the OpenEMR application, specifically endpoints that invoke EtherFaxActions.php and disposeDocument().
  • Required access: Valid authenticated user account with permissions to perform document disposal or related fax/document actions.
  • Trigger point: Invocation of disposeDocument() with attacker-controlled parameters that determine the destination path and content of written files.
  • Why exploitation is possible: The server trusts user-supplied path or file identifiers without robust normalization and enforcement of allowed directories, enabling path traversal or arbitrary path selection, and it writes attacker-controlled content directly to the filesystem.

Why this happens

The root cause is improper restriction of filesystem path input in disposeDocument(), aligning with CWE-22: Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal').

Instead of strictly constraining file operations to known-safe directories and filenames, the implementation allows user-influenced values to determine where and what is written on disk.

This insecure pattern of combining user-controlled paths with file write operations, without canonicalization and whitelisting, permits arbitrary file placement and content injection.

Potential impact

  • An attacker may upload PHP web shells into web-accessible directories, leading to remote code execution.
  • An attacker could overwrite existing application or configuration files, potentially causing denial of service or altering application behavior.
  • An attacker can create new files containing attacker-controlled data, enabling data exfiltration channels or further pivoting.
  • An attacker may store malicious scripts or binaries on the server filesystem as part of a broader intrusion.

General mitigation guidance

Effective mitigation focuses on constraining filesystem access and decoupling user input from raw paths:

  • Enforce strict allowlists of directories and filenames for any file operations, using server-side mappings from opaque identifiers to canonical paths rather than raw user-supplied paths.
  • Normalize and canonicalize all filesystem paths before use, and verify they remain within a designated application-owned directory tree.
  • Separate data directories from executable code directories so that uploaded or generated files cannot be interpreted as PHP or other executable scripts by the web server.
  • Apply least-privilege file permissions at the OS level so the application process can write only where strictly necessary and cannot modify application code or configuration files.
  • Design document disposal routines to use fixed, server-controlled locations and names, ignoring or heavily restricting any user-controlled path parameters.

How teams detect issues like this

Organizations can detect this class of vulnerability through a combination of review and automated analysis:

  • Static analysis rules looking for file write functions (e.g., file_put_contents, fwrite, fopen in write modes) that directly use request parameters, query variables, or other tainted inputs when building paths.
  • Code review practices that flag any concatenation of user input into filesystem paths, especially within document upload, disposal, or export features.
  • Runtime application logging and monitoring to spot unusual paths in document-related operations, such as attempts to write outside expected directories or with unexpected file extensions.
  • Security testing and QA checklists that include path traversal probes and arbitrary file write scenarios against document and file-handling endpoints.

Sources

SourceLink
github.comgithub.com/openemr/openemr/security/advisories/GHSA-5vp5-4rm6-h4c9

Frequently asked

questions

Yes, if the OpenEMR instance is exposed over the network and an attacker can obtain valid application credentials, they can potentially exploit the vulnerability remotely via the web interface.

Not necessarily. Exploitation requires an authenticated user with access to the relevant EtherFax or document disposal functionality; this may or may not be an administrative role depending on how permissions are configured.

The safest pattern is to completely remove user control over filesystem paths by using server-side mappings and fixed directories, combined with path canonicalization checks and operating system-level restrictions that prevent writing to executable or sensitive locations.

Developers can prevent similar issues by treating all path and filename inputs as untrusted, using strict allowlists, centralizing file-handling utilities with built-in safety checks, separating writable data directories from executable code, and incorporating static analysis and security review for all file I/O features.

Find out what's already
exploitable in your codebase.