
PEACH
Un cadre d’isolation des locataires
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).
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).
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).
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).
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;main_screen.php?auth=login.csrf_token_form from any in-session page, e.g., GET /interface/main/finder/dynamic_finder.php.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.<td class='srName'> and <tr class='oneresult' id=...> elements to read returned patient records that should not match the search term.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)./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.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.patient_select.php requests with findBy=Any from accounts that do not normally perform patient searches; abnormally large response sizes from this endpoint.log table) for unexpected patient data access events by low-privilege users.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).
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).
Source: Ce rapport a été généré à l’aide de l’IA
Évaluation gratuite des vulnérabilités
É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.
Obtenez une démo personnalisée
"La meilleure expérience utilisateur que j’ai jamais vue, offre une visibilité totale sur les workloads cloud."
"Wiz fournit une interface unique pour voir ce qui se passe dans nos environnements cloud."
"Nous savons que si Wiz identifie quelque chose comme critique, c’est qu’il l’est réellement."