Summary
OpenEMR's Carecoordination module improperly processes CCDA documents with XML XInclude directives, allowing authenticated users to reference local files on the server.
By uploading a crafted CCDA file containing XInclude elements, an attacker can cause the application to disclose arbitrary server-side files that are readable by the OpenEMR process.
Affected context
The vulnerability exists in OpenEMR deployments where:
- The Carecoordination module is enabled and used to upload/import CCDA documents.
- The XML parser handling CCDA input is configured with XInclude support (or equivalent external resource resolution).
- Uploaded CCDA files are processed server-side without restricting or sanitizing XInclude directives.
Under these conditions, specially crafted CCDA uploads can cause the application to read local files from the server's filesystem.
Exploit preconditions
- Attack surface: HTTP(S) interface exposing the Carecoordination CCDA upload functionality.
- Required access: Valid, authenticated OpenEMR account with permission to access the Carecoordination module and upload CCDA documents.
- Trigger point: Submission of a malicious CCDA file that includes an
xi:includeelement with afile://URL referencing a local path (for example,/etc/passwd). - Why exploitation is possible: The XML processing pipeline for CCDA documents allows XInclude resolution against local filesystem URIs without enforcing secure parsing options that disable external resource access, as described by CWE-611.
Why this happens
At its core, this is an XML External Entity / XInclude processing issue where untrusted XML content is parsed with features that allow loading external resources.
The CCDA parser in the Carecoordination module accepts user-supplied XML and resolves xi:include directives against the local filesystem.
Because the application does not disable or constrain XInclude/file URL handling, an attacker-controlled CCDA file can cause the server-side XML parser to open arbitrary files accessible to the OpenEMR process.
This matches CWE-611: Improper Restriction of XML External Entity Reference, extended here to include unsafe XInclude behavior.
Potential impact
- Disclosure of sensitive configuration files (e.g., application configs, credentials, keys) that are readable by the OpenEMR service account.
- Exposure of system-level information, such as
/etc/passwdand other OS files, aiding in further attacks. - Leakage of other tenant or patient-related data stored in files on the same server, depending on file paths and permissions.
- Facilitation of follow-on attacks such as privilege escalation, credential reuse, or lateral movement within the environment.
General mitigation guidance
Effective mitigation focuses on hardening XML parsing and strictly controlling how external resources are handled:
- Configure XML parsers used for CCDA processing to disable XInclude, external entity resolution, and any
file://or network-based resource loading by default. - Use dedicated "secure XML" configurations or libraries that provide safe defaults for parsing untrusted healthcare data formats like CCDA.
- Perform strict validation of CCDA documents against expected schemas, rejecting documents that contain unexpected namespaces or elements such as
xi:include. - Isolate application components that must parse complex XML in processes or containers with minimal filesystem access and least privilege.
- Limit filesystem exposure by ensuring the application account has only the permissions it requires and no access to sensitive system or credential files.
How teams detect issues like this
Detection typically involves examining both code and runtime behavior:
- Static analysis/code review:
- Look for XML parsers instantiated without secure settings (e.g., XInclude enabled, external entities allowed, unrestricted URI resolvers).
- Flag usage patterns that enable XInclude or entity resolution on user-supplied XML (CCDA or other medical standards).
- Review CCDA processing paths specifically for trust boundaries: any place where uploaded XML is parsed should be checked for secure parser configuration.
- Dynamic and runtime monitoring:
- Monitor application logs and system audit trails for unusual file access patterns originating from the OpenEMR process, particularly to configuration or system files during CCDA imports.
- Inspect web server and application logs for repeated or anomalous CCDA uploads and error messages from XML parsing components.
- Security testing:
- Include XXE/XInclude test cases in application security testing for all XML-consuming endpoints, using automated tools or tailored scripts to verify that external resource loading is blocked.

