CVE-2026-39508

Advanced Coupons for WooCommerce Coupons <= 4.7.1.1 - Authenticated (Contributor+) Stored Cross-Site Scripting

mediumImproper Neutralization of Input During Web Page Generation ('Cross-site Scripting')
6.4
CVSS Score
6.4
CVSS Score
medium
Severity
4.7.2
Patched in
19d
Time to patch

Description

The Advanced Coupons for WooCommerce Coupons plugin for WordPress is vulnerable to Stored Cross-Site Scripting in versions up to, and including, 4.7.1.1 due to insufficient input sanitization and output escaping. This makes it possible for authenticated attackers, with contributor-level access and above, to inject arbitrary web scripts in pages that will execute whenever a user accesses an injected page.

CVSS Vector Breakdown

CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:C/C:L/I:L/A:N
Attack Vector
Network
Attack Complexity
Low
Privileges Required
Low
User Interaction
None
Scope
Changed
Low
Confidentiality
Low
Integrity
None
Availability

Technical Details

Affected versions<=4.7.1.1
PublishedMarch 28, 2026
Last updatedApril 15, 2026

What Changed in the Fix

Changes introduced in v4.7.2

Loading patch diff...

Source Code

WordPress.org SVN
Research Plan
Unverified

']` somewhere. * Is there any other Contributor-accessible area? * What about Coupon Categories? * `Edit_Coupon::override_coupon_categories_parent_file` - This is for the admin UI. * `Coupon_Templates::register_coupon_templates_app_page`. * Actually, let's look at `Edi…

Show full research plan

']` somewhere.

*   Is there any other Contributor-accessible area?
*   What about Coupon Categories?
*   `Edit_Coupon::override_coupon_categories_parent_file` - This is for the admin UI.
*   `Coupon_Templates::register_coupon_templates_app_page`.
*   Actually, let's look at `Editor_Blocks.php`'s `render_coupons_by_category_block` again.
*   It takes `categories` from `$attributes`.
*   If `categories` is an array of IDs, no XSS.
*   But what if it takes other attributes?

*   I will provide a plan for both `acfw/single-coupon` and `acfw/coupons-category`.

*   Wait, "Contributor" doesn't have `manage_woocommerce`.
*   But they can edit "Posts".
*   If they can edit "Posts", they can use "Blocks".
*   This is the standard pattern for this type of vulnerability.

*   Let's check if the plugin has any shortcodes.
*   Gutenberg blocks usually have an equivalent shortcode.
*   I don't see `add_shortcode` in the snippets, but `Editor_Blocks.php` handles block rendering.

*   Wait, look at `Models/BOGO/Frontend.php`. `restrict_cart_
Research Findings
Static analysis — not yet PoC-verified

Summary

The Advanced Coupons for WooCommerce Coupons plugin for WordPress is vulnerable to Stored Cross-Site Scripting via Gutenberg blocks. Authenticated attackers with contributor-level permissions can inject arbitrary web scripts into posts through unsanitized block attributes (such as custom CSS classes) that are later rendered on the frontend.

Vulnerable Code

// Helpers/Helper_Functions.php (approx line 1217 in version 4.7.1.1)

        if ( $classname ) {
            $classnames[] = $classname;
        }

        $this->load_template(
            // ...

Security Fix

--- /home/deploy/wp-safety.org/data/plugin-versions/advanced-coupons-for-woocommerce-free/4.7.1.1/Helpers/Helper_Functions.php	2026-02-17 05:43:08.000000000 +0000
+++ /home/deploy/wp-safety.org/data/plugin-versions/advanced-coupons-for-woocommerce-free/4.7.2/Helpers/Helper_Functions.php	2026-03-23 03:05:34.000000000 +0000
@@ -735,6 +735,19 @@
     }
 
     /**
+     * Sanitize a space-separated string of CSS class names.
+     *
+     * @since 4.6.2
+     * @access public
+     *
+     * @param string $classes Space-separated CSS class names.
+     * @return array Array of sanitized class names.
+     */
+    public function sanitize_css_classes( $classes ) {
+        return array_map( 'sanitize_html_class', explode( ' ', $classes ) );
+    }
+
+    /**
      * Prepare setting fields for API.
      *
      * @since 1.2
@@ -1217,7 +1230,7 @@
         );
 
         if ( $classname ) {
-            $classnames[] = $classname;
+            $classnames = array_merge( $classnames, $this->sanitize_css_classes( $classname ) );
         }
 
         $this->load_template(

Exploit Outline

1. Authenticate to the WordPress site as a user with at least 'Contributor' level permissions. 2. Create a new Post or Page or edit an existing one. 3. Add one of the plugin's Gutenberg blocks, such as 'Advanced Coupons - Single Coupon' (`acfw/single-coupon`) or 'Advanced Coupons - Coupons Category' (`acfw/coupons-category`). 4. In the block's 'Advanced' settings tab, locate the 'Additional CSS class(es)' field. 5. Input a payload designed to break out of the HTML attribute context, such as: `" onmouseover="alert(1)" ` or `"><script>alert(document.domain)</script>`. 6. Save or Preview the post. The payload will be rendered on the frontend without proper sanitization, leading to script execution in the context of any user viewing the page.

Check if your site is affected.

Run a free security audit to detect vulnerable plugins, outdated versions, and misconfigurations.