LSO Crackme 0×03 Solution

Posted by Eric | Crackme, Reversing | Sunday 27 April 2008 6:02 pm

<meta content="OpenOffice.org 2.0 (Linux)" name="GENERATOR" /><meta content="20080427;15494200" name="CREATED" /><meta content="20080427;16445500" name="CHANGED" /> <br /> <style> <!-- @page { size: 8.5in 11in; margin: 0.79in } P { margin-bottom: 0.08in } --> </style> <p style="margin-bottom: 0in">Learnsecurityonline.com released Crackme 0×03 at the beginning of the month and I ended up knocking it out in about 20-30 minutes after it was posted and posting a screen shot on the blog. This is the write up following that screen shot with the method of how I approached the crackme.</p> <p style="margin-bottom: 0in"> <p style="margin-bottom: 0in"> <p style="margin-bottom: 0in">All we had was a binary, and we did not know much about it. Our goal was to solve the Crackme via the given binary. The instructions were vague, the functionality was vague. We are forced to execute the program to determine both it’s functionality and our objective. When we start the binary we are shown a small window with three buttons and the instructions “Find a way to play the above tones to pass”.</p> <p style="margin-bottom: 0in"> <img src="http://hamsterswheel.com/pictures/blog/crackme3-1.JPG" /></p> <p style="margin-bottom: 0in"> <p style="margin-bottom: 0in">Pressing the button play tone delivers us a MessageBox that tells us the tones don’t match. Listening to the tones from the three buttons, and having pressed the “play this tone” button you can tell that the tones are by no way the same. This means it’s impossible to generate the stored tone with the buttons provided.</p> <p style="margin-bottom: 0in">At this point I wanted to open up the binary and take a look at how it was doing its magic. Checking it for a Packer revealed nothing with the standard PE identifiers. I ran it through my standard three, none of which came up with anything. PEID did however, mention that it was built in Visual Studio using .net. Instead of loading it up with Ida Pro or Ollydbg I decided to open it with .Net Reflector[1]. I then chose to Disassemble the Binary. As I was walking through the disassembled code I noticed class references to NetZ. Curious as to what the hell it was I googled Netz and found out that the binary was after all Compressed with this Open Source .Net Packer called Netz and that the disassembly code I was looking at was the code for the Packer. Ok, back to google I ended up searching real quick for an Unpacker for Netz. Nothing turned up. SHIT!</p> <p style="margin-bottom: 0in"> <p style="margin-bottom: 0in">Tebo mentioned that the RSS feed for Woodmann’s collaborative RCE tools had popped up a Generic .Net Unpacker[2]. My only other option was to Manually unpack the binary… Well screw that I will give this Generic .Net Unpacker a shot. It ended up working great, and I was able to load up one of the output binaries into .Net Reflector and disassemble it to about 90% of the original source. That’s truly the beauty of .Net code and .Net Reflector, you don’t have to muck around in too much assembly because you can disassemble straight to source, minus the variable names some times. Going through the code for Form 1, we find the Play_Click function and take a peak at the functionality.</p> <p style="margin-bottom: 0in"> <p style="margin-bottom: 0in"><img src="http://hamsterswheel.com/pictures/blog/crackme3-2.JPG" /></p> <p style="margin-bottom: 0in"> <p style="margin-bottom: 0in">If you take notice, there is a single if statement that checks the values of the NumArray2[] to be set too 300,600,900. But if you pay attention the values set to numArray2[] are 250,500, and 0×3e8. No where in the code is there a place to change the tone values on that Array (which in case you weren’t paying attention correspond to Button 1, 2 and 3.)</p> <p style="margin-bottom: 0in"> <p style="margin-bottom: 0in">At this point I knew I needed to change the values in that array. But I am lazy.. Real lazy so I didn’t feel like walking through it with Ollydbg, and manually changing the value. I found something called Reflexil[3] which is an assembly editor that runs as a plugin for .Net reflector. This tool allowed me to go in and modify the values in that array to what we needed, then save the program with the modifications.</p> <p style="margin-bottom: 0in"> <p style="margin-bottom: 0in"><img src="http://hamsterswheel.com/pictures/blog/crackme3-3.JPG" /></p> <p style="margin-bottom: 0in"> <p style="margin-bottom: 0in">Turning around and saving the file, we can then run the program and just press play. Pushing buttons 1,2, and 3 doesn’t really matter because the logic in the program doesn’t even check to see if you pushed any buttons.</p> <p style="margin-bottom: 0in"> <p style="margin-bottom: 0in">And we get our Win!</p> <p style="margin-bottom: 0in"> <img src="http://hamsterswheel.com/re/crackme3.JPG" /></p> <p>[1] .Net Reflector – http://www.aisto.com/roeder/dotnet/</p> <p>[2] Generic .Net Unpacker – http://www.woodmann.net/collaborative/tools/index.php/.NET_Generic_Unpacker</p> <p>[3] Reflexil – http://sebastien.lebreton.free.fr/reflexil/</p> </div> <div class="feedback"> <a href="http://hamsterswheel.com/techblog/?p=61#respond" title="Comment on LSO Crackme 0×03 Solution">Comments (0)</a> </div> </div> <div class="post"> <h2 id="post-60"><a href="http://hamsterswheel.com/techblog/?p=60" rel="bookmark">Damn thought I had one.</a></h2> <div class="meta">Posted by Eric | <a href="http://hamsterswheel.com/techblog/?cat=15" title="View all posts in Fuzzing" rel="category">Fuzzing</a>, <a href="http://hamsterswheel.com/techblog/?cat=11" title="View all posts in Research" rel="category">Research</a>, <a href="http://hamsterswheel.com/techblog/?cat=9" title="View all posts in Vulnerabilities" rel="category">Vulnerabilities</a> | Tuesday 15 April 2008 8:43 am </div> <div class="storycontent"> <p><meta content="text/html; charset=utf-8" http-equiv="CONTENT-TYPE" /><title /><meta content="OpenOffice.org 2.0 (Linux)" name="GENERATOR" /><meta content="20080415;7265400" name="CREATED" /><meta content="16010101;0" name="CHANGED" /><br /> <style> <!-- @page { size: 8.5in 11in; margin: 0.79in } P { margin-bottom: 0.08in } --> </style> <p style="margin-bottom: 0in">Been busy running around lately, and now the mother in law and family is in town, theoretically the wife will be occupied with that. I created a pop3 request for Sulley and I’ve been back tracking and hitting the pop3 service on a few of the Mail servers that I have downloaded and hit with the SMTP requests. Last week I discovered a weird bug that seemed random at best and after a while of getting frustrated I asked MC for an assist. MC Tracked down the bug despite not being able to get it to crash. Turned out there was already an advisory on it, and it was an incorrect handling of connections. Basically the Application (baby pop3) was not handling multiple connections from the same host correctly and would result in a crash. On the vendors website there were quite a few other applications in this baby series and I’m pretty sure they are using the same template for code because I was able to get the web server to crash also.</p> <p style="margin-bottom: 0in"> <p style="margin-bottom: 0in">Last night I discovered an XSS bug in a vendor site. I actually completely stumbled on it. I was messing with a mail server, browsing around and looking for inputs (this thing opens about 12 ports upon install) and I came across the web application on port 7026. Most of the pages required authentication, but the help pages didn’t. Within the Help index there was a search box for “on line search.” When you put Javascript into the search box and hit enter, you are taken to the vendors site (shown your alert text box) and then get some errors on search string not found. I kicked off an email to the vendor and they responded back in like 15 minutes, but have yet to ACK FIN saying it was fixed.</p> <p style="margin-bottom: 0in"> <p style="margin-bottom: 0in">I continue hitting up that same application, It’s got an smtp, a pop3 and about 4 web interfaces. I noticed that the webmail is actually accessible via a path that leads to webmail.exe?cmd= . Currently fuzzing the admin.cgi ones, but I plan to start fuzzing the webmail.exe input this evening when I get home.</p> <p style="margin-bottom: 0in"> <p style="margin-bottom: 0in">I need to start working on a short presentation for AHA! I’m debating on talking about the Fuzzing ( a lot of those guys work for dvlabs so I dunno) or I can talk about embedded debugging. On one hand, If i talk about fuzzing, I can segway that into the question of “How can I analyze these crashes better” because the scripts with sulley haven’t been working out for me. Or the “Has anyone done any Fuzzing on embedded systems, and if so how did you go about analyzing the crash.” On the other hand, I can just go straight into Embedded debugging and ask that question anyway. Of course I still need a few hundred bucks from Dean to sponsor more research….</p> <p style="margin-bottom: 0in"> <p style="margin-bottom: 0in"> <p style="margin-bottom: 0in">Thanks again to MC for checking out that bug.</p> <p style="margin-bottom: 0in"> </div> <div class="feedback"> <a href="http://hamsterswheel.com/techblog/?p=60#respond" title="Comment on Damn thought I had one.">Comments (0)</a> </div> </div> <div class="post"> <h2 id="post-59"><a href="http://hamsterswheel.com/techblog/?p=59" rel="bookmark">LSO Crackme 0×03</a></h2> <div class="meta">Posted by Eric | <a href="http://hamsterswheel.com/techblog/?cat=13" title="View all posts in Reversing" rel="category">Reversing</a> | Tuesday 8 April 2008 11:20 pm </div> <div class="storycontent"> <p>LSO Just posted the Third <a href="http://learnsecurityonline.com/index.php?option=com_content&task=view&id=298&Itemid=1">crackme</a> not too long ago. I took a stab at it this evening. Shouts to Tebo for hooking up the unpacking script and saving my ass from having to MUP it.</p> <p>I promised the author I wouldn’t release the solution for a few weeks since it literally just got posted, so here’s a teaser.</p> <p><img src="http://hamsterswheel.com/re/crackme3.JPG" /></p> </div> <div class="feedback"> <a href="http://hamsterswheel.com/techblog/?p=59#respond" title="Comment on LSO Crackme 0×03">Comments (0)</a> </div> </div> <div class="post"> <h2 id="post-58"><a href="http://hamsterswheel.com/techblog/?p=58" rel="bookmark">Awww Shixxnote</a></h2> <div class="meta">Posted by Eric | <a href="http://hamsterswheel.com/techblog/?cat=15" title="View all posts in Fuzzing" rel="category">Fuzzing</a>, <a href="http://hamsterswheel.com/techblog/?cat=11" title="View all posts in Research" rel="category">Research</a> | Sunday 6 April 2008 1:12 am </div> <div class="storycontent"> <p><meta content="text/html; charset=utf-8" http-equiv="CONTENT-TYPE" /><title /><meta content="OpenOffice.org 2.0 (Linux)" name="GENERATOR" /><meta content="20080405;23434700" name="CREATED" /><meta content="20080405;23592900" name="CHANGED" /><br /> <style> <!-- @page { size: 8.5in 11in; margin: 0.79in } P { margin-bottom: 0.08in } --> </style> <p style="margin-bottom: 0in">Recently I watched a Keynote by Dave Aitel, in it he discussed the Hacker mindset. One of the things he pointed out was when a new vulnerability comes out to make sure your fuzzer can pick it up, and if not figure out why and then make the fuzzer pick up the vuln. Shixxnote 6.net had a <a href="http://secunia.com/advisories/12822/">buffer overflow</a>  quite a while ago by Luigi A who is amazing at finding vulns, I’ve Rss’ed to his site and That dude kicks out an average of two per day. I still had the software in my vuln software bank and I decided I’d break it out and play with it for the evening.</p> <p style="margin-bottom: 0in"> <p style="margin-bottom: 0in">The concept behind shixxnote is simple, you can create notes for yourself and even send them to other uses on a network. If the other user doesn’t have the software, it will default to sending it via the Messenger service. You can assume it runs over messenger service, but in reality it does that by default and has it’s own little protocol going on. No documentation available we turn to wireshark. Wireshark has this amazing ability at decoding data/ protocols. Unfortunately Wireshark had no f00 when it came to shixxnote. I installed shixxnote on two different boxes and sent a message to each other and sniffed the traffic. This is what I got:</p> <p style="margin-bottom: 0in"><img src="http://hamsterswheel.com/blogpics/wireshark.jpeg" /></p> <p style="margin-bottom: 0in">What I did was try to break it down as best as I could into a Sulley request. It ended up being too large to run on my VM image so I had to find some more ram for the only box in the house running windows. Eventually I got it up and going, and Sulley started kicking out the Fuzz! Somewhere around 618, and in the low 2000’s Shixxnote crashed. I’ve since started Sulley’s processmon and am monitoring for the exact cause of the crash. Anyway, I found it kind of cool taking apart the protocol (even though its not really a protocol per say, just a format of data sent over the wire)</p> <p style="margin-bottom: 0in"> <p style="margin-bottom: 0in">Request can be found <a href="http://hamsterswheel.com/code/sulley/shixxnote.py">here</a></p> </div> <div class="feedback"> <a href="http://hamsterswheel.com/techblog/?p=58#respond" title="Comment on Awww Shixxnote">Comments (0)</a> </div> </div> <div class="post"> <h2 id="post-57"><a href="http://hamsterswheel.com/techblog/?p=57" rel="bookmark">Too many security books</a></h2> <div class="meta">Posted by Eric | <a href="http://hamsterswheel.com/techblog/?cat=1" title="View all posts in General" rel="category">General</a> | Saturday 5 April 2008 12:42 am </div> <div class="storycontent"> <p><meta content="text/html; charset=utf-8" http-equiv="CONTENT-TYPE" /><title /><meta content="OpenOffice.org 2.0 (Linux)" name="GENERATOR" /><meta content="20080404;23090500" name="CREATED" /><meta content="20080404;23304600" name="CHANGED" /><br /> <style> <!-- @page { size: 8.5in 11in; margin: 0.79in } P { margin-bottom: 0.08in } --> </style> <p style="margin-bottom: 0in">Cg has been doing quite a few book reviews lately on Amazon and on his <a href="http://www.carnal0wnage.blogspot.com">blog</a>, Tebo who I’ve recently befriended on IRC was bashing the reading of all these books basically saying the more time you spend reading the less time you spend doing practical work. MC used to tell me all the time to stop reading books and start putting my fingers on the keyboard, basically under the same logic. One of my past times is going to barnes and noble with my son on Tuesdays. I grab a coffee and then take him over to the kids section and let him play with the Thomas the engine set they have in there. He has fun, we spend quality time and the single moms check me out. On my way out though I stop in the computer books section and check out what’s going on. For the tax year 2005 I spent (according to my schedule C that I filed) roughly $3500 on books, and that figure does not include college text books. Anyway, So far this year I’ve spent 35 dollars on books, but it was an investing book and a business book so I guess that doesn’t count. I stopped purchasing books last year sometime, I realized that MC and Tebo are right. But the main focus of this post is that tech books are starting to suck.</p> <p style="margin-bottom: 0in"> <p style="margin-bottom: 0in">Suggest you want to learn python. You walk into Borders and goto the programming shelf and there are about 30 books that say python. Which one do you choose? As you start to pull them off the shelf to compare and contrast them you realize they are all the same. But the programming books are much different from the networking books and by networking books I mean the security books. Lately I’ve been very disappointed with the security books on the shelf, there are only a few exceptions so don’t flame me just yet. Most of the security books are the same through and through. They introduce you to some low level concepts that you could have pulled from the RFC had you taken the time to read it, and then they start going through tools. They don’t really teach you the fundamentals of anything, just the syntax of the tool. The worst of them are the Hacking exposed series. Every time I see someone handling them I just have to laugh to myself. The reason I say Hacking exposed is the worse is because from what I’ve seen they are generally a few years behind. By the time they are published, the material is already outdated and no longer works, or is picked up by AV or IDS.</p> <p style="margin-bottom: 0in"> <p style="margin-bottom: 0in">There are of course a few exceptions on the books. Take for example the Shell coders Hand Book, or Fuzzing. The Shellcoders handbook is good because it goes into low level principles and makes an effort to discuss the material and logic behind it, not just a run this tool and be done with it. Fuzzing is another example. Cg in his review mentioned that it didn’t have enough application examples in the book, but man it’s great on delivering the theory of it. One good thing I’m starting to see from publishers is the publishing of very specific topics. Fuzzing, Shell coding, Software Security Assessment, and Johnny Long’s Google / no tech hacking are perfect examples.</p> <p style="margin-bottom: 0in"> <p style="margin-bottom: 0in">Don’t get me wrong, I’m not bashing authors. I’m just saying that I’m not longer buying any books. You can go broke doing so, and I have better things to spend my money on. All the information in those books can easily be obtained from quality sites like phrack, uninformed, hick, nologin, et cetera. MC told me I was lucky, cause now a day’s everything is printed in books but back when he was learning, there were not books on this stuff.</p> <p> <!-- Begin Google Adsense code --> <script type="text/javascript"><!-- google_ad_client = "pub-9774791470740882"; google_ad_width = 468; google_ad_height = 60; google_ad_format = "468x60_as"; google_ad_type = "text_image"; google_ad_channel =""; //--></script> <script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"> </script> <!-- End Google Adsense code --> </p> </div> <div class="feedback"> <a href="http://hamsterswheel.com/techblog/?p=57#comments" title="Comment on Too many security books">Comments (3)</a> </div> </div> <div class="post"> <h2 id="post-56"><a href="http://hamsterswheel.com/techblog/?p=56" rel="bookmark">Hooks don’t play well with others</a></h2> <div class="meta">Posted by Eric | <a href="http://hamsterswheel.com/techblog/?cat=5" title="View all posts in Code" rel="category">Code</a>, <a href="http://hamsterswheel.com/techblog/?cat=17" title="View all posts in Win32 Programming" rel="category">Win32 Programming</a> | Wednesday 2 April 2008 9:02 am </div> <div class="storycontent"> <p><meta http-equiv="CONTENT-TYPE" content="text/html; charset=utf-8" /><title /><meta name="GENERATOR" content="OpenOffice.org 2.0 (Linux)" /><meta name="CREATED" content="20080402;7434300" /><meta name="CHANGED" content="16010101;0" /><br /> <style> <!-- @page { size: 8.5in 11in; margin: 0.79in } P { margin-bottom: 0.08in } --> </style> <p style="margin-bottom: 0in">Last night I spent a few hours hacking at some c code in an attempt to make two things.</p> <p style="margin-bottom: 0in"> <p style="margin-bottom: 0in">First, a Keylogger that doesn’t flag with AV and that uses minimul hooking, basically staying in UserLand.</p> <p style="margin-bottom: 0in">Second, A little utility I’m calling tigger. The concept behind Tigger is sort of like pivot from Metasploit. Take traffic in one side and throw it out the other. To visualize this:</p> <p style="margin-bottom: 0in"> <p style="margin-bottom: 0in"> <p style="margin-bottom: 0in">Source -> Tigger Server -> Target.</p> <p style="margin-bottom: 0in"> <p style="margin-bottom: 0in">Ideally, Tigger could and will be used for something along the lines of DMZ hopping, or just hoping traffic around inside of a network in order to avoid burning your original point of access.</p> <p style="margin-bottom: 0in"> <p style="margin-bottom: 0in"> <p style="margin-bottom: 0in">I ran into a problem with the Keylogger however, when I went to Compile I got a compilation error stating KBDLLHOOKSTRUCT was undefined. After googling I only received two results, the one mentions to define a preprocessor, or add a preprocessor into the project properties. After adding the following line:</p> <p style="margin-bottom: 0in"> <p style="margin-bottom: 0in">#define _WIN32_WINNT 0×401</p> <p style="margin-bottom: 0in"> <p style="margin-bottom: 0in">Everything compiles just fine. The problem however, presents itself when you run the keylogger. Everything seems to be hooking correctly, but when you let it go, and type things in it doesn’t seem to log. Any one with more win32 experience have a reason why making the preprocessor declaration would allow me to compile, but somewhere hinder the functionality of the hooks?</p> <p> <!-- Begin Google Adsense code --> <script type="text/javascript"><!-- google_ad_client = "pub-9774791470740882"; google_ad_width = 468; google_ad_height = 60; google_ad_format = "468x60_as"; google_ad_type = "text_image"; google_ad_channel =""; //--></script> <script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"> </script> <!-- End Google Adsense code --> </p> </div> <div class="feedback"> <a href="http://hamsterswheel.com/techblog/?p=56#respond" title="Comment on Hooks don’t play well with others">Comments (0)</a> </div> </div> </div> <div id="footer"> © Copyright 2009 | <a href="http://hamsterswheel.com/techblog">Phn1x – Hamsterswheel</a> | Theme by <a href="http://clubparexcellancetech.com/">Club Par Excellance</a> | All Rights Reserved | Sponsored by <a href="http://www.voipkit.ca/">VoIP</a> </div> </body> </html>