/

CVE-2026-33932

Severity:

HIGH RISK

(7.6)

Stored XSS in OpenEMR CCDA Document Preview

CVE-2026-33932

Analyzed

Vulnerability type

Category:

Stored Cross-Site Scripting (XSS)

CWE:

CWE-79

Impact:

Arbitrary JavaScript Execution in Clinician Browser Session

Severity:

HIGH RISK

(7.6)

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

A stored cross-site scripting vulnerability in OpenEMR's CCDA document preview allows attacker-controlled JavaScript to execute in a clinician's browser when a malicious CCDA document is viewed.

An attacker who can upload or send a crafted CCDA document can leverage insufficient sanitization of linkHtml elements in the XSL stylesheet to inject script-bearing attributes such as href="javascript:..." and event handlers.

Affected context

The issue occurs in OpenEMR instances that process and render CCDA documents using the vulnerable XSL stylesheet.

It becomes relevant when:

  • Clinicians or staff preview CCDA documents through the OpenEMR interface
  • CCDA content can originate from external parties, external systems, or untrusted sources
  • The rendering pipeline transforms CCDA narrative content, including linkHtml elements, into HTML for display without comprehensive sanitization

Under these conditions, malicious markup embedded in CCDA linkHtml elements can be reflected into the clinician's browser as active script.

Exploit preconditions

  • Attack surface: Web application interface used to preview CCDA documents within OpenEMR.
  • Required access: Ability to upload, import, or otherwise provide a CCDA document that will be stored and later previewed by a clinician or staff member.
  • User interaction: A clinician or staff member must open or preview the malicious CCDA document in the application UI.
  • Trigger point: Rendering of CCDA narrative content where linkHtml elements are transformed into HTML without proper attribute sanitization.
  • Why exploitation is possible: The XSL stylesheet sanitizes attributes for most narrative elements but omits equivalent checks for linkHtml, allowing javascript: URLs and event handler attributes to pass through to the final HTML.

Why this happens

The vulnerability stems from incomplete output encoding and sanitization in the transformation pipeline that converts CCDA content into HTML.

Specifically, the XSL stylesheet responsible for rendering CCDA narrative elements applies attribute sanitization broadly but fails to enforce it for the linkHtml element.

As a result, attacker-controlled attributes such as href="javascript:..." or inline event handlers are inserted directly into the generated HTML.

This behavior maps to CWE-79: Improper Neutralization of Input During Web Page Generation (Cross-Site Scripting), where untrusted data is included in the page without appropriate escaping or filtering at the point of output.

Potential impact

  • Execution of arbitrary JavaScript in a clinician's authenticated browser session.
  • Theft of session-related data accessible to scripts (e.g., sensitive page content, form data).
  • Unauthorized actions performed on behalf of the clinician within OpenEMR using their privileges.
  • Manipulation or exfiltration of protected health information (PHI) visible in the interface.
  • Phishing-style UI manipulation within the application to trick users into dangerous actions.

General mitigation guidance

Mitigation focuses on robust output encoding and consistent sanitization across all transformation paths from CCDA to HTML:

  • Ensure that all CCDA narrative elements, including linkHtml, undergo the same strict attribute validation and filtering in the XSL transformation.
  • Disallow dangerous URL schemes such as javascript: and restrict hyperlinks to a vetted allowlist of protocols (e.g., https, http, mailto where appropriate).
  • Strip or neutralize event handler attributes (e.g., onclick, onload) and other scriptable attributes before they reach the browser.
  • Apply context-aware HTML escaping at the final output layer, treating CCDA content as untrusted by default.
  • Use well-maintained sanitization libraries designed for converting rich text or XML content to safe HTML rendering contexts.
  • Apply a default-deny policy in the transformation logic, permitting only explicitly safe tags and attributes needed for clinical display.

How teams detect issues like this

Effective detection typically combines code-level review with behavioral testing:

  • Static analysis and code scanning:
  • Search for XSLT templates or rendering code that injects CCDA fields directly into HTML attributes or element bodies without explicit encoding or sanitization.
  • Flag transformations involving linkHtml or similar narrative elements where attribute filtering is missing or inconsistent with other elements.
  • Code review signals:
  • Look for string concatenation in templates or rendering functions that assemble href, src, or event attributes from untrusted input.
  • Review any allowlist or blacklist logic for URL schemes and event attributes to ensure javascript: and event handlers cannot pass through.
  • Dynamic and regression testing:
  • Include CCDA test fixtures containing controlled payloads in linkHtml elements to verify that dangerous attributes are neutralized.
  • Integrate automated browser-based tests that check rendered CCDA previews for blocked script execution.
  • Security policy enforcement:
  • Enforce template and view-layer guidelines that mandate context-aware encoding for all user- or externally supplied content.
  • Optionally employ Content Security Policy (CSP) in the application to limit the impact of any residual XSS in CCDA or other views.

Sources

SourceLink
github.comgithub.com/openemr/openemr/commit/95e6078889b5399b12b59117f998560cd94bd47d
github.comgithub.com/openemr/openemr/releases/tag/v8_0_0_3
github.comgithub.com/openemr/openemr/security/advisories/GHSA-g77x-9p3x-2j8f

Frequently asked

questions

Yes, if an attacker can remotely provide a CCDA document to the system (for example, via integrations, referrals, or other submission channels) and it is later previewed by a clinician, the attack can be triggered through the web interface.

Not necessarily. The key requirement is the ability to get a malicious CCDA document stored or processed by OpenEMR and then viewed by an authenticated user. In some deployments this may require authenticated access, while in others CCDA inputs may be accepted from external, less trusted systems.

Apply strict, context-aware output encoding and sanitization at the point where untrusted data is inserted into HTML, ensure that all markup transformation paths (including XSLT) treat external content as untrusted, and enforce a default-deny policy on tags, attributes, and URL schemes.

Standardize on secure templating and sanitization practices, treat all imported clinical documents and external feeds as untrusted, include XSS-focused tests in QA pipelines (e.g., with crafted payloads in CCDA or other structured formats), and regularly review transformation logic and templates for direct insertion of untrusted content into HTML.

Find out what's already
exploitable in your codebase.