I was excited this afternoon when I thought that I'd
stumbled upon a universal XSS vulnerability in verbose ColdFusion error
messages. While testing a site, I had noted that a verbose debug error message
(see below) echoed back many of the request headers, including the Referrer and
User-Agent (aka Browser) headers.
Error Occurred While Processing Request
Error Diagnostic Information
An error occurred while evaluating the expression:
#Form.XXX#
Error near line 5, column 20.
Error resolving parameter FORM.XXX
The specified form field cannot be found. This problem is very likely due
to the fact that you have misspelled the form field name.
The error occurred while processing an element with a general identifier
of (#Form.XXX#), occupying document position (5:19) to (5:33).
Date/Time: 03/22/07 22:36:03
Browser: Mozilla/4.0 (compatible; MSIE
6.0; Windows NT 5.1; SV1; .NET CLR 1.1.4322)
Remote Address: 69.255.12.149
HTTP Referer:
http://www.XXX.org:80/admin/
Query String: action=login&sub=validate
|
Naturally, curiosity got the best of me and I attempted to
inject JavaScript into the headers only to find that yes indeed, the injected
JavaScript was echoed back without being sanitized, which makes for a nice XSS
vulnerability on all ColdFusion sites which don't suppress such error messages.
Alas, my hopes were dashed when I realized that I'd been beaten to
the punch. Despite the setback, I was still curious to see how many sites
would be affected by the vulnerability and was blown away when my friend Google
suggested that the number may be in the six figure range.
Knowing that, my curiosity was peaked again, so I started
poking around to see if I could find other third party or custom web apps which
exposed XSS vulnerabilities by echoing back raw request headers. A bit of
creative Googling suggested that many have made the same mistake:
The moral of this story is that we must think broadly when
defining user input. Data does not need to come from a web form to be considered
user supplied input. Headers, cookies, hidden form fields, etc. all come from
the client and can therefore be manipulated by an attacker. When building web
apps, we need to define user input as ANYTHING that is sent from the client to
the server.
- michael
Posted
03-23-2007 12:35 AM
by
erik.peterson