CVE-2026-126491: 
OpenEMR Analyse et atténuation de la vulnérabilité

Aperçu

CVE-2026-126491 is a stored (second-order) SQL injection vulnerability in OpenEMR's getByPatientDemographics() function located in library/patient.inc.php. It affects all OpenEMR versions before 8.5.0 and represents an incomplete fix for a prior related vulnerability, CVE-2026-33910. The flaw allows an attacker with Layout Editor (admin/super) access to plant a malicious field_id value in the layout_options table, which is then unsafely concatenated into a patient search SQL query — exploitable by any authenticated low-privilege user. It carries a CVSS v3.1 base score of 7.6 (High) and a CVSS v4.0 base score of 8.3 (High) (GitHub Advisory, Feedly).

Détails techniques

The root cause is CWE-89 (SQL Injection): the getByPatientDemographics() function at line 690 of library/patient.inc.php uses add_escape_custom() — which wraps mysqli_real_escape_string() — to sanitize field_id values fetched from layout_options before concatenating them as SQL column identifiers in a WHERE clause. String escaping is ineffective in identifier context, so a value like 1 OR 1=1 passes through unmodified and alters query logic. The sibling function getByPatientDemographicsFilter() (line 712) was correctly patched using escape_sql_column_name() (a whitelist-based column validator), but getByPatientDemographics() was missed. The malicious field_id can be planted via the Layout Editor UI or the UPDATE layout_options SQL path; the trigger endpoint interface/main/finder/patient_select.php with findBy=Any requires only a valid CSRF token and an authenticated session — no elevated ACL check is performed (GitHub Advisory).

Impact

Successful exploitation enables any authenticated low-privilege user (e.g., a Front Office account) to exfiltrate data from the patient_data and users_secure tables, exposing sensitive patient demographics and bcrypt password hashes. While the OpenEMR database user is least-privileged (file_priv=N, no stacked queries), the realistic attack chain extends from SQL injection to bcrypt hash exfiltration, offline cracking, and subsequent admin-level access — enabling further exploitation via admin-RCE primitives such as module installation, backup manipulation, or global configuration changes. The scope change (CVSS S:C) reflects that a low-privilege trigger session can access data beyond its own authorization boundary (GitHub Advisory).

Exploitabilité

A proof-of-concept is publicly available in the GitHub Security Advisory (GHSA-pc2q-9pcw-v899), including specific curl-based reproduction steps, the tautology payload (1 OR 1=1), and a Docker-based test environment. The exploit is classified as poc_steps with medium confidence by Feedly analysis. There is no evidence of in-the-wild exploitation at this time. The EPSS score is approximately 0.00346 (low probability of near-term exploitation), and the vulnerability is not listed in the CISA KEV catalog. Exploitation is not automatable without prior admin-level access to plant the payload (GitHub Advisory, Feedly).

Étapes d’exploitation

  1. Reconnaissance: Identify an OpenEMR instance running a version prior to 8.5.0. Confirm access to the Layout Editor (requires admin or super role).
  2. Plant the malicious payload: Using the Layout Editor UI (Admin → Forms → Layouts → Demographics), rename a field's field_id (e.g., fname) to a SQL injection payload such as 1 OR 1=1. Alternatively, execute directly: UPDATE layout_options SET field_id='1 OR 1=1' WHERE form_id='DEM' AND title='Name' AND field_id='fname' AND uor != 0;
  3. Authenticate as a low-privilege user: Log in as any authenticated user (e.g., Front Office). Obtain a session cookie via POST to main_screen.php?auth=login.
  4. Obtain a CSRF token: Scrape csrf_token_form from any in-session page, e.g., GET /interface/main/finder/dynamic_finder.php.
  5. Trigger the vulnerable search: Send a GET request to patient_select.php?popup=0&findBy=Any&patient=ZZZZ_no_match&csrf_token_form=<token>. The planted field_id is concatenated into the WHERE clause of getByPatientDemographics(), turning it into a tautology.
  6. Extract leaked data: Parse the HTML response for <td class='srName'> and <tr class='oneresult' id=...> elements to read returned patient records that should not match the search term.
  7. Escalate (optional): Use boolean or error-based blind SQLi payloads (up to 31 chars, e.g., 1=(SELECT id FROM users_secure) or EXTRACTVALUE(1,USER())) to exfiltrate bcrypt hashes from users_secure, then crack offline and escalate to admin (GitHub Advisory).

Indicateurs de compromis

  • Network: Unusual GET requests to /interface/main/finder/patient_select.php with findBy=Any and a nonsensical or impossible patient= value (e.g., ZZZZ_no_match) returning a large number of patient rows; repeated access to this endpoint from low-privilege accounts.
  • Database: Unexpected values in layout_options.field_id that contain SQL keywords or operators (e.g., OR, =, SELECT, EXTRACTVALUE); audit SELECT form_id, field_id, title FROM layout_options WHERE form_id='DEM' for anomalous entries.
  • Logs: Web server access logs showing patient_select.php requests with findBy=Any from accounts that do not normally perform patient searches; abnormally large response sizes from this endpoint.
  • File System: No direct file artifacts expected, but review OpenEMR audit logs (log table) for unexpected patient data access events by low-privilege users.
  • Process: No unusual process behavior expected given the DB user's restricted privileges (GitHub Advisory).

Atténuation et solutions de contournement

Upgrade OpenEMR to version 8.5.0 or later, which applies the correct fix by replacing add_escape_custom($row["field_id"]) with escape_sql_column_name($row["field_id"], ['patient_data']) in getByPatientDemographics(). As an interim workaround, restrict Layout Editor access strictly to trusted administrative accounts and audit the layout_options table for any field_id values containing SQL syntax. Additionally, implement database activity monitoring to alert on anomalous queries against patient_data and users_secure tables (GitHub Advisory).

Réactions de la communauté

The advisory was published by OpenEMR maintainer bradymiller on October 28, 2026, crediting researcher farisv (StarPlatinu) as the finder. The advisory explicitly frames this as an incomplete fix for a prior CVE (CVE-2026-33910), noting that the development team used the correct sanitization primitive (escape_sql_column_name) in the sibling function but failed to apply it consistently — characterizing it as "drift between two functions that were meant to be kept in sync" rather than a knowledge gap (GitHub Advisory).

Ressources supplémentaires


Source: Ce rapport a été généré à l’aide de l’IA

Connexe OpenEMR Vulnérabilités :

CVE ID

Gravité

Partition

Technologies

Nom du composant

Exploit CISA KEV

A corrigé

Date de publication

CVE-2026-126491HIGH8.3
  • OpenEMR logoOpenEMR
  • cpe:2.3:a:open-emr:openemr
NonOuiNov 13, 2026
CVE-2026-126494HIGH7.1
  • OpenEMR logoOpenEMR
  • cpe:2.3:a:open-emr:openemr
NonOuiNov 13, 2026
CVE-2026-126492HIGH7.1
  • OpenEMR logoOpenEMR
  • cpe:2.3:a:open-emr:openemr
NonOuiNov 13, 2026
CVE-2026-134020MEDIUM6.5
  • OpenEMR logoOpenEMR
  • cpe:2.3:a:open-emr:openemr
NonOuiNov 23, 2026
CVE-2026-126493MEDIUM4.8
  • OpenEMR logoOpenEMR
  • cpe:2.3:a:open-emr:openemr
NonOuiNov 13, 2026

Évaluation gratuite des vulnérabilités

Évaluez votre posture de sécurité cloud

Évaluez vos pratiques de sécurité cloud dans 9 domaines de sécurité afin d’évaluer votre niveau de risque et d’identifier les lacunes dans vos défenses.

Évaluation de la demande

Ressources Wiz supplémentaires

Obtenez une démo personnalisée

Prêt(e) à voir Wiz en action ?

"La meilleure expérience utilisateur que j’ai jamais vue, offre une visibilité totale sur les workloads cloud."
David EstlickRSSI
"Wiz fournit une interface unique pour voir ce qui se passe dans nos environnements cloud."
Adam FletcherChef du service de sécurité
"Nous savons que si Wiz identifie quelque chose comme critique, c’est qu’il l’est réellement."
Greg PoniatowskiResponsable de la gestion des menaces et des vulnérabilités