Summary
OpenEMR prescription REST API routes use the medical-records access control instead of the prescription-specific permission, allowing staff with read-only Medical/History access to pass authorization checks. An authenticated user with access to the exposed API token may be able to enumerate prescription identifiers, create prescriptions for patients, or deactivate existing prescriptions.
Affected context
The issue occurs in OpenEMR prescription REST API routes when authorization checks rely on the patients.med ACL rather than the prescription-specific patients.rx ACL and do not require a specific permission bit. In affected configurations, authenticated staff whose access is limited to read-only Medical/History information may pass these checks. The described behavior applies to OpenEMR versions before 8.4.0.
Exploit preconditions
- Attack surface: Prescription REST API routes
- Required access: An authenticated staff account whose
patients.medaccess passes the route check; the prescription-specific permission is not enforced - Trigger point: Requests to API operations that enumerate, create, or deactivate prescriptions
- Additional condition: The attacker can obtain and reuse the UI-exposed
APICSRFTOKEN - Why exploitation is possible: The routes check the wrong ACL and do not require a specific permission bit, so read-only Medical/History access can be treated as sufficient authorization
Why this happens
The API applies an authorization check for medical-record access where prescription-specific authorization is required. Because the check does not enforce the relevant permission bit or validate the user's prescription privileges for the requested action and patient, users with insufficient rights may pass it. This is an authorization enforcement failure mapped to CWE-863: Incorrect Authorization.
Potential impact
- Authenticated staff users may be able to enumerate prescription UUIDs.
- Unauthorized users could create or forge prescriptions for arbitrary patients.
- Existing prescriptions could be deactivated across the tenant.
- Prescription integrity and patient care workflows may be affected.
General mitigation guidance
Defensive patterns include:
- Apply the prescription-specific ACL and required permission bit to each prescription API operation.
- Enforce authorization on the server for every action and target patient; do not rely on UI visibility or client-provided tokens as a substitute for permission checks.
- Default to denying access when permissions are absent, ambiguous, or cannot be verified.
- Scope access to the user's permitted patients and tenant, and separate read, create, and deactivate privileges.
- Keep CSRF protections in place while treating them as complementary to authorization, not as authorization itself.
How teams detect issues like this
Review API routes for mismatches between the resource being accessed and the ACL being checked, and verify that each operation enforces the required permission bit. Test authorization policies across staff roles, actions, and patient or tenant boundaries, including read-only accounts attempting write operations. Audit logs for prescription enumeration, creation, and deactivation can help identify unusual activity. Static analysis and automated policy checks may help flag missing or inconsistent server-side authorization.

