Summary
OpenEMR's Carecoordination module has an insecure direct object reference (IDOR) that can let authenticated users with send_to_hie permission access patient documents by supplying document or patient IDs. Depending on the operation available, this may expose or alter health records and affect audit records.
Affected context
The issue is described in OpenEMR versions before 8.5.0, in the Carecoordination module's handling of CCDA, CCR, and QRDA documents. It becomes a risk when document or patient identifiers supplied in requests are not adequately checked against the authenticated user's authorization for the corresponding records.
Exploit preconditions
- Attack surface: Carecoordination functionality for accessing, transmitting, or exporting patient documents
- Required access: An authenticated account with
send_to_hiepermission - Trigger point: A request that supplies a patient or document ID
- Why exploitation is possible: If authorization is not verified for the specific record, a user may use identifiers to access or act on records outside their permitted scope.
Why this happens
The underlying issue is an authorization check that does not sufficiently bind a user's permissions to the specific patient or document identified by a request. This is an insecure direct object reference, mapped to CWE-639: Authorization Bypass Through User-Controlled Key. The insecure pattern is trusting an object identifier without confirming that the authenticated user may perform the requested action on that object.
Potential impact
- Patient health records may be accessed, downloaded, transmitted, or exported without proper authorization.
- Clinical data may be falsified or otherwise modified.
- Audit records may be deleted, reducing the reliability of activity tracking.
- Patient confidentiality and the integrity of clinical or audit data could be compromised.
General mitigation guidance
Defensive patterns focus on enforcing authorization for every object-level operation, rather than relying on authentication or a general permission alone.
- Check the user's authorization for the specific patient and document on every read, export, transmission, modification, or deletion.
- Derive record scope from trusted server-side identity and access context where possible; treat client-supplied identifiers as untrusted.
- Apply least privilege to permissions such as
send_to_hie, separating access, transmission, and deletion capabilities where appropriate. - Protect audit records from alteration or deletion by users performing the actions being audited.
- Use secure-by-default access controls and deny operations when record-level authorization cannot be established.
How teams detect issues like this
- Review routes and service methods that accept patient or document IDs, checking that each operation performs object-level authorization.
- Use static analysis or code review checks to flag data access keyed by request-controlled identifiers without a nearby authorization check.
- Test authorization policies across users with different patient scopes and permissions, including read, export, transmission, modification, and deletion actions.
- Enforce policies that require server-side authorization checks for all patient-record operations and protect audit data from unauthorized changes.

