/

CVE-2026-124469

Severity:

CRITICAL RISK

(9.9)

SQL Injection (CWE-89) in OpenEMR Fee Sheet Drug Lookup

CVE-2026-124469

Analyzed

Vulnerability type

Category:

SQL Injection

CWE:

CWE-89

Impact:

Sensitive Data Disclosure

Severity:

CRITICAL RISK

(9.9)

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 Fee Sheet drug-inventory lookup is vulnerable to SQL injection because a submitted warehouse value is incorporated into an ORDER BY clause. A low-privileged authenticated user who can submit Fee Sheet product lines may exploit this behavior as a time-based blind oracle to extract sensitive database information.

Affected context

The issue occurs in DrugSalesService::sellDrug during the Fee Sheet drug-inventory lookup. The prod[N][warehouse] POST field is interpolated into an SQL ORDER BY clause; deployments are at risk when this input can reach the query without safe parameterization or equivalent validation. The supplied description identifies OpenEMR versions before 8.3.0 as affected.

Exploit preconditions

  • Attack surface: The Fee Sheet drug-inventory lookup.
  • Required access: A low-privileged authenticated account able to submit Fee Sheet product lines.
  • Trigger point: Processing the prod[N][warehouse] POST field in DrugSalesService::sellDrug.
  • Why exploitation is possible: User-controlled input is incorporated into an SQL ordering expression, allowing time-based blind inference from query behavior.

Why this happens

The underlying bug is SQL injection, mapped to CWE-89. The application builds or alters an SQL statement using a request value in an ORDER BY clause without safely separating data from query structure. Because ordering expressions are part of SQL syntax, unsafe interpolation can allow input to influence query evaluation rather than being treated strictly as a value.

Potential impact

  • An attacker may infer database contents through a time-based blind oracle.
  • Patient information could be disclosed.
  • Users' bcrypt password hashes could be exposed.
  • Exposure of sensitive records could create privacy and account-security risks.

General mitigation guidance

Defensive patterns focus on preventing request data from controlling SQL syntax:

  • Use query builders or parameterized queries, and avoid interpolating request values into SQL clauses.
  • Where a SQL clause cannot use bind parameters, map inputs to a strict allowlist of known-safe values rather than accepting arbitrary expressions.
  • Validate request data against an explicit schema and reject unexpected fields or values.
  • Limit database account privileges to the minimum needed for the application's operations.
  • Reduce exposure of sensitive data through appropriate access controls and database permissions.

How teams detect issues like this

  • Use static analysis to identify SQL statements assembled through string concatenation or interpolation, especially in ORDER BY clauses.
  • Review code paths that pass POST fields into query-building functions and verify that values cannot alter SQL structure.
  • Apply code-review checks and repository policies requiring parameterized queries or strict allowlists for dynamic SQL fragments.
  • Monitor for unusual database query timing patterns and unexpected access to sensitive patient or account data.
  • Automated security review tools may help flag unsafe query construction for manual assessment.

Sources

SourceLink
github.comgithub.com/openemr/openemr/security/advisories/GHSA-cg8c-2v5q-29g7
vulncheck.comvulncheck.com/advisories/openemr-before-8.3.0-sql-injection-via-fee-sheet-warehouse-parameter

Frequently asked

questions

The described attack requires a low-privileged authenticated user who can submit Fee Sheet product lines.

The Fee Sheet drug-inventory lookup in DrugSalesService::sellDrug, where the warehouse POST field is used in an SQL ORDER BY clause.

Keep request data separate from SQL syntax by using parameterized queries or a query builder. For dynamic ordering choices that cannot be bound as values, select only from a strict allowlist.

Enforce safe query-construction practices in code review and static analysis, validate inputs against explicit schemas, and apply least-privilege database permissions.

Find out what's already
exploitable in your codebase.