Skip to main content

CVE-2021-25918: Cross-Site-Scripting in openemr

Medium
VulnerabilityCVE-2021-25918cvecve-2021-25918
Published: Mon Mar 22 2021 (03/22/2021, 19:33:12 UTC)
Source: CVE
Vendor/Project: n/a
Product: openemr

Description

In OpenEMR, versions 5.0.2 to 6.0.0 are vulnerable to Stored Cross-Site-Scripting (XSS) due to user input not being validated properly and rendered in the TOTP Authentication method page. A highly privileged attacker could inject arbitrary code into input fields when creating a new user.

AI-Powered Analysis

AILast updated: 06/25/2025, 11:02:05 UTC

Technical Analysis

CVE-2021-25918 is a Stored Cross-Site Scripting (XSS) vulnerability affecting OpenEMR versions 5.0.2 through 6.0.0. OpenEMR is an open-source electronic medical record and practice management software widely used in healthcare environments. The vulnerability arises from improper validation and sanitization of user input fields on the Time-based One-Time Password (TOTP) authentication method page. Specifically, a highly privileged attacker—such as an administrator or user with rights to create new users—can inject malicious JavaScript code into input fields when creating a new user account. This injected code is then stored and rendered in the TOTP authentication page, which is viewed by other users with access to this page. When the malicious script executes in the context of a victim's browser, it can lead to session hijacking, credential theft, or unauthorized actions performed on behalf of the victim. The CVSS v3.1 base score is 4.8 (medium severity), reflecting that the attack requires network access, low attack complexity, high privileges, and user interaction (victim must view the malicious page). The vulnerability impacts confidentiality and integrity but does not affect availability. No known public exploits have been reported, and no official patches are linked in the provided data, although remediation would typically involve input validation and output encoding to prevent script injection. Given the nature of OpenEMR as a healthcare application, exploitation could compromise sensitive patient data and disrupt secure authentication mechanisms.

Potential Impact

For European organizations, particularly healthcare providers using OpenEMR, this vulnerability poses a risk to patient data confidentiality and the integrity of authentication processes. Successful exploitation could allow attackers with administrative privileges to inject malicious scripts that compromise other users' sessions, potentially leading to unauthorized access to sensitive health records. This undermines trust in electronic health record systems and may violate stringent European data protection regulations such as GDPR. Although the vulnerability requires high privileges to exploit, insider threats or compromised administrative accounts could leverage this flaw to escalate attacks. The impact is heightened in environments where multi-factor authentication relies on TOTP, as the injection occurs in the TOTP authentication page, potentially weakening this security layer. While availability is not directly affected, the breach of confidentiality and integrity could lead to regulatory penalties, reputational damage, and operational disruptions in healthcare delivery.

Mitigation Recommendations

To mitigate this vulnerability, European healthcare organizations using affected OpenEMR versions should: 1) Immediately restrict administrative privileges to trusted personnel and enforce strong authentication to reduce the risk of privilege abuse. 2) Implement strict input validation and output encoding on all user input fields, especially those related to authentication methods, to prevent script injection. 3) Upgrade OpenEMR to a version where this vulnerability is patched; if no official patch is available, apply community or vendor-provided fixes that sanitize inputs on the TOTP authentication page. 4) Conduct regular security audits and code reviews focusing on authentication modules and user management interfaces. 5) Monitor logs for unusual administrative activities or unexpected user creations that could indicate exploitation attempts. 6) Educate administrators about the risks of XSS and the importance of cautious input handling. 7) Employ Content Security Policy (CSP) headers to limit the execution of unauthorized scripts in the application context. These measures go beyond generic advice by focusing on privilege management, targeted input sanitization, and monitoring specific to the TOTP authentication context.

Need more detailed analysis?Get Pro

Technical Details

Data Version
5.1
Assigner Short Name
Mend
Date Reserved
2021-01-22T00:00:00.000Z
Cisa Enriched
true
Cvss Version
3.1
State
PUBLISHED

Threat ID: 682d983ac4522896dcbeda8c

Added to database: 5/21/2025, 9:09:14 AM

Last enriched: 6/25/2025, 11:02:05 AM

Last updated: 8/1/2025, 5:43:12 PM

Views: 23

Actions

PRO

Updates to AI analysis are available only with a Pro account. Contact root@offseq.com for access.

Please log in to the Console to use AI analysis features.

Need enhanced features?

Contact root@offseq.com for Pro access with improved analysis and higher rate limits.

Latest Threats