Ping pong obfuscation
Monday, 23 November 2009
This is a fun post about a feature I found in IE that allows you to do some crazy obfuscation. I’ll start off with some simple examples:-
<img src=1 language=vbs onerror=msgbox+1>
<img src=1 language=vbscript onerror=msgbox+1>
<img src=1 onerror=vbs:msgbox+1>
So here we’re not obfuscating but I’m showing how IE accepts the language attribute and a labelled vbs statement to change the event to allow vbscript instead of javascript. Ok so lets play a little ping pong:-
execScript("MsgBox 1","vbscript"); //executes vbs from js
execScript('execScript "alert(1)","javascript"',"vbscript");
Look how we can call vbscript from javascript by using execScript and then look how we can execute from javascript to vbscript and then back to javascript again! So now we’re playing some ping pong but how can we make our little game hidden?
<a href=# language="JScript.Encode" onclick="#@~^CAAAAA==C^+.D`8#mgIAAA==^#~@">test</a>
Wait what? Yeah IE supports jscript.encode within the language attribute. Remember jscript.encode? ah the old ones are the best 🙂 That’s it right? Well….
<iframe onload=VBScript.Encode:#@~^CAAAAA==\ko$K6,FoQIAAA==^#~@>
Yeah you can use VBScript.Encode and Javascript.Encode as labels within an event! You might be going WTF right now and I can understand it because I did exactly the same but it would be silly to finish now without finishing our game of ping pong. How many rallies shall I do? I think 3 should be enough….
<body onload="jscript.encode:#@~^TAAAAA==nX+^UmMkwD`r:@$?73hzb)){'Z%QRG=2	V7WB qdG\:2jbebz)'{7:=@$J~E%km.kaOc+U1W9+J*CRcAAA==^#~@">
Ok so I go to:-
jscript->jscript.encode->jscript.encode->jscript.encode->hex entities
No. 1 — November 23rd, 2009 at 2:08 pm
If http://www.greymagic.com/security/tools/decoder/ isn’t lying to me you encoded only twice. Still – oh my, will MS ever throw this crap away? And by “crap” I mean both VBS in a browser and this useless JScript.Encode. But I guess, even with the web moving away from proprietary technologies there are still applications using the IE engine that use VBS. Who knows, I wouldn’t be surprised if those even use VBScript.Encode to “protect” their application “source code”.
No. 2 — November 23rd, 2009 at 2:17 pm
@Wladimir
Ah yeah you’re right I forgot to encode the last step but it worked anyway heh. Personally I love obscure features and I think every browser should add their own javascript and css features oh wait… they do 🙂
No. 3 — November 24th, 2009 at 7:12 am
The RSS feed they publish on the OWASP homepage is executing VBScript popups in IE from your post. LOL. http://www.owasp.org/index.php/Main_Page
No. 4 — November 24th, 2009 at 8:43 am
@Holyfield
LOL I XSS sites now without trying