Affiliate Program Suite — SliceWP Affiliates <= 1.2.6 - Unauthenticated Stored Cross-Site Scripting
Description
The Affiliate Program Suite — SliceWP Affiliates plugin for WordPress is vulnerable to Stored Cross-Site Scripting in versions up to, and including, 1.2.6 due to insufficient input sanitization and output escaping. This makes it possible for unauthenticated attackers 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:N/UI:N/S:C/C:L/I:L/A:NTechnical Details
What Changed in the Fix
Changes introduced in v1.2.7
Source Code
WordPress.org SVN# Exploitation Research Plan: CVE-2026-42653 (SliceWP Affiliates Stored XSS) ## 1. Vulnerability Summary The **Affiliate Program Suite — SliceWP Affiliates** plugin for WordPress is vulnerable to **Unauthenticated Stored Cross-Site Scripting (XSS)** in versions up to 1.2.6. The vulnerability exists…
Show full research plan
Exploitation Research Plan: CVE-2026-42653 (SliceWP Affiliates Stored XSS)
1. Vulnerability Summary
The Affiliate Program Suite — SliceWP Affiliates plugin for WordPress is vulnerable to Unauthenticated Stored Cross-Site Scripting (XSS) in versions up to 1.2.6. The vulnerability exists because the plugin tracks and stores visitor metadata (specifically the Referer header and potentially the Landing URL) without proper sanitization and subsequently displays this data in administrative and affiliate-facing list tables without output escaping. An unauthenticated attacker can inject a malicious script by visiting an affiliate link with a crafted Referer header.
2. Attack Vector Analysis
- Endpoint: Any public-facing WordPress page, specifically when appended with an affiliate tracking parameter.
- Vulnerable Parameter:
HTTP_REFERERheader. - Secondary Parameter: The URL path/query string (stored as
landing_url). - Authentication: None (Unauthenticated).
- Preconditions:
- The SliceWP plugin must be active.
- An affiliate must exist (to provide a valid tracking ID).
- Affiliate tracking must be enabled (default state).
3. Code Flow
- Entry Point: When a user visits the site, the plugin checks for an affiliate ID (usually via
$_GET['slicewp_aff']). - Tracking Logic (Inferred): The plugin captures the visit details using
$_SERVER['HTTP_REFERER']and the current URL. - Storage Sink: These values are passed to a storage function (e.g.,
slicewp_add_visit()) which inserts a record into thewp_slicewp_visitsdatabase table. - Display Sink (Admin): An administrator navigates to
SliceWP->Visits. The classSliceWP_WP_List_Table_Visits(found inincludes/admin/visits/class-list-table-visits.php) retrieves the records usingslicewp_get_visits(). - Display Sink (Affiliate): An affiliate logs into their account and views the "Visits" tab. The class
SliceWP_List_Table_Affiliate_Account_Visits(found inincludes/users/class-list-table-affiliate-account-visits.php) displays the data. - The Flaw: In
get_columns(), the keyslanding_urlandreferrer_urlare defined. The plugin lacks specificcolumn_referrer_url()orcolumn_landing_url()methods that implementesc_html()oresc_url(), causing the parent class (SliceWP_WP_List_Table) to output the raw database values.
4. Nonce Acquisition Strategy
This vulnerability does not require a nonce for the injection phase. The injection occurs during the unauthenticated visit-tracking process, which must remain accessible to new visitors without CSRF protection to function correctly.
To verify the payload execution (execution phase), the agent will need to be logged in as an Admin or an Affiliate. No nonce is required to simply view the list tables.
5. Exploitation Strategy
Step 1: Identify Affiliate ID
We need a valid affiliate ID to trigger the tracking logic.
# Get the first available affiliate ID
wp slicewp affiliate list --fields=id --format=csv | tail -n 1
Step 2: Inject Payload (Unauthenticated)
We will send a request to the homepage with the affiliate tracking parameter and a malicious Referer header.
- URL:
http://localhost:8080/?slicewp_aff=[AFFILIATE_ID] - Method:
GET - Headers:
Referer: <img src=x onerror=alert("XSS_REFERRER")>User-Agent: Mozilla/5.0 ...
Step 3: Trigger Execution (Admin Context)
The payload executes when an administrator views the visit logs.
- Action: Log in as Admin and navigate to
/wp-admin/admin.php?page=slicewp-visits. - Tool:
browser_navigatefollowed by checking for the alert/DOM element.
6. Test Data Setup
- Create an Affiliate: Ensure at least one affiliate exists.
# Create a user and register them as an affiliate wp user create affiliate_user affiliate@example.com --role=subscriber --user_pass=password # (Assuming SliceWP CLI or manual DB insert for affiliate registration if needed) wp db query "INSERT INTO wp_slicewp_affiliates (user_id, status, date_created) VALUES (2, 'active', NOW());" - Enable Tracking: Ensure tracking is not disabled in SliceWP settings.
7. Expected Results
- The
http_request(Step 2) should return a200 OK. - The database query
SELECT referrer_url FROM wp_slicewp_visits ORDER BY id DESC LIMIT 1;should show the raw XSS payload. - When navigating to the admin visits page, the browser should execute the JavaScript in the
onerrorhandler of the injected<img>tag.
8. Verification Steps
After performing the HTTP request, verify storage:
# Check the visits table for the injected payload
wp db query "SELECT id, referrer_url, landing_url FROM wp_slicewp_visits ORDER BY id DESC LIMIT 1;"
Verify rendering (via browser_eval after navigating to the admin page):
// Check if the payload exists in the table cells
browser_eval("document.querySelector('.referrer_url').innerHTML.includes('<img src=x')")
9. Alternative Approaches
If the Referer header is sanitized, try injecting into the Landing URL by manipulating the query string:
- URL:
http://localhost:8080/?slicewp_aff=[ID]&ignore="><script>alert('XSS_LANDING')</script> - Affiliate plugins often store the entire
REQUEST_URIas thelanding_url. If the table renders thelanding_urlcolumn without escaping, the script will execute.
Summary
The SliceWP Affiliates plugin for WordPress is vulnerable to unauthenticated Stored Cross-Site Scripting due to insufficient input sanitization and output escaping of visitor tracking data. An attacker can inject malicious scripts into the 'Referer' header or landing URL parameters, which are then executed when an administrator or affiliate views the visit logs in the dashboard.
Vulnerable Code
// includes/admin/visits/class-list-table-visits.php line 271 public function column_landing_url( $item ) { $output = '<a href="' . esc_url_raw( $item['landing_url'] ) . '" target="_blank">' . rawurldecode( $item['landing_url'] ) . '</a>'; return $output; } --- // includes/admin/visits/class-list-table-visits.php line 288 public function column_referrer_url( $item ) { $output = '<a href="' . esc_url_raw( $item['referrer_url'] ) . '" target="_blank">' . rawurldecode( $item['referrer_url'] ) . '</a>'; return $output; }
Security Fix
@@ -270,7 +270,7 @@ */ public function column_landing_url( $item ) { - $output = '<a href="' . esc_url_raw( $item['landing_url'] ) . '" target="_blank">' . rawurldecode( $item['landing_url'] ) . '</a>'; + $output = '<a href="' . esc_url_raw( $item['landing_url'] ) . '" target="_blank">' . esc_html( rawurldecode( $item['landing_url'] ) ) . '</a>'; return $output; @@ -287,7 +287,7 @@ */ public function column_referrer_url( $item ) { - $output = '<a href="' . esc_url_raw( $item['referrer_url'] ) . '" target="_blank">' . rawurldecode( $item['referrer_url'] ) . '</a>'; + $output = '<a href="' . esc_url_raw( $item['referrer_url'] ) . '" target="_blank">' . esc_html( rawurldecode( $item['referrer_url'] ) ) . '</a>'; return $output; Only in /home/deploy/wp-safety.org/data/plugin-versions/slicewp/1.2.7/includes/users: class-list-table-affiliate-account-visits.php @@ -67,6 +67,21 @@ /** + * Column "referrer_url". + * + * @param array $item + * + * @return string + * + */ + public function column_referrer_url( $item ) { + + return esc_html( ! empty( $item['referrer_url'] ) ? $item['referrer_url'] : '-' ); + + } + + + /**
Exploit Outline
The exploit is unauthenticated and follows these steps: 1. Identify a valid affiliate ID by visiting the site and looking for tracking parameters (e.g., `?slicewp_aff=1`). 2. Perform a GET request to the site using the affiliate parameter while crafting a malicious payload inside the `Referer` HTTP header (e.g., `<img src=x onerror=alert(document.domain)>`). 3. The plugin captures this metadata and saves it to the `wp_slicewp_visits` database table. 4. Wait for an administrator to view the visit logs in the WordPress backend at `/wp-admin/admin.php?page=slicewp-visits`. 5. Upon loading the page, the unsanitized database entry is rendered into the list table, executing the JavaScript payload in the administrator's browser context.
Check if your site is affected.
Run a free security audit to detect vulnerable plugins, outdated versions, and misconfigurations.