Summary
OpenEMR's EOB processing endpoint may use an unsanitized eraname value to access files, allowing an authenticated user to traverse outside the intended directory. Depending on the web user's permissions, this could enable file reads and writes, including creation of ERA report files and processing of arbitrary EDI files.
Affected context
The issue occurs in interface/billing/sl_eob_process.php when the application handles user-supplied eraname values for EOB and ERA processing. It may be present when those values are used to construct file paths without effective canonicalization and containment checks. The described access does not require billing privileges, but does require authentication.
Exploit preconditions
- Attack surface: The authenticated OpenEMR EOB processing endpoint
- Required access: An authenticated account; billing privileges are not required according to the report
- Trigger point: Processing a request that supplies an
eranamevalue used in file operations - Why exploitation is possible: Unsanitized path components may let the requested file path escape its intended directory, subject to the web user's filesystem permissions
Why this happens
The underlying issue is improper limitation of a pathname to a restricted directory, mapped to CWE-22: Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal'). The insecure pattern is using user-controlled path data to select files without reliably resolving the final path and verifying that it remains within an approved directory.
Potential impact
- An authenticated user could read files accessible to the web application account.
- An authenticated user could create or overwrite files in locations writable by that account.
- Arbitrary EDI files could be processed and their contents included in generated HTML reports.
- Resulting files or exposed data could affect application integrity or confidentiality, depending on deployment permissions.
General mitigation guidance
Defensive patterns include avoiding user-controlled path components where possible and mapping user-facing identifiers to server-selected files. When paths are necessary, resolve them to canonical form and enforce containment within a dedicated, approved directory before performing file operations.
Apply strict input validation, separate upload and report storage from application code and other sensitive files, and limit the web process to the minimum filesystem permissions needed. Treat EDI contents as untrusted data and encode them appropriately when generating HTML.
How teams detect issues like this
- Use static analysis to identify file operations whose paths incorporate request parameters or other user-controlled values.
- Review path construction and validation to confirm canonicalization and directory-containment checks occur before reads and writes.
- Enforce code-review or CI policies that flag traversal-prone path handling and unsafe inclusion of file contents in HTML.
- Monitor application and filesystem activity for unexpected file access or report creation outside designated storage locations.

