Summary
OpenEMR contains a missing authorization check in diagnosis_full.php that can let an authenticated user delete or clear billing records belonging to other patients. The issue is risky when a user can submit another record's ID to the affected action without a check that the record is within their authorization scope.
Affected context
The vulnerability affects OpenEMR installations before 8.5.0 in the billing-record handling path in diagnosis_full.php. It may be present when the application accepts a billing record ID from a request and processes delete or clear actions without verifying that the authenticated user is authorized to modify that specific record.
Exploit preconditions
- Attack surface: The OpenEMR application endpoint handling billing-record actions
- Required access: An authenticated account able to reach the affected functionality
- Trigger point: A delete or clear request processed with a target billing record ID
- Why exploitation is possible: The application reportedly does not enforce authorization against the specific record identified by the supplied ID
Why this happens
The underlying issue is a missing object-level authorization check. The application uses a user-controlled record identifier to select a billing record but does not adequately verify the user's permission to modify that record. This maps to CWE-639: Authorization Bypass Through User-Controlled Key, a form of insecure direct object reference.
Potential impact
- Authenticated users may be able to deactivate charges belonging to other patients.
- Billing and financial records could be corrupted or become inaccurate.
- Organizations may face disrupted billing workflows and costly record reconciliation.
- Patient-related financial information may be affected, depending on how records are handled.
General mitigation guidance
Defensive design generally requires checking authorization for every requested object and action, rather than relying on authentication or a record ID alone.
Common patterns include:
- Applying server-side, object-level permission checks before delete or clear operations.
- Scoping record lookups to the authenticated user's permitted patients or organizational context.
- Denying access by default when ownership or authorization cannot be established.
- Limiting account privileges and separating billing roles according to operational need.
- Recording sensitive billing changes in auditable logs and supporting review or recovery.
How teams detect issues like this
Detection can focus on whether every record-level mutation is preceded by an authorization check tied to the specific record and requested action.
- Use static analysis or code review to identify request-controlled identifiers used in update, delete, or clear operations.
- Review endpoint tests for attempts to modify records outside the user's authorized scope.
- Apply policy checks requiring object-level authorization for sensitive data mutations.
- Monitor audit logs for unusual patterns of billing-record changes across patients.

