/

CVE-2026-25164

Severity:

HIGH RISK

(8.1)

Missing Authorization in OpenEMR REST API Document and

CVE-2026-25164

Analyzed

Vulnerability type

Category:

Missing Authorization

CWE:

CWE-862

Impact:

Unauthorized Access to Protected Health Information (PHI) and Unauthorized Data Modification

Severity:

HIGH RISK

(8.1)

CVSS version:

3.1

Catch this CVE while code is being written

Detect vulnerable code directly in pull requests, so CVEs are fixed before merge.

Summary

OpenEMR's REST API previously failed to enforce authorization checks on document and insurance endpoints, allowing any authenticated API client with a valid bearer token to read or modify all patients' documents and insurance records.

Because these routes bypassed the normal ACL evaluation applied to other patient-related endpoints, any API integration could unintentionally gain broad access to protected health information (PHI), regardless of its intended permissions.

Affected context

This vulnerability affects OpenEMR deployments that:

  • Expose the REST API in production environments
  • Issue bearer tokens to API clients (e.g., integrations, mobile apps, partner systems)
  • Rely on OpenEMR ACLs to restrict access to patient documents and insurance data

It specifically concerns the document and insurance routes defined in apis/routes/_rest_routes_standard.inc.php, which did not invoke RestConfig::request_authorization_check() while neighboring patient-related routes did.

Exploit preconditions

  • Attack surface: OpenEMR REST API endpoints for patient documents and insurance data
  • Required access: Any valid API bearer token for the OpenEMR instance (no special ACL privileges needed)
  • Trigger point: Calling the affected document or insurance REST routes using a legitimate bearer token
  • Why exploitation is possible: The routing configuration omits the authorization check (RestConfig::request_authorization_check()), so the system trusts any authenticated token without validating whether the caller's ACL permits access to the targeted patient's documents or insurance information.

Why this happens

The root cause is an authorization logic gap in the REST API route definitions, corresponding to CWE-862: Missing Authorization.

While many patient-related routes explicitly invoke a central authorization function with the appropriate ACL context, the document and insurance routes were registered without that call. This creates an inconsistent security boundary where:

  • Authentication (valid bearer token) is enforced uniformly,
  • But authorization (verifying that the token has rights to specific patient resources) is silently skipped for these routes.

Conceptually, this is a broken "enforcement point": the application defines an access control model but fails to apply it at a subset of endpoints, leaving a direct path to sensitive objects for any authenticated client.

Potential impact

  • Any authenticated API client may read all patients' document records, including sensitive attachments containing PHI.
  • Any authenticated API client may modify or delete patient documents and insurance records, potentially corrupting medical and billing data.
  • Integrations or third-party applications with narrowly scoped intended permissions could unintentionally gain broad PHI access, violating least-privilege assumptions.
  • Exposure of PHI can lead to regulatory non-compliance (e.g., HIPAA implications) and reputational damage.
  • Malicious insiders or compromised API clients could exfiltrate large volumes of PHI by enumerating accessible patients through these endpoints.

General mitigation guidance

Remediation revolves around consistent application of authorization checks and defense-in-depth for sensitive health data:

  • Ensure that every REST route handling patient-related resources, especially documents and insurance data, invokes a centralized authorization mechanism analogous to RestConfig::request_authorization_check() and passes the correct ACL parameters.
  • Adopt a default-deny policy for new or modified routes so that endpoints require explicit authorization configuration before they become accessible.
  • Consolidate access control logic in shared middleware or controllers instead of duplicating checks in individual route handlers, reducing the chance of omissions.
  • Treat documents and insurance information as high-sensitivity objects and apply stricter ACLs or data-segmentation rules, minimizing broad-role access.
  • Limit token scope where possible: design bearer tokens with explicit, narrowly defined permissions (e.g., per-tenant, per-patient, or per-function scopes) and validate those scopes at the API gateway or middleware.
  • Apply least privilege for API clients: review what each integration should access and ensure ACLs and token permissions match that minimal set.

How teams detect issues like this

Detection strategies focus on surfacing inconsistent authorization behavior and monitoring abnormal API use:

  • Static analysis & code review:
  • Scan route registration code (e.g., apis/routes/_rest_routes_standard.inc.php) for endpoints that handle patient resources but do not call the common authorization function.
  • Define review checklists requiring verification that every new REST route:
  • Enforces authentication, and
  • Invokes a centralized authorization routine with appropriate ACL context.
  • Use custom linters or static analysis rules to flag controllers or routes bypassing standard auth middleware.
  • Runtime monitoring & logging:
  • Enable detailed logging for document and insurance endpoints, including caller identity (token, client app), patient identifiers, and operation type.
  • Configure alerts for anomalous usage patterns, such as:
  • A single client accessing many different patients' documents or insurance records in a short time window.
  • Clients accessing resources outside their expected organizational or role context.
  • Security testing & policy checks:
  • Include automated API security tests (e.g., integration tests or DAST) that verify ACL enforcement across all patient-related routes.
  • Maintain policies in API gateways or service meshes to enforce basic access control constraints, even if application-level checks are misconfigured.

Sources

SourceLink
github.comgithub.com/openemr/openemr/commit/c5e1c44774156cd0d04f4e08ed6a81fe76d38e92
github.comgithub.com/openemr/openemr/security/advisories/GHSA-f64c-h2gh-g3f9

Frequently asked

questions

No. An attacker must possess a valid OpenEMR API bearer token. However, once authenticated, the missing authorization checks allow that token to access or modify all patients' documents and insurance records, independent of its intended ACLs.

The attacker needs any valid bearer token for the REST API—such as a token issued to a third-party integration, internal service, or user. The token does not need elevated permissions; the flaw lies in the absence of authorization checks on specific routes.

Centralize and standardize authorization enforcement. All REST routes that touch patient or other sensitive resources should be wired through a shared authorization component (for example, middleware or a common request handler) that:

  • Authenticates the caller,
  • Validates ACLs or scopes for the requested resource and operation,
  • Fails closed if authorization metadata is missing or misconfigured.

Treat access control as an infrastructure concern rather than ad-hoc code:

  • Use common middleware for both authentication and authorization, rather than per-route manual checks.
  • Enforce a "no route without auth" rule via CI checks, static analysis, or code generation.
  • Maintain tests that verify representative roles cannot access resources outside their authorized scope, especially when adding new API endpoints.
Find out what's already
exploitable in your codebase.