CVE-2026-126451 in OpenEMR
Summary
by MITRE • 11/13/2026
OpenEMR before 8.5.0 contains a stored cross-site scripting vulnerability that allows portal patients to run JavaScript in staff sessions by injecting javascript: URLs into document template_data. Attackers can submit an encounterForm value rendered unsanitized into an iframe src by DocumentTemplateRender, letting the script read PHI and CSRF tokens and call staff or admin endpoints.
If you want to get best quality of vulnerability data, you may have to visit VulDB.
Analysis
by VulDB Data Team • 11/13/2026
The vulnerability identified within OpenEMR versions prior to 8.5.0 represents a critical stored cross-site scripting flaw that fundamentally compromises the security boundary between patient-facing portals and administrative interfaces. This issue stems from insufficient input validation and sanitization mechanisms when processing document template data, specifically within the encounterForm value handling logic. The core technical failure occurs in the DocumentTemplateRender component, which accepts user-supplied content without adequately neutralizing special characters or script tags before rendering them into HTML structures. By injecting a javascript: URL scheme into the document template_data field, an attacker can bypass standard browser security policies that typically restrict cross-origin data access and execution contexts.
From an operational perspective, this vulnerability allows authenticated portal patients to execute arbitrary JavaScript code within the context of staff or administrator sessions. This is achieved by submitting malicious encounterForm values that are subsequently rendered unsanitized into iframe src attributes via DocumentTemplateRender. The presence of these iframes creates a bridge between the patient's session and the administrative interface, enabling the attacker to read sensitive protected health information (PHI) stored in cookies or local storage associated with staff sessions. Furthermore, because the script executes within the trusted domain of the OpenEMR application, it can automatically submit cross-site request forgery requests to internal endpoints, effectively impersonating legitimate staff members without requiring additional authentication steps beyond what is already present in the active session.
The impact of this vulnerability extends far beyond simple data exfiltration. The ability to call staff or admin endpoints means that an attacker with a basic patient account can escalate privileges functionally by performing actions reserved for higher-level roles, such as modifying medical records, altering user permissions, or initiating financial transactions if integrated systems are present. This directly violates the principle of least privilege and undermines the integrity of electronic health record systems. The exposure of PHI also constitutes a severe breach of privacy regulations including HIPAA in the United States and GDPR in Europe, potentially leading to significant legal liabilities for healthcare organizations relying on this software version.
In terms of industry standard classifications, this vulnerability aligns with CWE-79: Improper Neutralization of Input During Web Page Generation commonly known as Cross-site Scripting (XSS). Specifically, it is a stored XSS variant because the malicious payload persists in the database or file system and is served to other users upon subsequent requests. Additionally, the exploitation technique maps to MITRE ATT&CK techniques such as T1059: Command and Control via Application Layer Protocol for executing scripts and T1534: Internal Spearphishing if used to trick staff into interacting with malicious content, although in this case, the execution is automated through session hijacking mechanics. The use of iframe injection to bypass same-origin policy restrictions also relates to CWE-829: Inclusion of Functionality from Untrusted Control.
To mitigate this vulnerability, organizations must immediately upgrade OpenEMR to version 8.5.0 or later where these input validation flaws have been addressed by the development team. Until an upgrade is feasible, administrators should implement strict Content Security Policy headers that restrict the execution of inline scripts and prevent loading resources from untrusted origins if possible. Additionally, enabling output encoding for all dynamic content rendered in templates can help neutralize script injection attempts at the presentation layer. Regular security audits focusing on input validation across all patient-facing forms are essential to ensure no similar vectors exist elsewhere in the application logic.