/

CVE-2026-126425

Severity:

HIGH RISK

(7.2)

SQL Injection (CWE-89) in OpenEMR History Layout Fields

CVE-2026-126425

Analyzed

Vulnerability type

Category:

SQL Injection

CWE:

CWE-89

Impact:

SQL execution, potential data exposure, and denial of service

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 has a stored SQL injection vulnerability involving History layout field identifiers that are saved without adequate validation and later included in an SQL statement. A user with the required administrative or patient/medical write access may trigger the vulnerable save path, potentially tying up database workers or accessing data beyond their privileges.

Affected context

The issue affects OpenEMR History layout handling, including HIS fields and LBF source-H fields. It becomes risky when an identifier saved through edit_layout.php is later used in an INSERT statement for a patient who does not yet have a history_data row, without suitable validation or safe query parameterization.

Exploit preconditions

  • Attack surface: History and LBF save functionality in the OpenEMR application
  • Required access: A user with admin/super access and patients/med write access, as described for the affected workflows
  • Trigger point: A history save through history_save.php or an LBF save that reaches the vulnerable INSERT path
  • Why exploitation is possible: A stored field identifier is incorporated into SQL without adequate validation or parameterization

Why this happens

The underlying issue is SQL injection (CWE-89). Data originating from saved History layout field identifiers is treated as part of SQL syntax rather than as untrusted data, allowing crafted values to alter the meaning of an INSERT statement. The risk is present when SQL is assembled using untrusted values instead of parameterized queries.

Potential impact

  • Database functions such as SLEEP could tie up database workers and affect availability.
  • Queries could potentially access data beyond the user's intended privileges.
  • Application data confidentiality or integrity could be affected.

General mitigation guidance

Common defensive patterns focus on keeping data separate from SQL instructions:

  • Use parameterized queries for all values included in database operations.
  • Validate field identifiers against an explicit allowlist of permitted layout fields.
  • Apply strict schema and type validation at the point where layout configuration is saved and when it is used.
  • Use database accounts with only the permissions required by the application.
  • Treat stored configuration and identifiers as untrusted, even when they were created by authorized users.

How teams detect issues like this

  • Use static analysis to identify SQL statements assembled through string concatenation or interpolation.
  • Review code paths that persist layout identifiers and later use them in INSERT statements, especially conditional paths for patients without a history row.
  • Check that database calls use parameter binding and that field names are constrained to known values.
  • Apply review and CI policies that flag dynamic SQL and require security review for changes to history and LBF save workflows.

Sources

SourceLink
github.comgithub.com/openemr/openemr/security/advisories/GHSA-fq58-jp5g-x44q
vulncheck.comvulncheck.com/advisories/openemr-before-8.5.0-stored-sql-injection-via-history-layout-field-identifiers

Frequently asked

questions

The issue concerns History layout identifiers used by history and LBF save paths, including an INSERT for patients without a history_data row.

The described workflows require a user with the relevant admin/super and patients/med write access.

Use parameterized queries for values and allowlist validation for identifiers that cannot be bound as ordinary query parameters.

Treat stored configuration as untrusted, enforce validation at relevant boundaries, and use code review or static analysis to flag dynamically assembled SQL.

Find out what's already
exploitable in your codebase.