Summary
OpenEMR contains a missing authorization check in a billing endpoint, allowing an authenticated user to access billing records beyond their authorized scope. By changing an encounter identifier, a user may read patient and billing information or make billing changes to another patient's account.
Affected context
The issue is in OpenEMR's interface/billing/sl_eob_invoice.php endpoint and affects billing operations associated with encounters. It becomes risky when the endpoint accepts a user-controlled encounter identifier without verifying that the authenticated user is authorized to access or modify the corresponding patient account.
Exploit preconditions
- Attack surface: OpenEMR billing functionality exposed through the application
- Required access: An authenticated account able to reach the affected endpoint
- Trigger point: A request to the endpoint containing an encounter identifier
- Why exploitation is possible: The identifier can be changed, and authorization is not adequately checked against the requested encounter and operation
Why this happens
The endpoint relies on a user-controlled identifier to select a billing record without enforcing authorization for that specific record. This is an object-level access control failure associated with CWE-639: Authorization Bypass Through User-Controlled Key. Authentication establishes who the user is, but does not by itself establish permission to read or modify every encounter.
Potential impact
- An authenticated user may be able to view patient names and billing notes for other accounts.
- Billing payments or adjustments could be submitted against unauthorized accounts.
- Billing entries or notes could be modified or deleted without appropriate authorization.
- Unauthorized changes could affect billing accuracy, patient privacy, and auditability.
General mitigation guidance
Defensive patterns focus on enforcing authorization for each requested object and operation:
- Check the authenticated user's permissions against the specific encounter and patient account on every read or write.
- Treat client-supplied identifiers as untrusted selectors, not proof of authorization.
- Apply the same authorization policy to payment, adjustment, deletion, and note operations.
- Use least-privilege roles and deny access by default when ownership or permission cannot be established.
- Keep authorization checks close to data access and record security-relevant changes in an auditable manner.
How teams detect issues like this
Review billing handlers for queries or updates that use request-supplied identifiers without a corresponding per-record authorization check. Static analysis and code review can look for direct use of parameters such as id in data access paths, especially where read and write operations have inconsistent checks. Test access policies across roles and records, and use application policies to require authorization before patient billing data is returned or changed. Automated review tools may help identify these patterns.

