Alternate XSS Syntax

From OWASP
Revision as of 07:11, 26 May 2009 by Deleted user (Talk | contribs)

Jump to: navigation, search

[http://s1.shard.jp/losaul/australia-day.html live tennis updates australian open ] [http://s1.shard.jp/frhorton/78vbl98c2.html africa urbanization ] [http://s1.shard.jp/olharder/3-auto-geneva.html automotive trim screws ] [http://s1.shard.jp/bireba/kaspersky-antivirus.html pc cillin antivirus updates ] [http://s1.shard.jp/bireba/symantec-antivirus.html mccaffrey antivirus ] [http://s1.shard.jp/olharder/route-66-auto.html digital auto compass ] [http://s1.shard.jp/olharder/auto-classifieds.html auto tradder canada ] page [http://s1.shard.jp/bireba/antivirus-freeware.html crack for panda titanium antivirus 2005 ] [http://s1.shard.jp/frhorton/5hrrb99yl.html downhill adventures south africa ] [http://s1.shard.jp/losaul/australian-walkabout.html water coolers australia ] url [http://s1.shard.jp/galeach/new71.html asian diva girl lili ] [http://s1.shard.jp/galeach/new53.html asia disabled regional society ] [http://s1.shard.jp/bireba/antivirus-software.html norton antivirus 2005 serial keys ] coastlines of australia [http://s1.shard.jp/bireba/nod-antivirus.html openantivirus ] [http://s1.shard.jp/bireba/antivirus-services.html nod32 antivirus system ] [http://s1.shard.jp/olharder/automated-gasoline.html by design auto burlington ] top [http://s1.shard.jp/losaul/2006-australia.html sa vs australia latest score ] [http://s1.shard.jp/bireba/avg-antivirus-7.html norton antivirus 2006 keygen ] [http://s1.shard.jp/losaul/australia-stables.html australia wear work ] [http://s1.shard.jp/galeach/new54.html asian dominatrixs ] [http://s1.shard.jp/bireba/download-antivirus.html av antivirus free ] [http://s1.shard.jp/losaul/i-still-call-australia.html australia bulldozers heavy in machinery ] [http://s1.shard.jp/bireba/norton-antivirus.html pc cillin 2000 antivirus ] [http://s1.shard.jp/losaul/physiotherapy-colleges.html australia open home page ] [http://s1.shard.jp/frhorton/fhh2j9s8e.html african location tribe tribe ] [http://s1.shard.jp/frhorton/77murrpay.html what are 3 great african americans in arts ] [http://s1.shard.jp/bireba/panda-titanium.html pc cillan antivirus ] [http://s1.shard.jp/olharder/automatic-dc-queue.html autoweekly.com ] [http://s1.shard.jp/bireba/norton-antivirus.html center.antivirusoverride security window ] [http://s1.shard.jp/bireba/antivirus-software.html win antivirus pro reviews ] [http://s1.shard.jp/bireba/norton-antivirus.html avg+antivirus+free ] [http://s1.shard.jp/galeach/new180.html hypoplasia dictionary ] [http://s1.shard.jp/bireba/extendia-antivirus.html norton antivirus download rebate ] [http://s1.shard.jp/olharder/automotive-repair.html auto insurance massachusetts online ] [http://s1.shard.jp/galeach/new166.html asian appetizer ] [http://s1.shard.jp/galeach/new16.html asia carrera movie download ] http [http://s1.shard.jp/bireba/top-antivirus.html antivirus trialware download ] [http://s1.shard.jp/olharder/ontegra-automotive.html automation home screen touch ] [http://s1.shard.jp/losaul/australian-journal.html australian currency ] [http://s1.shard.jp/galeach/new196.html travel agents for asia and australia in toronto ] [http://s1.shard.jp/frhorton/vjlche4gq.html mtn group south africa ] antivirus stop sign time difference uk australia [http://s1.shard.jp/frhorton/ndbzagarh.html african furniture inspired ] http://www.texttrocdarv.com


This page was marked to be reviewed for deletion.


#REDIRECT Cross-site_Scripting_(XSS)


Last revision (mm/dd/yy): 05/26/2009


Related Security Activities

Description of Cross-site Scripting Vulnerabilities

See the OWASP article on Cross-site Scripting (XSS) Vulnerabilities.

How to Avoid Cross-site scripting Vulnerabilities

See the OWASP Development Guide article on Phishing.

See the OWASP Development Guide article on Data Validation.

How to Review Code for Cross-site scripting Vulnerabilities

See the OWASP Code Review Guide article on how to Avoid Reviewing code for Cross-site scripting Vulnerabilities.

How to Test for Cross-site scripting Vulnerabilities

See the OWASP Testing Guide article on how to Test for Cross site scripting Vulnerabilities.



Description

Cross-site Scripting (XSS) attacks have to pass two hurdles. First they must get through the application without being filtered, validated, or encoded in a way that prevents them from executing. Second, they much be carefully crafted so that they seamlessly insert their payload into the HTML document so that it will run when loaded by the browser.

Cross Site Scripting is not just <script>alert('XSS');</script>. Because of JavaScript and HTML flexibility and their interpretation by the web browsers, it's possible to achieve the same goal in many different ways. These attacks extend the basic XSS attacks with a number of alternate encodings to help them pass through the application.

In effect we may try to bypass more or less successful input data filtering methods. Some JavaScript and HTML constructions after encoding are correctly interpreted by some browsers, nonetheless it often varies on the web browser version, and others are not.

If we want to use popular <script> tags anyway, we may try to bypass filtering replacing given characters with their equivalents:

From To
<    &lt;
>    &gt;
(    &#40;
)    &#41;
#    &#35;
&    &amp;
"    &quot;

In this case:

 <script>alert('y0u ar3 0wn3d!');</script>

would be replaced with:

&lt;script&gt;alert&#40;'y0u ar3 0wn3d!'&#41;&lt;/script&gt;

In most contexts this encoded string will not execute. However there are some environments, particularly Ajax and XML processing engines, that will automatically decode these encoded characters and allow the attack to execute.

We don't need to do replacement at all, we may get the same effect in many different ways.

Risk Factors

Examples

XSS using Script in Attributes

XSS attacks may be conducted without using <script></script> tags. Other tags will do exacly the same thing, e.g.:

<body onload=alert('test1')>

or other attribites like: onmouseover, onerror.

onmouseover

<b onmouseover=alert('Wufff!')>click me!</b>

onerror

<img src="http://url.to.file.which/not.exist" onerror=alert(document.cookie);>


XSS using Script Via Encoded URI Schemes

If we need to hide against web application filters we may try to encode string characters, e.g.: a=&#X41 (UTF-8) and use it in IMG tag:

<IMG SRC=j&#X41vascript:alert('test2')>

There are many different UTF-8 encoding notations what give us even more possibilities.


XSS using code encoding

We may encode our script in base64 and place it in META tag. This way we get rid of alert() totally. More information about this method can be found in RFC 2397

<META HTTP-EQUIV="refresh"
CONTENT="0;url=data:text/html;base64,PHNjcmlwdD5hbGVydCgndGVzdDMnKTwvc2NyaXB0Pg">

These (just a little modified by me) and others examples can be found on http://ha.ckers.org/xss.html, which is a true encyclopedia of the alternate XSS syntax attack.


Related Threat Agents

  • TBD

Related Attacks

Related Vulnerabilities

Related Controls

  • HTML Entity Encoding
  • Use whitelists and if possible specify detailed format of the expected output data.

References