Stories
Slash Boxes
Comments

News for nerds, stuff that matters

Detecting Rootkits In GNU/Linux

Posted by kdawson on Mon Dec 18, 2006 03:19 PM
from the watching-your-back dept.
An anonymous reader sends note of a blog post on rootkit detection in GNU/Linux. The article mentions only two utilities for ferreting out rootkits — the first comment to the blog post lists three additional ones — but it could be useful for those who haven't thought about the problem much. From the article: "A rootkit... is a collection of tools that a cracker installs on a victim's computer after gaining initial access. It generally consists of log cleaning scripts and trojaned replacements of core system utilities such as ps, top, ifconfig and so on."
This discussion has been archived. No new comments can be posted.
Display Options Threshold:
The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
  • ifl (Score:3, Informative)

    by stoolpigeon (454276) * <bittercode@gmail> on Monday December 18 2006, @03:21PM (#17291050)
    (http://thepeckfamily.us/ | Last Journal: Saturday November 10, @10:49AM)
    I think that there is room to mention the well known tools such as AIDA and TripWire and LogCheck.
    • Re:ifl (Score:5, Informative)

      by Moby Cock (771358) on Monday December 18 2006, @03:39PM (#17291312)
      (http://slashdot.org/~Moby%20Cock)
      Most modern rootkits are kernel level and Trip Wire can not readily detect them. Nevertheless it is still useful to have at hand.
      [ Parent ]
      • Re:ifl (Score:5, Funny)

        by stoolpigeon (454276) * <bittercode@gmail> on Monday December 18 2006, @03:44PM (#17291392)
        (http://thepeckfamily.us/ | Last Journal: Saturday November 10, @10:49AM)
        i have no idea. i've never used any of them. this is a joke gone completely wrong. i just copied and pasted the comment from over at tfa. hence my subject: ifl (it's funny laugh). i figured it'd end up troll, over-rated, but i got such a laugh out of doing it (sorry i'm easily amused) that i figured it was worth it. in what is a horrid twist of fate, i now feel bad for getting modded up.
        [ Parent ]
        • Re:ifl by physicsnick (Score:1) Tuesday December 19 2006, @02:36AM
      • Re:ifl (Score:4, Insightful)

        by computational super (740265) on Monday December 18 2006, @04:05PM (#17291710)

        You know, one of the things I'd like to do if I had more time and knew how to do it would be to create a bootable "system scan" disk. A rootkit could hide itself from tripwire et al, but it couldn't hide from a bootable CD. I guess you can sort of achieve the same effect with Knoppix with a bit of work, but it would be nice to have something that I could use to scan a machine for vulnerabilities without using the hard drive to boot at all.

        [ Parent ]
        • Re:ifl by Anonymous Coward (Score:3) Monday December 18 2006, @04:59PM
        • Re:ifl by jamesh (Score:2) Monday December 18 2006, @07:21PM
          • Besides the point! by TrueKonrads (Score:2) Tuesday December 19 2006, @06:46AM
          • Re:ifl by Jackmn (Score:2) Tuesday December 19 2006, @11:44AM
            • Re:ifl by jamesh (Score:2) Tuesday December 19 2006, @04:55PM
              • Re:ifl by Jackmn (Score:1) Tuesday December 19 2006, @08:31PM
              • Re:ifl by jamesh (Score:2) Tuesday December 19 2006, @09:55PM
              • Re:ifl by Jackmn (Score:1) Wednesday December 20 2006, @05:57AM
        • Re:ifl by bl8n8r (Score:2) Tuesday December 19 2006, @06:56AM
    • Re:ifl by in10d (Score:1) Tuesday December 19 2006, @07:28AM
    • Re:ifl by extern_void (Score:1) Tuesday December 19 2006, @10:53AM
      • Re:ifl by stoolpigeon (Score:1) Tuesday December 19 2006, @11:26AM
  • This is... (Score:2, Informative)

    by Creepy Crawler (680178) on Monday December 18 2006, @03:23PM (#17291098)
    For starters, why you do NOT keep any sort of compiler on your machine.

    It's rather difficult to load kernel obfuscation modules (like hiding processes and files) without header files and no compiler.

    It'd be even better if you could make every program execute only (no reading) and hide /proc through something like NSASecurity setup. What they dont know, they cant do much with. Obfuscation, THEN security. Keep em guessing.
    • Re:This is... (Score:5, Informative)

      by Rosco P. Coltrane (209368) on Monday December 18 2006, @03:27PM (#17291152)
      It's rather difficult to load kernel obfuscation modules (like hiding processes and files) without header files and no compiler.

      I'll tell you a little secret: if you know the kernel version number and target architecture, you can build a module on another, totally different machine. Wow! 2007 technology man!
      [ Parent ]
    • Re:This is... (Score:5, Interesting)

      by psycho8me (711330) on Monday December 18 2006, @03:27PM (#17291160)
      (Last Journal: Saturday November 08 2003, @08:06PM)
      That may have been true 30 years ago when a compiler license cost thousands. If a person has write access to your system, they can just copy a compiler binary over.
      [ Parent ]
      • Re:This is... by Anonymous Coward (Score:1) Monday December 18 2006, @04:37PM
      • Re:This is... by gwait (Score:1) Monday December 18 2006, @07:30PM
        • Re:This is... by gmack (Score:2) Monday December 18 2006, @08:49PM
          • Re:This is... by gwait (Score:1) Tuesday December 19 2006, @04:42PM
            • Re:This is... by gmack (Score:3) Tuesday December 19 2006, @05:43PM
      • 1 reply beneath your current threshold.
    • Compiler is Irrelevant (Score:4, Informative)

      It's pretty trivial to just deduce what kernel the machine is running and build working binaries wherever you want. In fact it would be preferred, since a sysadmin is far more likely to notice a rogue gcc process sucking up CPU than a file transfer while the rootkit is being loaded.

      Anyway - if the person has root on the box (which they need to install the rootkit anyway), then they can just ship up THEIR OWN COMPILER if they want to regardless.

      [ Parent ]
      • Re:Compiler is Irrelevant by Creepy Crawler (Score:1) Monday December 18 2006, @03:33PM
        • Re:Compiler is Irrelevant by novus ordo (Score:2) Monday December 18 2006, @04:17PM
        • Re:Compiler is Irrelevant (Score:5, Insightful)

          by profplump (309017) <zach@kotlarek.com> on Monday December 18 2006, @04:26PM (#17292046)
          (http://www.uberzach.com/)

          First, let me introduce you to the file command, which can tell me all about your arch. Or failing that, less, or any other program than can read any binary on your system. Your binary executables necessarily include information about their format, including their architecture.

          spaceheater ~ 0$ file /bin/bash
          /bin/bash: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), for GNU/Linux 2.0.0, dynamically linked (uses shared libs), not stripped

          Second, why are you worried about compilers and version numbers if you're so sure people can't load modules anyway? What exactly are you trying to protect? There's something to be said for a minimalistic system, but you've yet to explain how having a compiler installed poses any sort of realistic security threat.

          Finally, what's to keep someone from simply replacing your entire hand-complied, monolithic kernel? Even if you disable all the ways to do this without rebooting -- kexec() and /proc/kcore, probably among others -- they could always reboot the machine. Sure, you'd notice the reboot, but would you be able to detect their change after the reboot?

          I'd also like to mention that OS-enforced append-only files are a poor substitute to logging to a hardware-enforced WORM drive, particularly if we're talking about rootkits. You're still fundamentally relaying on the OS to provide protection, which isn't reasonable when a rootkit has been installed.

          [ Parent ]
      • Re:Compiler is Irrelevant by Al Dimond (Score:2) Monday December 18 2006, @05:43PM
      • 1 reply beneath your current threshold.
    • Re:This is... (Score:4, Funny)

      by diegocgteleline.es (653730) on Monday December 18 2006, @03:54PM (#17291544)
      Real men and real hackers write their programs in binary code, not in stupid and bloated assembler.
      [ Parent ]
    • Re:This is... by Will2k_is_here (Score:2) Monday December 18 2006, @04:28PM
      • Re:This is... by richie2000 (Score:2) Tuesday December 19 2006, @02:46AM
    • Re:This is... by piranha(jpl) (Score:2) Monday December 18 2006, @05:44PM
    • Re:This is... by gmack (Score:2) Monday December 18 2006, @08:56PM
    • 2 replies beneath your current threshold.
  • by Rosco P. Coltrane (209368) on Monday December 18 2006, @03:24PM (#17291108)
    ... with the Internet Freedom Disk [slashdot.org]!
  • OSSEC HIDS (Score:2, Informative)

    by magmf (748370) on Monday December 18 2006, @03:24PM (#17291116)
    (http://www.underlinux.com.br/)
    I PREFFER OSSEC HIDS to do this. look www.ossec.net i think this is the most powerfull agent ever :)
  • Pish Posh (Score:5, Funny)

    by eno2001 (527078) on Monday December 18 2006, @03:26PM (#17291136)
    (http://www.kickthebobo.com/erotech/index.html | Last Journal: Friday October 26, @11:51AM)
    It's GNU/Linux. Any hacker worth his salt doesn't want to bother with archaic OSes based on Unix. He wants the 1337 stylings of Windows Vista. No sense in rootkitting a *nix box. You can't do anything with a *nix box. But an army of zombie Vista PCs, now THAT is ULTIMATE POWER!
  • Read Only Drives (Score:5, Interesting)

    by DigitalRaptor (815681) on Monday December 18 2006, @03:38PM (#17291292)
    (http://brianallen.isagenix.com/)
    I run Gentoo Linux servers for hosting email and websites, and have wanted a way to really secure the boxes.

    Many hard drives have jumpers that make them read only.

    I thought it would be great to have all of the rarely changed portions of the operating system on a separate drive set to read only.

    The only time you would move the jumper to read-write would be when you were installing updates.

    Things like: /tmp /var/log
    etc

    Would have to always be on a read-write drive.

    But having things like /usr/bin on a read-only drive seems like an effective way to protect against many, many different root-kits, worms, etc.

    What do you think? Feasible or impractical?

  • by Timesprout (579035) on Monday December 18 2006, @03:39PM (#17291324)
    When the dark suits turn up on my doorstep with an arrest warrant on charges of attempting to crack confidential government sites I can be pretty sure my machine has been rooted.
  • Is rooting Linux (Score:1)

    by wumpus188 (657540) on Monday December 18 2006, @03:42PM (#17291374)
    ... just .. un-cool?

  • A well done rootkit is hard to detect... if you can't find a rootkit on your system then it's probably too late.

    Go here now. [openbsd.org]
  • linuix rootkits? (Score:1, Troll)

    by pulse2600 (625694) on Monday December 18 2006, @04:02PM (#17291668)
    That's easy. Are you running VMWare with a Windows virtual install on this Linux box? Delete that virtual machine. Rootkit eliminated.
  • trojan the detector (Score:2, Interesting)

    by tkw954 (709413) on Monday December 18 2006, @04:03PM (#17291676)
    Wouldn't the first step for a rootkit developer be to add rkhunter and chkrootkit to their list of trojaned programs so that they give a "no rootkit" output? Maybe there's some protection from this, but I don't see it in the article.
    • Re:trojan the detector (Score:4, Insightful)

      by sfjoe (470510) on Monday December 18 2006, @04:34PM (#17292162)

      They can do that but, if you're like me, chkrootkit runs from a mounted CD-ROM. It's a little harder for them to trojan it that way.
      [ Parent ]
  • I've always wondered... (Score:4, Interesting)

    by sootman (158191) on Monday December 18 2006, @04:03PM (#17291684)
    (Last Journal: Thursday July 12, @12:30PM)
    How hard is it to build a basic but worthwhile rootkit detection tool with common tools? Like run `md5 /bin/*` and then ship the output of that to another machine every day for comparison to yesterday's output of that command? (Looking at other directories as well, of course.) My understanding is that many rootkits come with hacked versions of tools like 'ps' to hide themselves.

    On the one hand, yeah, let's not reinvent the wheel, but on the other hand, there are advantages to building your own tools:
    - you know exactly what they're doing--more complicated pre-existing tools might do more, but if you don't understand their output, they're no good.
    - you don't have to trust*/audit someone else's code
    - they don't do more than you need
    - they don't have features that you don't know about or might misuse
    - at the very least, it's a great way to learn

    * yes, I know about this. [acm.org] but there are reasonable limits--I do trust that my distro came with a clean copy of gcc. OTOH, I'd rather write my own 20-line script that download someone else's that says it does the same thing as what I would write myself but that I'd have to audit for even the smallest things, like sneaking in an
    if ($rooted="no")
    instead of
    if ($rooted=="no")
  • by straponego (521991) on Monday December 18 2006, @04:07PM (#17291730)
    I just eyeball /proc/kcore for anything suspicious every day or so.
  • by DCheesi (150068) on Monday December 18 2006, @04:14PM (#17291844)
    (http://slashdot.org/)
    "His passwd program has the same name as the real passwd program and works flawlessly in all respects except for the fact that it will also gather data residing on your machine such as the user details each time it is run and transmit it to a remote location or it will open a back door for outsiders by providing easy root access and all the time, you will be impervious about its actions."

    ...I don't think it means what you think it means.

    http://www.answers.com/impervious&r=67 [answers.com]

    • 1 reply beneath your current threshold.
  • chkrootkit (Score:3, Informative)

    by joe 155 (937621) on Monday December 18 2006, @04:22PM (#17291964)
    (Last Journal: Wednesday September 20 2006, @10:30AM)
    chkrootkit is good, I like it anyway, you can get it in Fedora Core 6 through yum (although you don't seem to be able to get rkhunter through yum any more). you have to run it as root, maybe its something about what it needs to access... anywho, you can get issues with false possitives, I just ran it and got;

    Searching for OBSD rk v1... /usr/lib/security
    /usr/lib/security/classpath.security
    ....
    Searching for suspicious files and dirs, it may take a while...
    /usr/lib/perl5/5.8.8/i386-linux-thread-multi/.pack list

    so I wouldn't worry too much if you see something that looks iffy before you check it out (I'd have been annoyed if I just reinstalled my OS just to find the same thing happening again). It will also show your ethnet port as being in "sniffer". Anywho, best practices can minimize the risk to pretty much 0... oh, but for God's sake PLEASE switch off remote root access on ssh over default ports, ideally switch it off altogether (If you need it please learn how to use it). Ssh coupled with an easily broken root password is the single biggest cause of rootkits... and a huge /var/log/secure!
    • Re:chkrootkit by nuzak (Score:2) Monday December 18 2006, @04:36PM
    • Re:chkrootkit by Guido von Guido (Score:2) Monday December 18 2006, @04:40PM
    • Re:chkrootkit by extern_void (Score:1) Tuesday December 19 2006, @11:22AM
  • Bigger list (Score:1)

    by pseudorand (603231) on Monday December 18 2006, @05:17PM (#17292932)
    If you want a bigger list of such tools, type ls /usr/portage/app-forensics/ on any gentoo machine.
  • Linux rootkits (Score:1)

    by FreeBSD evangelist (873412) on Monday December 18 2006, @08:46PM (#17295462)
    I can't help but point out on FreeBSD you can use CVSup to force your sources to match the master site, and then "cd /usr/src ; make world". Around an hour later (depending on your machine) you will have completely new binaries for the kernel, kernel modules, binaries, docs, etc.

    Bye bye rootkits, viruses, back doors and the like.
    • Re:Linux rootkits by The_Cheese_Stands_Al (Score:1) Monday December 18 2006, @09:23PM
      • Re:Linux rootkits by FreeBSD evangelist (Score:1) Monday December 18 2006, @09:43PM
        • Re:Linux rootkits by The_Cheese_Stands_Al (Score:1) Tuesday December 19 2006, @01:03AM
          • 1 reply beneath your current threshold.
  • by RealGrouchy (943109) on Monday December 18 2006, @10:57PM (#17296364)
    Joke's on you, Linux boys (and girls?)!

    I don't have to worry about this. I use Windows!

    Oh wait...

    - RG>
  • by FellowConspirator (882908) on Tuesday December 19 2006, @10:21AM (#17300098)
    The best way to detect a rootkit: post-install, hash the installed file-system files and kernel and save the results on a CD-R. Periodically, check to see if the hashes have changed. If so, you know where the problem lies.
  • Isn't the point of a rootkit is to take over the file system to such an extent that virus activity is hidden from programs like scripts running on the kernel.
    [ Parent ]
    • 1 reply beneath your current threshold.
  • What is the point of a script that asks a compromised operating system about the files that compose it? One of the first things that a rootkit should do when it modifies the environment is ensure that whenever system files are queried, the response is the 'correct' one.
    [ Parent ]
  • 4 replies beneath your current threshold.