Skip to main content
Vulnerability Database/CVE-2024-11330

CVE-2024-11330: WordPress Custom CSS, JS & PHP XSS Flaw

CVE-2024-11330 is a reflected cross-site scripting vulnerability in the WordPress Custom CSS, JS & PHP plugin that lets attackers inject malicious scripts. This article covers technical details, affected versions, and mitigation.

Published:

Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.

Sources: National Vulnerability Database, CISA KEV, Exploit-DB

CVE-2024-11330 Overview

CVE-2024-11330 is a Reflected Cross-Site Scripting (XSS) vulnerability affecting the Custom CSS, JS & PHP plugin for WordPress. The flaw exists in all plugin versions up to and including 2.3.0. The root cause is the unsafe use of add_query_arg and remove_query_arg without proper URL escaping. Unauthenticated attackers can inject arbitrary web scripts that execute in a victim's browser when the victim clicks a crafted link. The issue is tracked under CWE-79: Improper Neutralization of Input During Web Page Generation.

Critical Impact

Successful exploitation allows unauthenticated attackers to execute arbitrary JavaScript in the context of an authenticated administrator's session, enabling session theft, account takeover, or malicious redirects.

Affected Products

  • WordPress Custom CSS, JS & PHP plugin versions ≤ 2.3.0
  • Vulnerable file: includes/settings/class-alg-custom-css-js-php-settings.php
  • Any WordPress site exposing the plugin's settings pages to administrators

Discovery Timeline

  • 2024-11-23 - CVE-2024-11330 published to NVD
  • 2026-06-17 - Last updated in NVD database

Technical Details for CVE-2024-11330

Vulnerability Analysis

The vulnerability is a classic reflected XSS pattern in WordPress plugin development. The Custom CSS, JS & PHP plugin builds administrative URLs using WordPress helper functions add_query_arg() and remove_query_arg(). Both functions reuse the current request URI when no explicit URL is supplied. Attacker-controlled query string data therefore flows into generated links without being escaped on output. The injected payload executes when an authenticated user interacts with the crafted link in the plugin's settings page. See the vulnerable code at class-alg-custom-css-js-php-settings.php line 299.

Root Cause

The plugin passes the output of add_query_arg and remove_query_arg directly into HTML attributes without wrapping it in esc_url(). WordPress documentation explicitly warns that these functions do not sanitize their input and that the returned URL must be escaped before being echoed into markup. Omitting esc_url() allows attributes such as href to carry attacker-supplied payloads containing script-breaking characters.

Attack Vector

Exploitation requires user interaction. An attacker crafts a URL to the plugin's settings page containing a malicious query parameter, then convinces a logged-in site administrator to click the link through phishing, forum posts, or social engineering. When the plugin renders the settings page, the unescaped query parameter is reflected into the DOM and the injected JavaScript executes under the administrator's origin. The attacker can then exfiltrate authentication cookies, create rogue administrators, or modify site content.

The vendor fix is documented in the plugin changeset 3194786, which wraps the vulnerable URL output with proper escaping. See the Wordfence Vulnerability Report for additional analysis.

Detection Methods for CVE-2024-11330

Indicators of Compromise

  • Web server access logs containing requests to the plugin's admin pages with query strings holding HTML or JavaScript syntax such as "><script>, onerror=, or javascript:
  • Outbound requests from administrator browsers to unfamiliar domains immediately after loading plugin settings pages
  • Creation of unexpected WordPress administrator accounts or modification of plugin settings outside authorized change windows

Detection Strategies

  • Inspect HTTP referer and request URI fields for encoded script payloads targeting wp-admin endpoints associated with the Custom CSS, JS & PHP plugin
  • Deploy a web application firewall rule that blocks reflected XSS patterns against wp-admin/admin.php?page= requests tied to the plugin slug custom-css
  • Correlate administrator session anomalies, such as unusual IP changes or new API tokens, with recent clicks on externally sourced WordPress admin links

Monitoring Recommendations

  • Enable WordPress audit logging for user, role, and plugin configuration changes to detect post-exploitation activity
  • Alert on administrator browsers executing scripts loaded from third-party domains during authenticated wp-admin sessions
  • Monitor plugin version inventory across managed WordPress sites and flag any instance still running Custom CSS, JS & PHP ≤ 2.3.0

How to Mitigate CVE-2024-11330

Immediate Actions Required

  • Update the Custom CSS, JS & PHP plugin to the version released after plugin changeset 3194786, which introduces proper URL escaping
  • Audit WordPress administrator accounts, API keys, and application passwords for signs of unauthorized use since November 2024
  • Train administrators to avoid clicking wp-admin links received through untrusted channels until patching is confirmed

Patch Information

The vendor remediated the issue in the changeset published at plugins.trac.wordpress.org/changeset/3194786. The fix applies esc_url() to values produced by add_query_arg and remove_query_arg before rendering them in administrative markup. Upgrade to the latest plugin release available in the WordPress plugin repository.

Workarounds

  • Temporarily deactivate the Custom CSS, JS & PHP plugin on sites that cannot be patched immediately
  • Restrict access to wp-admin by source IP using web server or firewall rules to limit who can reach the vulnerable settings page
  • Deploy a web application firewall signature that blocks query parameters containing HTML tags or javascript: schemes on plugin admin endpoints
bash
# Example WP-CLI commands to inventory and update the vulnerable plugin
wp plugin list --name=custom-css --fields=name,status,version
wp plugin update custom-css
wp plugin deactivate custom-css   # fallback if the patched version cannot be installed

Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.

Sources: National Vulnerability Database, CISA KEV, Exploit-DB

Experience the Most Advanced Cybersecurity Platform

See how the world’s most intelligent, autonomous cybersecurity platform can protect your organization today and into the future.