Summary
OpenEMR's portal payment page has an authorization flaw that can let low-privilege authenticated users bypass billing access checks by changing patient identifiers. Depending on the affected workflow, this may expose payment pages and allow fraudulent receipts to be recorded for other patients.
Affected context
The issue is described in OpenEMR's portal/portal_payment.php payment workflow. It arises when access to a patient's payment page or receipt actions is not reliably checked against the authenticated user's permissions and the patient identified by request parameters such as pid and form_pid.
Exploit preconditions
- Attack surface: The OpenEMR portal payment page
- Required access: An authenticated account with low-level portal access
- Trigger point: A payment-page request that uses patient identifiers supplied in request parameters
- Why exploitation is possible: The billing ACL checks may not adequately verify that the authenticated user is authorized for the patient identified by the modified parameters
Why this happens
This is an object-level authorization failure associated with CWE-639: Authorization Bypass Through User-Controlled Key. The application appears to rely on client-supplied patient identifiers without consistently enforcing authorization for the corresponding patient and payment operation. Identifiers are references, not proof of permission; each request must be checked against the user's access rights.
Potential impact
- An attacker may view payment pages for patients they are not authorized to access.
- An attacker could create fraudulent payment receipts for other patients.
- Billing records may be corrupted, complicating reconciliation and care administration.
- Unauthorized access to payment information could affect patient privacy and trust.
General mitigation guidance
Defensive designs commonly enforce authorization on the server for every patient-specific read and write operation.
Useful patterns include:
- Derive the permitted patient scope from the authenticated session where possible rather than trusting request identifiers.
- Check the user's billing permissions against the specific patient and requested action on every request.
- Treat all client-supplied identifiers as untrusted and validate them against server-side authorization rules.
- Apply least privilege to portal roles and separate permission to view payment details from permission to create or modify receipts.
- Use secure-by-default denial when authorization cannot be established, and keep auditable records of sensitive billing changes.
How teams detect issues like this
- Review payment routes for authorization checks that use only authentication or role membership without checking access to the specific patient record.
- Use static analysis or code review to trace
pidandform_pidfrom request input to patient lookup and payment operations. - Add policy and regression tests that verify unauthorized patient identifiers cannot be used to view payment pages or record receipts.
- Monitor for unusual patterns, such as one account accessing payment pages or submitting receipts for many unrelated patients.
- Automated code review tools may help flag missing object-level authorization checks.

