CVE-2026-40507 OpenEMR < 8.3.0 Reflected XSS via templateHtml Parameter in Patient Portal
Attackers can execute arbitrary JavaScript in authenticated users' browsers via a crafted URL, potentially leading to session hijacking.
- Exploited in the wild
- Not known
- Login needed
- Not needed
- Attackable
- Over the internet
- Victim action needed
- A user has to click or open something
- Fix
- None listed
What is CVE-2026-40507?
CVE-2026-40507 is a medium-severity cross-site scripting vulnerability in openemr, published on 19 Aug 2026. An attacker can exploit it over the internet without logging in, and only if a user opens a file or follows a link.
Official description
OpenEMR before 8.3.0 contains a reflected cross-site scripting vulnerability in the patient portal template import handler. The templateHtml GET parameter is reflected into the page response without sanitization. An attacker can craft a URL that executes arbitrary JavaScript in the browser of any authenticated user with Forms Administration permissions who visits the link, enabling session hijacking.
Weakness: CWE-79
Which versions are affected by CVE-2026-40507?
How do I fix CVE-2026-40507?
No fix has been published for CVE-2026-40507 yet. Limit exposure of the affected software until one is available.
Escape output for the context it lands in and set a strict Content Security Policy. Upgrading the affected component is the real fix. More about Cross-site scripting.
Is CVE-2026-40507 being exploited?
It is not confirmed as exploited in the wild, but public exploit code for CVE-2026-40507 exists.
Sources
Also known as GHSA-pqfg-4hrq-q9jm, GHSA-rmmr-8498-463g.