/

CVE-2026-25746

Severity:

HIGH RISK

(8.8)

SQL Injection in OpenEMR Prescription Listing Functionality

CVE-2026-25746

Analyzed

Vulnerability type

Category:

SQL Injection

CWE:

CWE-89

Impact:

Unauthorized Data Access and Modification via SQL Injection

Severity:

HIGH RISK

(8.8)

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

A SQL injection vulnerability in the prescription listing functionality of OpenEMR allows authenticated users to inject arbitrary SQL into backend queries due to insufficient input validation.

Under certain conditions, this can let an attacker read or modify sensitive medical data, tamper with prescription records, or impact the integrity and availability of the OpenEMR database.

Affected context

The vulnerability occurs in OpenEMR instances using versions prior to 8.0.0 where the prescription listing feature constructs SQL queries using user-supplied parameters without adequate sanitization or query parameterization.

It affects environments where authenticated users can submit or manipulate prescription-related inputs that are later incorporated into database queries.

The risk is higher in deployments where user roles are broadly assigned, logging is limited, or where access controls around prescription data are weak.

Exploit preconditions

  • Attack surface: Web application interface, specifically endpoints or forms related to viewing or listing prescriptions.
  • Required access: Valid authenticated access to OpenEMR with permission to interact with the prescription listing functionality (e.g., clinician, staff, or similar roles).
  • Trigger point: Submission of crafted prescription-related input fields (such as search filters, ordering, or identifiers) that are concatenated into SQL queries.
  • Why exploitation is possible: The application uses insufficient input validation and/or fails to use parameterized queries, allowing user-supplied data to alter the structure of SQL commands executed by the database.

Why this happens

The core issue aligns with CWE-89: Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection').

User-controlled fields within the prescription listing workflow are combined directly into SQL statements without consistent use of bound parameters or robust input neutralization.

As a result, special characters and SQL metasyntax from user input can escape the intended data context and become part of the executable query, enabling attackers to modify the query's logic, access unauthorized data, or manipulate database state.

Potential impact

  • Unauthorized reading of sensitive patient and prescription data.
  • Tampering with or deletion of prescription records and related clinical information.
  • Escalation of privileges within the application by manipulating role or user records, where schema permits.
  • Disruption of healthcare workflows through database corruption or denial of service via destructive SQL payloads.
  • Compromise of data integrity, potentially impacting clinical decisions based on altered records.

General mitigation guidance

Effective mitigation focuses on treating all user input as untrusted and ensuring database interactions are resilient to injection:

  • Prefer parameterized queries or prepared statements for all database access, especially in listing and search functionality that composes dynamic filters.
  • Implement centralized input handling that enforces strict whitelists for fields used in filtering, sorting, or searching, restricting them to expected formats and value ranges.
  • Avoid dynamic query construction based on raw request parameters; when dynamic behavior is needed (e.g., sort columns), map user choices to a fixed set of allowed SQL fragments.
  • Apply least-privilege principles to the database account used by the application, constraining its access to only required tables and operations.
  • Adopt secure coding guidelines and shared database access utilities, so new features automatically inherit safe query patterns.

How teams detect issues like this

High-level detection can combine code-centric and behavior-centric approaches:

  • Static analysis: Use tools or custom rules that flag string concatenation or interpolation used in SQL queries, especially within prescription-related modules.
  • Code review: During manual review, look for query-building logic that accepts request parameters directly, missing parameter binding, or ad hoc filtering and sorting code in prescription listing controllers or data access layers.
  • Runtime monitoring: Enable database and application logging to capture anomalous query patterns, such as unexpected operators, UNION statements, or tautological conditions in prescription queries.
  • Security testing: Integrate automated and manual SQL injection testing into CI/CD pipelines and regular security assessments, focusing on authenticated paths like prescription management workflows.

Sources

SourceLink
github.comgithub.com/ChrisSub08/CVE-2026-25746_SqlInjectionVulnerabilityOpenEMR7.0.4
github.comgithub.com/openemr/openemr/blob/2b46e594b9dd665fb7f16c913ca07f5c6d54412b/library/classes/Controller.class.php#L77
github.comgithub.com/openemr/openemr/blob/9fa8db9f12d0b70985195b11b90f2dc564bd3b24/controller.php#L6
github.comgithub.com/openemr/openemr/blob/9fa8db9f12d0b70985195b11b90f2dc564bd3b24/controllers/C_Prescription.class.php#L180
github.comgithub.com/openemr/openemr/blob/9fa8db9f12d0b70985195b11b90f2dc564bd3b24/library/classes/Prescription.class.php#L1148
github.comgithub.com/openemr/openemr/commit/e230d3ef46425ffc96a37dc6369428aa37c88554
github.comgithub.com/openemr/openemr/security/advisories/GHSA-78r7-g65p-gpw3

Frequently asked

questions

Yes, it can be exploited remotely through the web interface, but only by users who can authenticate and reach the prescription listing functionality.

An attacker must have valid credentials and sufficient permissions to interact with the prescription-related views or actions that trigger the vulnerable queries.

The most robust fix is to refactor affected code to use parameterized queries or prepared statements everywhere, eliminating direct concatenation of user input into SQL, and to strictly validate all request parameters that influence query construction.

Establish a standard data access layer that enforces parameterization by design, adopt secure coding guidelines, integrate static analysis and security tests into development workflows, and require code review checks for any new or modified query-building logic.

Find out what's already
exploitable in your codebase.