/

CVE-2026-33910

Severity:

HIGH RISK

(7.2)

SQL Injection in OpenEMR Patient Selection Feature

CVE-2026-33910

Analyzed

Vulnerability type

Category:

SQL Injection

CWE:

CWE-89

Impact:

Unauthorized access and manipulation of medical records via SQL Injection

Severity:

HIGH RISK

(7.2)

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 up to and including version 8.0.0.2 contains a SQL injection vulnerability in the patient selection feature that allows authenticated users to manipulate database queries.

Under certain conditions, this can let an attacker access or tamper with sensitive medical records and related practice management data via crafted input sent through the patient search/selection interface.

Affected context

The vulnerability occurs in OpenEMR's patient selection functionality, where user-supplied data is used to construct SQL queries for searching or filtering patients.

It affects deployments where authenticated users can interact with the patient search or selection UI and where the underlying database queries are built using this input without robust parameterization or sanitization.

The risk is more pronounced in environments where many staff roles share access to patient lookup features, or where role-based access controls do not strictly limit which records can be queried.

Exploit preconditions

  • Attack surface: HTTP(S) endpoints behind the authenticated OpenEMR web interface, specifically those backing the patient selection/search feature.
  • Required access: Valid authenticated OpenEMR account with permission to use patient selection (e.g., clinical staff, administrative users).
  • Trigger point: Submission of crafted input in patient lookup fields (such as name, ID, or other search parameters) that are incorporated into SQL queries.
  • Why exploitation is possible: User-controlled data is concatenated or interpolated directly into SQL statements without using safe parameterized queries or adequate server-side validation, allowing attackers to alter query structure.

Why this happens

The core issue is the construction of SQL statements using untrusted input from the patient selection interface, likely through string concatenation or direct interpolation.

This maps to CWE-89: Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection'), where special characters and control tokens are not safely handled.

Instead of binding user input as data via prepared statements, the application logic appears to embed raw values into query text, enabling attackers to inject additional clauses or logic into the underlying SQL command.

Potential impact

  • Unauthorized reading of patient data that the attacker's account would not normally be able to access.
  • Exposure of sensitive personal and medical information, increasing privacy and compliance risks.
  • Modification or deletion of patient records, appointments, or related clinical data.
  • Tampering with billing or practice management data stored in the same database.
  • Potential pivoting into broader database compromise depending on the database user's privileges.

General mitigation guidance

Effective mitigation focuses on treating all data coming from the patient selection feature as untrusted and ensuring it cannot alter SQL structure:

  • Use parameterized queries or prepared statements for all database interactions involving user input, ensuring values are bound as parameters rather than concatenated into query strings.
  • Centralize query construction through a database abstraction layer or ORM that encourages safe-by-default patterns and discourages raw SQL assembly.
  • Implement strict server-side validation and canonicalization of patient search parameters, accepting only expected formats (e.g., alphanumeric IDs, bounded-length names, whitelisted sort fields).
  • Apply least-privilege to the database account used by OpenEMR so that even if a query is manipulated, the impact is limited to the minimal required tables and operations.
  • Introduce defense-in-depth measures such as query whitelisting patterns or database-level controls that restrict dangerous commands (e.g., arbitrary DROP/ALTER on critical tables).

How teams detect issues like this

Organizations can identify and monitor for this class of vulnerability using several complementary approaches:

  • Static analysis: Configure SAST tools or custom rules to flag dynamic SQL construction patterns, string concatenation into query text, and direct interpolation of HTTP parameters into SQL.
  • Code review: During manual reviews, look for points where patient selection parameters are used, verify that queries employ prepared statements, and confirm that validation logic enforces allowed characters and lengths.
  • Dynamic testing: Use application security testing (DAST) to probe patient lookup endpoints with benign SQL meta-characters while monitoring for errors, unexpected behavior, or differences in result sets.
  • Logging and monitoring: Enable detailed query logging (with care for PHI) and alert on anomalous patterns, such as queries containing comment markers, always-true conditions, or unusual combinations of operators that may indicate injection attempts.

Sources

SourceLink
github.comgithub.com/openemr/openemr/commit/73db3264aed253684532839380cae3b0a56c83d2
github.comgithub.com/openemr/openemr/releases/tag/v8_0_0_3
github.comgithub.com/openemr/openemr/security/advisories/GHSA-x32c-xj5g-7jx7

Frequently asked

questions

Yes, if an OpenEMR instance is accessible over the network (including the internet or a VPN) and an attacker can obtain valid credentials, they can exploit the issue via the web interface. The attack is not anonymous; it requires an authenticated session.

Not necessarily. Any authenticated account with access to the patient selection functionality may be able to trigger the SQL injection, depending on how roles and permissions are configured in a given deployment.

The safest pattern is to systematically replace dynamically constructed SQL with parameterized queries or prepared statements, coupled with strong input validation for all patient lookup parameters. This should be done consistently across all code paths that interact with the patient selection feature.

Adopt a development standard that prohibits raw string-based SQL assembly with user input, enforce use of safe database access layers, and integrate automated security scanning into CI pipelines. Complement this with regular security-focused code reviews that specifically examine how user input flows into database operations.

Find out what's already
exploitable in your codebase.