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-12421 Overview
CVE-2024-12421 affects the Coupon Affiliates – Affiliate Plugin for WooCommerce for WordPress through version 5.16.7.1. The plugin fails to validate a value before passing it to WordPress do_shortcode, allowing unauthenticated attackers to execute arbitrary shortcodes. The same code path also enables Reflected Cross-Site Scripting (XSS). The vendor patched the Cross-Site Scripting issue in version 5.16.7.1 and the arbitrary shortcode execution in version 5.16.7.2. The weakness is classified as Improper Control of Generation of Code [CWE-94].
Critical Impact
Unauthenticated attackers can trigger arbitrary WordPress shortcodes and reflected script execution against site visitors, enabling content manipulation, information disclosure, and session abuse.
Affected Products
- Coupon Affiliates – Affiliate Plugin for WooCommerce (WordPress plugin, slug woo-coupon-usage)
- All versions up to and including 5.16.7.1 (arbitrary shortcode execution)
- Versions prior to 5.16.7.1 for the Reflected XSS variant
Discovery Timeline
- 2024-12-13 - CVE-2024-12421 published to the National Vulnerability Database (NVD)
- 2026-06-17 - Last updated in NVD database
Technical Details for CVE-2024-12421
Vulnerability Analysis
The plugin exposes an action handler that passes a user-controlled value into WordPress do_shortcode without proper validation. Because the handler is reachable without authentication, any remote visitor can supply arbitrary shortcode syntax for the server to render. Shortcodes in WordPress can invoke registered callbacks that render templates, pull data, or trigger plugin-specific actions, which gives attackers a flexible execution surface.
The identical input path also reflects attacker-controlled values back into the response. This produces a Reflected Cross-Site Scripting condition that executes in the browser of any user following a crafted link. Reflected payloads can hijack session cookies in non-HttpOnly contexts, perform actions as the victim, or stage phishing content on a trusted domain.
Root Cause
The root cause is missing input validation before invocation of do_shortcode in the user-coupons functionality (inc/functions/functions-user-coupons.php). The function trusts request parameters and renders them as shortcodes. This mirrors the [CWE-94] Improper Control of Generation of Code pattern applied to the WordPress shortcode subsystem.
Attack Vector
Exploitation requires only an HTTP request to the vulnerable endpoint. No authentication and no user interaction are needed for the shortcode execution variant. The Reflected XSS variant requires a victim to visit an attacker-crafted URL. Technical details are documented in the Wordfence Vulnerability Report and the vulnerable function is visible in the WordPress WooCoupon Functions Code.
Stop Remote Code Execution Before It Runs
Singularity™ Endpoint detects and blocks exploit attempts at machine speed, including zero-days and novel attack techniques.
Stop Exploit AttemptsDetection Methods for CVE-2024-12421
Indicators of Compromise
- HTTP requests to WooCommerce coupon affiliate endpoints containing bracketed shortcode syntax such as [ and ] in query parameters.
- Response bodies that echo unexpected HTML, <script> tags, or rendered output from unrelated WordPress shortcodes.
- Unusual outbound requests or new administrative content tied to shortcodes that reference other plugins, forms, or file-rendering tags.
Detection Strategies
- Inspect web server and WAF logs for unauthenticated GET or POST requests targeting the woo-coupon-usage plugin paths with shortcode delimiters in parameters.
- Enable WordPress audit logging to flag calls into do_shortcode originating from front-end request handlers.
- Correlate reflected parameter values with response content to identify XSS payload echoes.
Monitoring Recommendations
- Monitor for anomalous spikes of requests to the Coupon Affiliates plugin endpoints from single source addresses.
- Alert on responses containing <script> tags originating from pages that normally render static HTML.
- Track plugin version inventory across WordPress sites and alert when woo-coupon-usage is below 5.16.7.2.
How to Mitigate CVE-2024-12421
Immediate Actions Required
- Upgrade the Coupon Affiliates – Affiliate Plugin for WooCommerce to version 5.16.7.2 or later on every WordPress site.
- Audit recent HTTP logs for shortcode delimiters in request parameters targeting the plugin and investigate matches.
- Rotate any credentials or session tokens that may have been exposed through reflected script execution.
Patch Information
The vendor patched the Reflected XSS issue in version 5.16.7.1 and the arbitrary shortcode execution in version 5.16.7.2. Patch details are available in the WordPress Changeset History.
Workarounds
- Deactivate the Coupon Affiliates plugin until the upgrade to 5.16.7.2 is completed.
- Deploy a Web Application Firewall rule that blocks shortcode syntax ([, ]) in request parameters sent to the plugin endpoints.
- Restrict access to the vulnerable endpoints by IP allowlist on the reverse proxy where feasible.
# Configuration example: WP-CLI upgrade and verification
wp plugin update woo-coupon-usage --version=5.16.7.2
wp plugin get woo-coupon-usage --field=version
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

