/

CVE-2026-25927

Severity:

HIGH RISK

(7.1)

Insecure Direct Object Reference (IDOR) in OpenEMR DICOM

CVE-2026-25927

Analyzed

Vulnerability type

Category:

Insecure Direct Object Reference (IDOR)

CWE:

CWE-639

Impact:

Unauthorized Access to Medical Imaging State and Potential Privacy Violation

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's DICOM viewer state APIs (upload and state save/load) accept a document identifier (doc_id) without verifying that the document is associated with a patient or encounter the current user is authorized to access.

An authenticated user can enumerate document IDs to read or modify DICOM viewer state (such as annotations and view settings) for other users' documents, potentially exposing or tampering with sensitive medical imaging context.

Affected context

This vulnerability appears in OpenEMR deployments where:

  • The DICOM viewer is enabled and used to handle imaging documents.
  • Backend APIs handle viewer state (upload, save, load) through a doc_id parameter.
  • Access control checks validate that a user is logged in, but do not verify that the referenced document belongs to a patient or encounter the user is permitted to access.

It primarily affects environments with multiple users, roles (e.g., clinicians, staff), or tenants sharing the same OpenEMR instance where document IDs are predictable or enumerable.

Exploit preconditions

  • Attack surface: DICOM viewer state API endpoints (e.g., upload, state save/load) exposed to authenticated OpenEMR users via HTTP(S).
  • Required access: Valid authenticated OpenEMR account with permission to access at least one DICOM document or viewer feature.
  • Trigger point: Supplying an arbitrary or enumerated doc_id value to the DICOM viewer state APIs instead of only using IDs tied to the user's authorized patients/encounters.
  • Why exploitation is possible: The server relies on the client-supplied doc_id and authentication alone, without enforcing per-object authorization checks to confirm the document's ownership or the user's relationship to the patient or encounter associated with that document.

Why this happens

The issue stems from missing object-level access control on the DICOM viewer state API.

While the application verifies that the caller is authenticated, it fails to enforce authorization at the level of individual documents by not confirming that the requested doc_id belongs to a patient or encounter the user is permitted to access.

This pattern maps to CWE-639: Authorization Bypass Through User-Controlled Key, a form of insecure direct object reference (IDOR) where user-controlled identifiers directly map to protected resources without robust permission checks.

As a result, any authenticated user can potentially retrieve or alter state for documents not intended for them by guessing or enumerating document identifiers.

Potential impact

  • Unauthorized viewing of DICOM viewer state (e.g., prior annotations or view settings) associated with other patients' imaging documents.
  • Inference of sensitive medical information through context embedded in viewer state (e.g., labels, notes, or indications reflected in annotations).
  • Unauthorized modification, deletion, or corruption of viewer state for other users' imaging documents, potentially affecting clinical workflows.
  • Creation of misleading or fraudulent annotations that could influence clinical interpretation if relied upon without verification.
  • Expansion of privacy exposure when combined with other information leakage, aiding correlation of patient identities to imaging data.

General mitigation guidance

Remediation generally focuses on enforcing robust, server-side, object-level authorization for all resource identifiers:

  • Implement per-document access control checks for all DICOM viewer state operations, ensuring that the authenticated user is explicitly permitted to access the patient or encounter owning the doc_id.
  • Treat resource identifiers such as doc_id as untrusted input; never rely solely on authentication or role to assume access is appropriate.
  • Centralize authorization logic so that any endpoint handling document-related operations reuses the same permission checks and patient-relationship validations.
  • Prefer opaque, non-enumerable identifiers and avoid exposing sequential IDs when possible, while recognizing that obscurity alone is not a substitute for authorization.
  • Apply least-privilege principles to user roles so that users only receive capabilities necessary for their clinical responsibilities.
  • Incorporate privacy-by-design practices, limiting the amount and sensitivity of information stored in viewer state where feasible.

How teams detect issues like this

Effective detection involves both code-centric and behavioral approaches:

  • Static analysis and code review:
  • Search for API endpoints that accept identifiers like doc_id and interact with document or imaging resources without explicit authorization checks tied to patient/encounter ownership.
  • Flag controller or service methods that load documents based solely on a user-supplied ID while only verifying authentication or broad role membership.
  • Enforce secure coding guidelines requiring object-level permission checks wherever resource keys are processed.
  • Automated testing and QA:
  • Include authorization test cases attempting to access documents owned by other users or patients by modifying IDs in API requests.
  • Use security testing tools or custom scripts to perform ID enumeration against DICOM and documents APIs in staging environments.
  • Runtime monitoring:
  • Log accesses to DICOM-related endpoints with user ID, doc_id, and patient/encounter context; monitor for unusual patterns like sequential access across many unrelated documents.
  • Deploy anomaly-detection rules that alert on high-volume or cross-patient document access by a single user.
  • Neutral security tools (SAST/DAST) can be configured to look for IDOR patterns and help identify similar authorization gaps across the codebase.

Sources

SourceLink
github.comgithub.com/openemr/openemr/security/advisories/GHSA-qj9f-x7v2-hrr7

Frequently asked

questions

It is accessible remotely only to users who can authenticate to the OpenEMR instance. There is no unauthenticated access, but any authenticated account with DICOM viewer access could potentially exploit it if other controls are not in place.

An attacker needs a valid OpenEMR account with permissions to reach the DICOM viewer state endpoints. No special administrative role is strictly required if object-level authorization is missing.

The safest pattern is to enforce strict server-side object-level authorization on every API that takes a doc_id or similar key. Each request should confirm that the authenticated user is allowed to access the patient or encounter associated with that document before returning or modifying any state.

Prevention involves designing APIs with access control as a first-class concern: treat all client-supplied identifiers as untrusted, centralize authorization logic, adopt secure coding guidelines that mandate object-level checks, and integrate automated security testing for IDOR patterns into the development lifecycle.

Find out what's already
exploitable in your codebase.