Summary
OpenEMR's portal-login credential update flow may allow a low-privilege authenticated user to replace a patient's portal credentials without the required authorization checks. If the user can select a victim patient in the session and submit replacement credentials, they could take over that portal account, access protected health information, or prevent the patient from signing in.
Affected context
The issue is in create_portallogin.php in OpenEMR versions before 8.5.0. It may affect deployments where this credential replacement flow is reachable by a low-privilege authenticated user and does not verify that the user is authorized to manage the selected patient's portal account.
Exploit preconditions
- Attack surface: The patient portal credential creation or replacement flow.
- Required access: A low-privilege authenticated OpenEMR account.
- Trigger point: Submission of replacement credentials through
create_portallogin.phpfor a patient selected in the session. - Why exploitation is possible: The flow may not enforce the necessary access-control checks before changing the patient's portal credentials.
Why this happens
The underlying issue is a failure to authorize a sensitive credential change. The application may accept a patient identifier from session state without confirming that the authenticated user has permission to manage that patient's portal account. This is CWE-862: Missing Authorization—a protected operation is performed without checking the caller's privileges for the target resource.
Potential impact
- An attacker could take over a patient's portal account.
- The attacker may be able to read protected health information available through the portal.
- A patient could be locked out of their account.
- Unauthorized changes could undermine the integrity of portal access and account records.
General mitigation guidance
Defensive patterns for this class of issue include:
- Enforcing server-side authorization checks for every credential change, tied to both the authenticated user and the specific patient account.
- Deriving or verifying the target patient from trusted server-side context rather than relying solely on mutable session or request data.
- Applying least privilege to account-management capabilities and separating patient self-service actions from staff administration.
- Requiring appropriate reauthentication or additional verification for sensitive credential changes.
- Recording and monitoring credential changes, with safeguards to help detect unexpected activity.
How teams detect issues like this
Review credential-management handlers for authorization checks that occur before any account change and confirm they validate access to the specific patient record. Static analysis and code review can look for sensitive updates that use session or request-supplied identifiers without an associated permission check. Policy enforcement can require authorization tests for cross-user resource access and credential changes; automated review tools may help identify these patterns.

