Automated Threat Modeling

Brief Summary: OpenEMR CVE-2026-126455 Authorization Bypass and SQL Injection Chain

A brief summary of CVE-2026-126455, a chain of seven missing authorization and SQL injection defects in OpenEMR before 8.5.0. Includes PoC and patch information.

CVE Analysis

12 min read

Gaurav Sarraf
Gaurav Sarraf

2026-11-13

Brief Summary: OpenEMR CVE-2026-126455 Authorization Bypass and SQL Injection Chain

Introduction

In OpenEMR, a Front Office clerk whose entire legitimate job is booking appointments and editing demographics could read every row of the clinical database, assume a patient's portal identity, and sign off forged referrals as clinically authorized. An HHS HC3 alert once described OpenEMR as serving more than 200 million patients, so a chain that turns the lowest meaningful privilege into whole-database disclosure and clinical record forgery is worth understanding in detail.

OpenEMR is an open source electronic medical record and medical practice management system, licensed under the GPL and backed by the nonprofit OpenEMR Foundation. It is one of the most widely deployed free EMR platforms in healthcare, and OpenEMR 8 received ONC Health IT Certification on January 30, 2026. That combination of scale and sensitivity is what makes CVE-2026-126455 worth a close look.

Technical Information

The assigned weakness is CWE-862, Missing Authorization, and the CVE description also includes SQL injection. The core defect is architectural. Many OpenEMR endpoints relied on each individual script to enforce its own access control, and a lot of them simply did not. The CSRF tokens that several of these scripts did check only prove that a request came from the logged-in user's browser. They say nothing about whether that user is allowed to perform the action.

The entry point is an authenticated, low-privilege account. The advisory demonstrates the chain against OpenEMR 8.3.0 using a seeded Front Office clerk holding only patients/appt and patients/demo. Administrator privileges are not required. The chain crosses four distinct security boundaries, and each needs its own protection: database access, patient identity, record ownership, and clinical approval. Repairing one SQL query does not address the full chain.

ComponentDefectConsequence
interface/reports/patient_list.phpNo ACL checkDumps the full patient roster with names, addresses, phones, insurance
SyndromicsurveillanceTable::fetch_result()Unparameterized SQL, no ACLArbitrary reads of patient_data and users_secure
interface/patient_file/summary/create_portallogin.phpNo ACL checkSets portal credentials for an open chart; authenticate as that patient
Portal ORM _BitwiseAnd filterInjectable criteriaSecond arbitrary read path from a patient identity
interface/patient_file/transaction/add_transaction.phpNo patients/trans enforcement, no pid scopingRead or overwrite another patient's referral or transaction
interface/main/authorizations/authorizations_full.phpMissing $imauthorized/ACL gateForged transactions marked authorized
interface/patient_file/summary/immunizations.phpNo ACL, no pid scopingRead, modify, or delete another patient's immunization record

A note on the SQL injection scope

The documented SQL injection paths are read only. The advisory treats response size as a Boolean oracle and also notes error-based extraction. Stacked statements and INTO OUTFILE are rejected. The subtlety that matters: read-only SQL injection does not make the overall chain read only. Record creation, approval, and deletion all flow through the separate authorization defects, not through SQL writes. Reading an administrator bcrypt hash does not establish plaintext recovery or server code execution either.

Attack flow

The reproducer runs the chain in sequence:

  1. Recon. POST to patient_list.php with form_refresh=true and receive the full patient roster, since no ACL check runs.
  2. Whole-database read. The Syndromic Surveillance code concatenates the form_icd_codes[] POST array into an IN (...) clause outside quotes. Calibrating with 1) OR (1=1) OR c.id IN (1 versus 1) OR (1=2) OR c.id IN (1 yields a size oracle, then a binary search ASCII/SUBSTRING extraction pulls a patient SSN from patient_data and the admin bcrypt hash prefix from users_secure.
  3. Patient identity. After open_chart(PID_B), POST new portal credentials to create_portallogin.php and log into the patient portal as that patient.
  4. Second SQLi path. From the portal account, the _BitwiseAnd filter is injectable. The PoC confirms with a time-delay oracle using Id_BitwiseAnd=0) OR (SELECT SLEEP(4)) OR (1=0.
  5. Forgery. With the session chart set to patient A, POST to add_transaction.php with patient B's transid to write a forged referral into patient B's chart.
  6. Laundering. Call authorizations_full.php?mode=authorize&pid=<victim>, which has only a CSRF check, to flip the forged transaction's authorized column to 1.
  7. Destruction. Call immunizations.php?mode=delete&id=<imm_id> to delete patient B's immunization row.

Proof of Concept

A complete, self-contained public PoC exists. VulnCheck maps CVE-2026-126455 to OpenEMR maintainer advisory GHSA-vr7f-7c3w-49g7, published October 28, 2026, affecting OpenEMR < 8.5.0. The vulnerability was found by an AI agent credited to Google and Ada Logics (AdamKorcz).

The advisory ships a fully executable reproducer:

docker build -t openemr-repro . docker run --rm -v "$(pwd)/findings/90-chain:/workspace/artifacts" openemr-repro

The PoC builds on the unmodified openemr/openemr:latest (8.3.0) image, stands up a private MariaDB, installs OpenEMR, and seeds a realistic clinic using only admin-level APIs, never the bugs under test. The seeded attacker is a Front Office clerk alice / AlicePass123! holding only patients/appt and patients/demo. Its denied ACLs are printed at startup to prove the privilege boundary. Two patients (Alan Alpha, Bella Bravo) with PHI, an immunization, a referral transaction, portal logins, and a reportable ICD9 problem are seeded.

The exploit.py chains the seven defects in sequence. The Link 2 extraction uses a query of the form:

ASCII((SELECT SUBSTRING(password,%d,1) FROM users_secure WHERE username=0x61646D696E))>mid

A shared HTTP client (/poc/oe.py) provides staff login via /interface/main/main_screen.php?auth=login, two-step portal login via /portal/index.php then /portal/get_patient_info.php, chart switching, and CSRF token scraping. The chain prints EXPLOIT SUCCESSFUL when all links pass. The GitHub advisory page itself still displays "No known CVE," but VulnCheck links GHSA-vr7f-7c3w-49g7 to CVE-2026-126455.

Patch Information

The fix is in OpenEMR 8.5.0, released October 27, 2026. Upgrading is the remediation. The 8.5.0 release notes list GHSA-vr7f-7c3w-49g7 first under Security Fixes. Because the CVE covers seven separate flaws, there is no single fix. Many links also have their own advisory in the same release, including GHSA-j467-662w-jwvj (authorizations_full.php), GHSA-xp7w-8fx3-642x (immunizations.php), GHSA-q6f8-4pm7-q39r (Syndromic Surveillance SQLi), GHSA-g2xw-rvhq-x543 and GHSA-vvj8-xpx8-p293 (_BitwiseAnd SQLi), and GHSA-83hq-c876-fcwf (portal credentials).

A caution on the patch commit: both NVD and VulnCheck reference 71da6605dc3bcc1405ee9a65cb9f579ecbc8a1c6. That SHA is the one the reporter's advisory uses in permalinks to point at the vulnerable 8.3.0 code, and the GitHub API returns "No commit found" for it in openemr/openemr. Do not treat it as the fix. The closest public fix change is PR #14627, "chore: optimize report, portal, and transaction entry points," merged October 18, 2026, touching 20 files. The code below comes from the v8_5_0 tag.

// Patient-roster report; align the permission check with the other // `patients/pat_rep` reports in this directory. if (!AclMain::aclCheckCore('patients', 'pat_rep')) { AccessDeniedHelper::denyWithTemplate("ACL check failed for patients/pat_rep: Patient List", xl("Patient List")); }

A Front Office clerk does not hold patients/pat_rep, so the request fails before the bulk patient_data query runs. The same missing check was also fixed in unique_seen_patients_report.php, charts_checked_out.php, and services_by_category.php.

if ($code_selected) { $codeIds = is_array($code_selected) ? array_map(static fn ($v): int => (int) $v, $code_selected) : []; if ($codeIds !== []) { $query .= " AND c.id IN (" . implode(',', $codeIds) . ") "; } }

Casting with (int) turns a payload like 1) OR (1=1) OR c.id IN (1 into the plain number 1, so only digits and commas reach the SQL. The same block appears at all four IN sites, in both fetch_result() and generate_hl7().

if (!AclMain::aclCheckCore('patientportal', 'portal')) { AccessDeniedHelper::denyWithTemplate("ACL check failed for patientportal/portal: Create Portal Login", xl("Patient Portal")); } // The service layer accepts pid=0 and will read/write `patient_access_onsite` // against that value; require an open chart before reaching it. if (!is_numeric($pid) || (int) $pid <= 0) {

The check sits at the top of the file, so a user without permission cannot even view the existing portal username.

// See _BitwiseOr above: emit an integer literal for this unquoted context. $bitmask = is_numeric($val) ? (int) $val : 0; $this->_where .= $this->_where_delim . " (" . $dbfield . " & " . $bitmask . ")";

The fixed file's comment states the lesson: escaping meant for values inside quotes does not stop injection where the value has no quotes around it. _BitwiseOr got the same fix, and because it is in the shared ORM class it covers every controller passing request parameters into a Criteria object.

$aclReturn = $mode ? ['write', 'addonly'] : ''; if (!AclMain::aclCheckCore('patients', 'trans', '', $aclReturn)) {
if ($sessionPidInt <= 0 || $ownerPid <= 0 || $ownerPid !== $sessionPidInt) { AccessDeniedHelper::deny('add_transaction: transid does not belong to the open chart'); }

Requiring both PIDs to be positive prevents a NULL pid row and an empty session chart from comparing 0 === 0 and passing. This ownership check runs before the UPDATE, the lbt_data writes, and the getTransById() read.

$imauthorized = $session->get('userauthorized') || $see_auth > 2; if (isset($_GET["mode"]) && $_GET["mode"] == "authorize" && $imauthorized) {

Users who are not authorizers can no longer mark billing, forms, notes, or transactions as authorized=1. The fix is a role check rather than the per-chart scoping the reporter also suggested.

$sql = "DELETE FROM immunizations WHERE id = ? AND patient_id = ? LIMIT 1"; sqlStatement($sql, [$_GET['id'], $pid]);

The page now requires patients/med, the add, delete, and added_error modes also require write/addonly, and every statement that takes an id is limited to the session patient. The added_erroneously update and the edit select got the same AND patient_id = ? filter.

What all the fixes share: every link failed the same way, because each script had to remember its own authorization check and many did not. The 8.5.0 fixes add the missing per-script checks and tie record IDs to the open chart. The reporter's suggested larger change, shared bootstraps that deny by default for any script without an explicit permission entry, does not appear in the code reviewed here.

Affected Systems and Versions

OpenEMR versions before 8.5.0 are affected. The GitHub advisory gives the affected range as < 8.5.0 and the patched version as 8.5.0. The public reproducer demonstrates the chain against the openemr/openemr:latest image, which was version 8.3.0 at the time. The default-enabled Syndromic Surveillance module is one of the components reachable without the required authorization checks. OpenEMR 8.5.0 lists PHP 8.3 or later, MariaDB 10.11 or later, and MySQL 8.4 or later as platform requirements.

Vendor Security History

OpenEMR has a documented record of both serious findings and corrective releases. The Project Insecurity assessment of OpenEMR 5.0.1.3 documented SQL injection, portal authentication bypass, and other defects, with project contact in July 2018, a fixing update on July 20, 2018, and public disclosure on August 7, 2018. A later HHS HC3 alert described three vulnerabilities identified by Sonar (unauthenticated file read, authenticated local file inclusion, and authenticated reflected cross-site scripting), reported October 24, 2022 and patched in 7.0.0 on November 30, 2022. These cases show repeated serious findings alongside an established coordinated disclosure and patch process. They do not establish an incident rate or that the present CVE was exploited previously.

References

Detect & fix
what others miss

Works with
  • GitHub
  • GitLab
  • Bitbucket
  • Azure DevOps Services
  • Gerrit
  • CVS
  • Jira
  • Linear
  • Slack
  • Security Compass
Explore integrations
Security magnifying glass visualization