{"id":34,"date":"2006-06-06T22:55:00","date_gmt":"2006-06-07T03:55:00","guid":{"rendered":"synetech.ddns.net\/blogs\/smarticles\/blog\/2006\/06\/06\/computerssecurity-easy-rootkit-detection\/"},"modified":"2011-03-03T18:18:59","modified_gmt":"2011-03-03T23:18:59","slug":"easy-rootkit-detection","status":"publish","type":"post","link":"https:\/\/synetech.ddns.net\/blogs\/smarticles\/2006\/06\/06\/easy-rootkit-detection\/","title":{"rendered":"Easy Rootkit Detection"},"content":{"rendered":"<p>An easy way to detect most rootkits is to use an old technology: DOS.<\/p>\n<p>Most (read, pretty much <em>all<\/em>) rootkits require some sort of file component.  In fact all malware requires some sort of file to be loaded to perform it&#8217;s malfeasance.  This is because malware is just software that does bad things and software means files.  Even worms and other memory-resident applications require files at some point.  This is why rootkits hijack directory listing commands to hide themselves.<\/p>\n<p>So, how do you find files when they are being hidden?  One way is to check the drive at a low-level, viewing the disk directly instead of using a file listing command.  You can look at the disk and see if the entries in the cluster match up with the directory listing.  This is a common method but has it&#8217;s drawbacks.  For one thing, a decent rootkit would be able to hijack sector-level disk access and hide it&#8217;s entries just as it does with a directory listing command.  Another problem is that it is difficult to use and can be unreliable.<\/p>\n<p>Another easy to use method is to get a directory listing from within Windows, then boot into DOS mode and get another one, then compare the two.  There are few if any DOS rootkits, but more importantly DOS is a lightweight, easy to control environment that can fit on a single floppy.  This is important, because it means that you can ensure the integrity of a DOS boot disk because a minimal system needs just four files taking no more than 200KB.  Make sure that the boot disk is reliable by making it from a secure system and then write-protecting it.  Another option is to use a CD, for example a Windows 95\/98 CD which allow you to boot to DOS.<\/p>\n<p>To check for a Windows rootkit:<\/p>\n<ol><\/p>\n<li>Open a command prompt with the <strong>cmd<\/strong> command.<\/li>\n<p><\/p>\n<li>Get a directory listing with <strong>dir c:\\\/s\/a\/o&gt;d:\\windir.txt<\/strong>.<\/li>\n<p><\/p>\n<li>Reboot into pure DOS mode (do this ASAP after the previous step.)<\/li>\n<p><\/p>\n<li>Get another directory listing with <strong>dir c:\\\/s\/a\/o&gt;d:\\dosdir.txt<\/strong>.<\/li>\n<p><\/p>\n<li>Compare the two files (eg: <strong>WinDiff d:\\dosdir.txt d:\\windir.txt<\/strong>).<\/li>\n<p><\/ol>\n<p>Obviously there will be some differences, since files are normally created, changed, and deleted while shutting down Windows.  You&#8217;ll have to use your best judgement and possibly a reference or the Internet to determine which files that are different are malicious.  To minimize the noise, make sure to clean up any temporary files and such before getting the listing.<\/p>\n<p>If there is no rootkit, then the two listings should be more or less the same.  If there is a rootkit present, then the DOS listing will reveal the hidden rootkit files.<\/p>\n<p>One drawback to this method is that the built-in DIR command returns the directory listings in different formats in Windows and DOS.  As a result, it will be difficult to do a straight comparison of the two listing files.  For example this is a listing made in Windows:<\/p>\n<pre><br \/> Volume in drive C is C-Windows<br \/> Volume Serial Number is 0123-4567<br \/><br \/> Directory of C:<br \/>Mar.03.03  03:03am           233,632 ntldr<br \/>Mar.03.03  03:03am            47,580 ntdetect.com<br \/>Mar.03.03  03:03am               193 boot.ini<br \/>Mar.03.03  03:03am              Windows<br \/>Mar.03.03  03:03am              Program Files<br \/>Mar.03.03  03:03am              Documents and Settings<br \/>               3 File(s)         48,638 bytes<br \/>               3 Dir(s)     123,456,789 bytes free<br \/><\/pre>\n<p>and the same in DOS (with DOSLFN for long file names on the right):<\/p>\n<pre><br \/> Volume in drive C is C-WINDOWS  <br \/> Volume Serial Number is 0123-4567<br \/> Directory of C:<br \/>NTLDR              233,632  03-03-2003  03:03 ntldr<br \/>NTDETECT COM           502  03-03-2003  03:03 ntdetect.com<br \/>BOOT     INI           502  03-03-2003  03:03 boot.ini<br \/>WINDOWS                03-03-2003  03:03 Windows<br \/>PROGRA~1               03-03-2003  03:03 Program Files<br \/>DOCUME~1               03-03-2003  03:03 Documents and Settings<br \/>         3 file(s)         48,638 bytes<br \/>         3 dir(s)     123,456,789 bytes free<br \/><\/pre>\n<p>The formats are quite different and will require some reworking to make a comparison easy.  One solution is to use a third party directory listing program instead of the built-in dir.  A third party dir would give the listing in the same format in both Windows and DOS, just make sure that it can list anything, and everything (including hidden files, system files, volumes, etc.)<\/p>\n<p>All software is limited and hackable, and malware is no different.  With a little thought and the right tools, even a rootkit can be ferreted out.<\/p>\n<div class=\"tagcloud\"><a href=\"https:\/\/synetech.ddns.net\/blogs\/smarticles\/tag\/computers\/\" rel=\"tag\">Computers<\/a>, <a href=\"https:\/\/synetech.ddns.net\/blogs\/smarticles\/tag\/rootkits\/\" rel=\"tag\">Rootkits<\/a>, <a href=\"https:\/\/synetech.ddns.net\/blogs\/smarticles\/tag\/security\/\" rel=\"tag\">Security<\/a><\/div>","protected":false},"excerpt":{"rendered":"<p>An easy way to detect most rootkits is to use an old technology: DOS. Most (read, pretty much all) rootkits require some sort of file component. In fact all malware requires some sort of file to be loaded to perform it&#8217;s malfeasance. This is because malware is just software that does bad things and software [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[14,46,4],"class_list":["post-34","post","type-post","status-publish","format-standard","hentry","category-uncategorized","tag-computers","tag-rootkits","tag-security"],"_links":{"self":[{"href":"https:\/\/synetech.ddns.net\/blogs\/smarticles\/wp-json\/wp\/v2\/posts\/34","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/synetech.ddns.net\/blogs\/smarticles\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/synetech.ddns.net\/blogs\/smarticles\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/synetech.ddns.net\/blogs\/smarticles\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/synetech.ddns.net\/blogs\/smarticles\/wp-json\/wp\/v2\/comments?post=34"}],"version-history":[{"count":0,"href":"https:\/\/synetech.ddns.net\/blogs\/smarticles\/wp-json\/wp\/v2\/posts\/34\/revisions"}],"wp:attachment":[{"href":"https:\/\/synetech.ddns.net\/blogs\/smarticles\/wp-json\/wp\/v2\/media?parent=34"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/synetech.ddns.net\/blogs\/smarticles\/wp-json\/wp\/v2\/categories?post=34"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/synetech.ddns.net\/blogs\/smarticles\/wp-json\/wp\/v2\/tags?post=34"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}