/

CVE-2026-126494

Severity:

HIGH RISK

(7.1)

Improper Authorization (CWE-863) in OpenEMR OAuth Scopes

CVE-2026-126494

Awaiting Analysis

Vulnerability type

Category:

Improper Authorization

CWE:

CWE-863

Impact:

Unauthorized modification or deletion of appointments and patient data

Severity:

HIGH RISK

(7.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 can grant write access to SMART/OAuth clients registered with read-only permissions because scope finalization does not properly check registered permissions. A client that can request a write scope may consequently be able to create, update, or delete appointments or patient data.

Affected context

The issue is in ScopeRepository::finalizeScopes() and ScopeEntity::containsScope() in OpenEMR. It becomes relevant when a SMART/OAuth client registered for a read scope can request the corresponding write scope, and the authorization flow does not enforce the client's registered permissions.

Exploit preconditions

  • Attack surface: SMART/OAuth scope authorization in OpenEMR
  • Required access: Ability to use a client registered with read-only permissions; the description does not establish that client registration itself is available to an attacker.
  • Trigger point: Requesting a write scope during scope finalization
  • Why exploitation is possible: Scope checking ignores the permissions registered for the client, allowing a read-only client to obtain a write scope.

Why this happens

The authorization logic does not reliably constrain requested scopes to the permissions registered for the client. ScopeEntity::containsScope() ignores those permissions, so ScopeRepository::finalizeScopes() can accept a write scope for a read-only client. This is an authorization enforcement failure mapped to CWE-863: Incorrect Authorization.

Potential impact

  • Affected clients may be able to create or update appointments.
  • A client may be able to modify or delete patient data.
  • Unauthorized changes could affect the confidentiality, integrity, or availability of clinical records and workflows.

General mitigation guidance

Defensive patterns focus on enforcing authorization at the point where scopes are finalized:

  • Compare every requested scope against the client's registered permissions and reject unregistered or excessive scopes.
  • Use explicit, deny-by-default scope allowlists and consistent checks across authorization and token flows.
  • Grant clients only the minimum permissions needed for their function.
  • Keep read and write permissions distinct, and avoid treating a read permission as evidence of write authorization.
  • Add tests that verify read-only clients cannot obtain write scopes.

How teams detect issues like this

Review scope-finalization code for checks that fail to bind requested scopes to client registrations. Look for scope containment or normalization logic that can accept broader permissions than the client was granted.

Monitor authorization and token events for read-only clients receiving write scopes, and enforce policies that reject scopes outside each client's registered allowlist. Static analysis and automated code review can help identify authorization checks that omit the relevant principal or permission set.

Sources

SourceLink
github.comgithub.com/openemr/openemr/security/advisories/GHSA-6cmr-r2rh-755m
vulncheck.comvulncheck.com/advisories/openemr-before-8.4.0-privilege-escalation-via-smart-oauth-scope-finalization

Frequently asked

questions

A read-only SMART/OAuth client may obtain write scopes, potentially enabling changes to appointments or patient data.

The described scenario requires use of a client registered with read-only permissions. The available information does not establish how an attacker could obtain or use such a client.

Enforce a deny-by-default check that permits only scopes explicitly registered for the client, at the point scopes are finalized.

Apply least privilege, keep read and write permissions separate, and test that authorization flows reject scopes beyond each client's grants.

Find out what's already
exploitable in your codebase.