Lighttpd

Posted by Eric | Vulnerabilities | Saturday 29 September 2007 12:46 am

So yesterday I spotted a Buffer overflow pop up on bugtraq under a Gentoo Security advisory. i figured I’d give it a look. Digging deeping, I followed the CVE which pointed out the overflow was in the Content-Length header field. I tell you what, I’m not sure what’s harder. Getting mod_fastcgi to work correctly, or finding documentation on it that’s worth anything. At anyrate, It’s causing me deep vexation, and I’m on vacation so I should not be vexed!

In case any reader hasn’t figured it out, I’m done with those stupid ass honeypots! But I have found an interest in anti forensics from it!

Default Sebek Installation detection

Posted by Eric | Research | Monday 10 September 2007 10:24 pm

<meta content="OpenOffice.org 2.0 (Linux)" name="GENERATOR" /><meta content="phn1x" name="AUTHOR" /><meta content="20070827;19405700" name="CREATED" /><meta content="phn1x" name="CHANGEDBY" /><meta content="20070827;20393300" name="CHANGED" /><br /> <style type="text/css"> <!-- @page { size: 8.5in 11in; margin: 0.79in } P { margin-bottom: 0.08in } --> </style> <p style="margin-bottom: 0in">So I fell off point on this, and for that I’m sorry if I have any regular readers. I decided to kill my last windows machine, and in the process of changing from windows XP to a linux system on one of my main workstations I had some unexpected situations, which ended up rm -rf /mnt/storage/virtualmachines <img src='http://hamsterswheel.com/techblog/wp-includes/images/smilies/icon_sad.gif' alt=':(' class='wp-smiley' /> . Anyway, I’m in the process of rebuilding them, especially the honeynet first! I need to get it all set up again since I have to present on some stuff at work thursday! More to come, before I venture out again!</p> <p style="margin-bottom: 0in"><span class="body">The opportunity to secure ourselves against defeat lies in our own hands, but the opportunity of defeating the enemy is provided by the enemy himself.</span><br /> <span class="bodybold"> -Sun Tzu </span></p> <p style="margin-bottom: 0in">On windows Sebek comes in the form of a driver. By default the driver is called sebek.sys and is located in the c:\windows\system32\etc\drivers folder. Once Sebek is configured with the config utility it disappeares from site. In Linux, Sebek fails to restart on reboot. I don’t recall whether this is configurable or not in a hidden manner. Windows on the other side sets up Sebek as a service which starts on reboot. This leaves (in its default configuration) a registry key “HKLM\\System\\CurrentControlSet\\Services\\sebek.” MC pointed this out to me. He attached the following note</p> <p style="margin-bottom: 0in"># script that will query the registry for</p> <p style="margin-bottom: 0in"># a hidden service. when sebek is installed</p> <p style="margin-bottom: 0in"># and you query the registry entry for it, you</p> <p style="margin-bottom: 0in"># get a “Operation failed: 2″. If you do a query</p> <p style="margin-bottom: 0in"># for something like “sebeg”, the key length is</p> <p style="margin-bottom: 0in"># nil, which is true, cause it’s not there.</p> <p style="margin-bottom: 0in"># written really quick. MC / <a href="mailto:y0@w00t-shell.net">y0@w00t-shell.net</a></p> <p style="margin-bottom: 0in"> <p style="margin-bottom: 0in">Take that reg key and MC’s note you can make a nice meterpreter script:</p> <p style="margin-bottom: 0in"> <p style="margin-bottom: 0in">meterpreter > run findsebek<br /> [*] Sebek is running<br /> meterpreter ></p> <p>//on a host not running the whitey tool.</p> <p>meterpreter > run findsebek<br /> [*] Sebek is not installed</p> <p style="margin-bottom: 0in"> <p style="margin-bottom: 0in"> <p style="margin-bottom: 0in">Although this method works on default configurations, it does not work if the /n= option is used on the installation. Another means of detecting default configurations includes a method noticed by Tan Chew Keong. Utilizing the SearchPath Windows API call, you can locate the sebek.sys file (if you know the location) regardless of its hidden state. Basically its :</p> <p style="margin-bottom: 0in"> <pre>if(SearchPath(SEBEK_PATH, SEBEK_NAME, NULL, MAX_PATH, buffer, &ptr) != 0) { printf("[+] SEBEK Detected with SearchPath().\n"); } else { printf("[-] SEBEK Not Detected with SearchPath().\n"); dw = GetLastError(); }</pre> <p style="margin-bottom: 0in">Of course, that’s a default configuration. I didn’t really find any cool new way to detect the 3.0.3 version of sebek on windows but I found an old trick that still worked. Again, Tan Chew Keong wrote a utility called kproccheck. Although Kproccheck is not really a method of detecting sebek, it can detect processes running in kernel space. It’s important to note that if you get to this point the target should not be important to you. I found that Kproccheck occasionally will crash the system that it is run on. kproccheck -t is the switch we want, and it will report back a bunch of data. This doesnt mean its sebek, it could just be a rootkit. A full write up on Kproccheck can be found at the link below.</p> <p style="margin-bottom: 0in"> <p style="margin-bottom: 0in"><meta content="text/html; charset=utf-8" http-equiv="CONTENT-TYPE" /><title /><meta content="OpenOffice.org 2.0 (Linux)" name="GENERATOR" /><meta content="phn1x" name="AUTHOR" /><meta content="20070827;19405700" name="CREATED" /><meta content="phn1x" name="CHANGEDBY" />More to come. <br /> <style type="text/css"> <!-- @page { size: 8.5in 11in; margin: 0.79in } P { margin-bottom: 0.08in } --> </style> </p> <pre style="margin-bottom: 0.2in">http://www.security.org.sg/vuln/sebek215.html</pre> <p style="margin-bottom: 0in">Know Your Enemy: Sebek</p> <p style="margin-bottom: 0in"><a href="http://www.security.org.sg/code/kproccheck.html">http://www.security.org.sg/code/kproccheck.html</a></p> <p style="margin-bottom: 0in"> </div> <div class="feedback"> <a href="http://hamsterswheel.com/techblog/?p=29#respond" title="Comment on Default Sebek Installation detection">Comments (0)</a> </div> </div> <div class="post"> <h2 id="post-28"><a href="http://hamsterswheel.com/techblog/?p=28" rel="bookmark">Thoughts before we dive in</a></h2> <div class="meta">Posted by Eric | <a href="http://hamsterswheel.com/techblog/?cat=11" title="View all posts in Research" rel="category">Research</a> | Monday 3 September 2007 5:15 pm </div> <div class="storycontent"> <p>The clever combatant imposes his will on the enemy, but does not allow the enemy’s will to be imposed on him.<br /> <strong>- Sun Tzu</strong></p> <p style="text-indent: 0.5in" class="MsoNormal">Work got the best of me, as did some issues with the familia, Ergo I haven’t been on top of the blog to finish up things on Sebek.. Everything’s fine, so no need to send emails asking, just some bullshit with the U.S Government!</p> <p class="MsoNormal"> <p style="text-indent: 0.5in" class="MsoNormal">Sebek presents a great challenge for us, in a sense it’s nothing more than a rootkit that hooks functions and reports everything to another machine. However, the catch 22 you may find yourself in is how do I detect and disable sebek without burning tools and or utilities? Well, this is where your “dot slasher” and your professional differ. There are those who will download exploit code off the internet and execute it, and then there are those who will make their own. MC told me about the wonders of the latter, and that you should never execute code grabbed from the internet! Its not a trivial concept actually, does the code work? Yes, however there’s a chance that a signature has been developed for it. I’ve seen many peoples toolbox which included quite a few utilities which are detectable by anti virus. Granted, a honey pot may not have a user watching the antivirus pop up, but do you want to burn any tools? The less noise we make, the better off we are, which might I add, segways into another great topic of research.</p> <p style="text-indent: 0.5in" class="MsoNormal"> <p style="text-indent: 0.5in" class="MsoNormal">First and foremost, you want to go in with custom exploit code. Why do you want custom exploit code? Well, if you don’t have custom exploit code you stand the chance of being discovered before you even do much. Most honey pot systems have an IDS, in most cases this is snort. Snort signature developers sit on the same lists and sites that you may download your exploit code from. Let’s put two and two together… Yep, there’s a signature for that! Beyond that, it becomes a skill of post exploitation. Having read a few older versions of phrack we discover things like Ul_exec, and rexec. Today, we have the meterpreter. What are these good for? Well, with this we can run in memory and never touch the file system. In theory, we can also evade a lot of Sebek’s detection abilities. I’d highly recommend reading up on those [1][2][3]. Not only is detection of sebek important but so is safe guarding our methods and being as quiet as possible. This is where anti forensics comes into play.</p> <p class="MsoNormal"> <p class="MsoNormal">[1] <a href="http://www.jsw4.net/info/listserv_archives/bugtraq/04-wk00/msg00002.html">http://www.jsw4.net/info/listserv_archives/bugtraq/04-wk00/msg00002.html</a></p> <p class="MsoNormal">[2] http://www.phrack.org/issues.html?issue=62&id=8</p> <p class="MsoNormal">[3] <span class="a"><span style="font-size: 10pt">www.metasploit.com/projects/Framework/docs/<strong>meterpreter</strong>.pdf</span></span></p> </div> <div class="feedback"> <a href="http://hamsterswheel.com/techblog/?p=28#respond" title="Comment on Thoughts before we dive in">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>