Slashdot Mirror


Weakness In Linux Kernel's Binary Format

Goodfellas writes, "This document aims to demonstrate a design weakness found in the handling of simply linked lists used to register binary formats handled by the Linux kernel. It affects all the kernel families (2.0/2.2/2.4/2.6), allowing the insertion of infection modules in kernel space that can be used by malicious users to create infection tools, for example rootkits. Proof of concept, details, and proposed solution (in PDF form): English, Spanish.

24 of 281 comments (clear)

  1. And? by ledow · · Score: 4, Informative

    Although any auditing is welcome and they may be a problem here, the fact is that it's hardly news and not exploitable. The reports says itself that you have to be root to exploit it. It's already game-over. Yes, look for these sorts of things and find them but it's hardly worth the shock-factor of "Massive Hole Found In Linux" panic headlines.

    1. Re:And? by Anonymous Coward · · Score: 2, Informative

      How many average-Joe-who's-friends convinced-him-to-run-Linux's run as root, though?

  2. This is so not serious by Spikeles · · Score: 5, Informative

    For those who won't read it..

    Basically there is this table that contains a list of handlers for the various exes, if if a handler returns a failure the loop that parses the table will stop iterating. If you insert a kernel module first you can take control of all executable types b4 any other handles get to handle it.

    BUT...It requires root access and wont work on SELinux. This is a serious how? I mean if you have root access, then the entire system is compromised already.

    --
    I don't need to test my programs.. I have an error correcting modem.
    1. Re:This is so not serious by julesh · · Score: 2, Informative

      It seems to me that having root access != having easy backdoor access to exes.

      For instance, if I can load a wrapper around your financial program, without modifying your financial program (So AIDE would find it), I could more easily grab your data.


      Yes, but there are already so many ways that modification could be made:

      * Modify libc.so to perform the task you want (applicable to all modern unix systems)
      * Modify ld-linux.so or equivalent to perform the task you want (applicable to all ELF-based systems)
      * Modify the system config to automatically load an additional shared library to perform the task you want
      * Modify the user's config to automatically load an additional shared library to perform the task you want
      * Add a module to the kernel that intercepts the system calls the program wants and performs the task you want
      * Add a module to the kernel that allows an additional process to snoop on the program's memory and perform the task you want
      etc.

      There are plenty of ways of using the operating system's features to do just about anything you want to, even to other programs. This is intentional. It allows flexibility. There is a reason why new binfmt handlers are added to the front of the list, rather than the back, and that is to allow a new handler to override specific cases that would usually be handled by an old one. You add generic handlers first (typically just the ELF loader these days) and then specific ones afterwards (perhaps a handler for broken ELF files produced by a strange compiler). You don't want to have to load the specific ones first, because specific stuff is less likely to be actually needed, so you really want it to be a module.

  3. Probably none. by SanityInAnarchy · · Score: 4, Informative

    Depends on the friends and the distro, but let's see. Debian prompts you to set up an ordinary user/password, as well as a root password. Gentoo does the same, only via documentation, not an installer. And Ubuntu, the distro most friends would send noob-friends to, does not set up a root password at all -- all root access on Ubuntu has to go through sudo.

    Most Windows/IE attacks don't require you to even have local access, let alone root.

    --
    Don't thank God, thank a doctor!
    1. Re:Probably none. by oKtosiTe · · Score: 2, Informative

      No, only the initial user account does.

    2. Re:Probably none. by bcat24 · · Score: 2, Informative

      Werd. That's why the first thing I do when I set up a Ubuntu box is enable the root account and make sudo use the root password, not the user's password.

    3. Re:Probably none. by SanityInAnarchy · · Score: 2, Informative

      It used to be risky. Password hashes used to actually be stored in /etc/passwd, where anyone could read your password hash. If there was a weakness in the hash algorithm, or your password was particularly short, they could brute-force it that way -- hence, "time consuming".

      On most modern systems, it is also impossible, because the actual password hashes have been moved to /etc/shadow.

      If you are root, you can still attempt to brute-force them -- which would be time-consuming and almost never has a point. If you're hoping they use the same password elsewhere, you can simply install a keylogger -- which is assuming you weren't smart enough to do that when they first set their password. If you simply need access to their account, you can su in. If you need to reset their password, you can do that as root without knowing the original password.

      Which means that this whole system is about as exploitable as an "exploit" which gives you root access, but which only works if you're already root.

      --
      Don't thank God, thank a doctor!
    4. Re:Probably none. by smash · · Score: 4, Informative
      Knowing about how linux works doesn't exclude you from the set of potential ubuntu users.

      I've adminned Linux since 1996 (1996-2001 as an ISP sysadmin, 2001-2004 for corporate mail, proxy, IPSec gateway, etc), yet most of the time these days for a desktop I install/use/recommend Kubuntu. Why? Because it just works for the most part. I've been through the rolling my own distro from scratch, building all my stuff from source games and to be honest, I have more important things to do these days :)

      Sure I'll muck around with that sort of thing from time to time, but when I just want to get work done, *ubuntu is quick and easy.

      --
      I run: Windows, OS X, Linux, FreeBSD. Just because you have a hammer, doesn't mean everything is a nail.
    5. Re:Probably none. by SanityInAnarchy · · Score: 2, Informative

      This has got to be the most obnoxious thing people do on Slashdot. Yes, I got the joke. It was funny, I laughed. My comment is also actually relevant to the discussion.

      --
      Don't thank God, thank a doctor!
  4. Mirror by paulproteus · · Score: 4, Informative
    --
    |/usr/games/fortune
  5. Re:Criptic summary by Anonymous Coward · · Score: 1, Informative

    Apparently (according to another poster) it is. So who enables misc binaries in a kernel build and why would they do this? The only people I can think off are mono users but they're fools anyway.

  6. Re:What about other ELF systems? by IWannaBeAnAC · · Score: 4, Informative
    With the caveat that I cannot RTFA as it is slashdotted, if the summary is in any way accurate then it will not affect the BSD's or Solaris. SCO I don't care about, especially as it would only affect them if they stole the relevant code from Linux in the first place.

    Linux has a feature that allows you to register a new binary format loader. Of the traditional formats, ELF is the most common, a.out is ancient, I don't think I've ever seen an a.out executable on a Linux machine). But on Linux, for example, if you wanted java programs to run automatically when you execute them then you could install a loader for java files that runs them through the interpreter/jvm.

    I don't know which other unixes have this capability, but IIRC Linux was the first so it follows that any other implementation is architecturally independent, so shouldn't share the same implementation flaws.

  7. Re:What about other ELF systems? by Tyger · · Score: 5, Informative

    I'd say this is just a specific case of inserting malicious code into a kernel level linked list. Most kernels have linked lists meant to be accessed by drivers. I've actually done something very similar in Solaris using the SVR4 STREAMS driver model. I created a STREAMS module that inserted itself into the TCP stack in such a way that it was totally invisible, but got all data and control commands passed through it. (Excpet I wasn't writing malicious code. In that case, I was hiding it from any potential hackers, as well as applications that might break if the STREAMS modules aren't loaded like they expect.) There are other places it could be inserted for malicious purposes aside from the network stack, though. (Not that the network stack isn't a bad place to be for someone who wants to do some damage, but it doesn't help with hiding rootkits. It would be more useful as a rootkit payload.)

    I'm sure BSD has a linked list that could be similarly exploited. It won't have the same capabilities as the Linux binfmt one, but it will have it's own set of things it could be used for.

    However, I agree with other users. In a monolithic kernel, once someone has root and can load kernel drivers, or even access kernel memory, all bets are off. The only possible system I can see not being exploitable in such a way would be a pure microkernel architecture with memory protection, none of which I can think of off the top of my head. Mach still has loadable modules. QNX is closer but even QNX lets you register code to be called as an ISR from the kernel, and at that point you have full access to the kernel memory, and you are even conveniently passed a pointed to some kernel data structures so you don't have to try and figure out kernel symbols.

    The point is, once you have root, there are any number of ways to compromise the system and hide your exploits. It's good to have the information about as many different ways as possible out in the open, but it's hardly alarming news that there's yet another discovered.

  8. Re:Problem: Sometimes you want to limit root. by cortana · · Score: 2, Informative

    FYI, I believe it is the kernel itself that interprets the #!(interpreter)\n at the start of a file, not the shell.

    But anyway... I don't think you can constrain root with chroot(2) anyway. root can mknod(2) himself a device file and access your filesystems directly if he wants. Or he can do the same for one of the mem(4) devices. Or call ioperm(2) and talk to hardware devices with iopl(2). There are probably dozens of other methods to escape from such a 'jail'.

  9. Re:Too bad you have to be root. by Lehk228 · · Score: 4, Informative

    that is more due to limitations on NTFS and FAT* than self protection

    unix filesystems can delete an in-use file and only physically remove it when it is no longer in use, windows cannot do that. hence having to reboot for so many updates and some configuration changes (such as changing host name)

    --
    Snowden and Manning are heroes.
  10. Re:simply by Penguinoflight · · Score: 4, Informative

    Most CS types would say that SLL is Singly Linked List. The construct allows for references to next, but not to previous.

    --
    "And we have seen and do testify that the Father sent the Son to be the Savior of the World"
    1 John 4:14
  11. Have modpoints, can't find an intelligent comment by mr_tenor · · Score: 3, Informative
    Why bother just tinkering with kernel modules when you can just replace the whole kit-n-kaboodle?


    Because it's damn hard! Nobody here seems to realise that the point of this paper is (I'm guessing) that there's yet another neat way to code up an exploit "without depending on the sys_call_table[]" - it's in the damn title.

    If you know anything about the topic, which I guess most people who've commented don't, then it's near trivial for an attacker to write code to do unauthorised stuff if they have the address of the symbol sys_call_table, but that's been removed to make life harded for shellcoders.

    And "having root" doesn't mean an attacker sits down at an xterm with a root account, it might mean that he can remotely trick some system service into running 24 bytes of instructions as root or something. So stop being so dismissive of this sort of research.
  12. Re:Nothing to see here, move along! by Dogun · · Score: 2, Informative

    Really? '*'? You're quite sure about that?

  13. This is completely bogus! by Anonymous Coward · · Score: 2, Informative

    If you get to the point where you can load code into the kernel (as in; load a module), then you can replace *anything* in the kernel and you effectively own the box.
    There's no bug here.

  14. Re:Windows NT and privilege separation by Tony+Hoyle · · Score: 3, Informative

    Create token is the 'meta' privilege - it lets you create a system level token with *any* privilege and then switch to that context... essentially anyone/thing with that privilige has all rights to the system and you cannot stop them (takes a little work.. it's not got a GUI or anything, but anyone with access to MSDN online could work it out).

    The NT system is ass backwards because it lets you *add* privileges. The Linux capabilities system does it right - process 1 starts with all privileges, then it removes them. It is *impossible* to add a new privilege - you have to ask a more privileged process to do your work for you.

  15. Re:Too bad you have to be root. by Tony+Hoyle · · Score: 3, Informative

    You misunderstand what FILE_SHARE_DELETE does.

    That just allows other processes to open a file that is opened with delete access. It does not allow you to delete a file that is in use - that is still impossible in Windows.

  16. Re:How come... by BertieBaggio · · Score: 2, Informative

    Because people don't know the correct tags. It should be:

    > fud, !fud

    Quoth the FAQ:

    For the opposite of a tag, prefix it with "!", e.g. "!funny" means unfunny.
    --
    If all you have is a grenade, pretty soon every problem looks like a foxhole -- MightyYar
  17. Re:Criptic summary by Anonymous Coward · · Score: 1, Informative

    Hint: that is not an a.out file.