Become a fan of Slashdot on Facebook

 



Forgot your password?
typodupeerror
×

Weakness In Linux Kernel's Binary Format 281

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.
This discussion has been archived. No new comments can be posted.

Weakness In Linux Kernel's Binary Format

Comments Filter:
  • 1 meg PDF? (Score:5, Funny)

    by Lehk228 ( 705449 ) on Tuesday October 03, 2006 @06:52PM (#16298927) Journal
    yes, a pdf linked from slashdot will last a long time...

    oh wait it's already gone
  • And? (Score:5, Informative)

    by ledow ( 319597 ) * on Tuesday October 03, 2006 @06:54PM (#16298943) Homepage
    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.
    • by Anonymous Coward
      "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."

      If I found Goatse.cx in Linux? I'd panic too.
    • Re: (Score:2, Informative)

      by Anonymous Coward
      How many average-Joe-who's-friends convinced-him-to-run-Linux's run as root, though?
      • Probably none. (Score:5, Informative)

        by SanityInAnarchy ( 655584 ) <ninja@slaphack.com> on Tuesday October 03, 2006 @07:15PM (#16299189) Journal
        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.
    • I cannot RTFA as it is slashdotted, but if you need to be root then yes, it is over and not much more to be said. Any non-hardened linux kernel will likely have things like /dev/kmem, or even something like insmod will let root insert code into kernel space for goodness sake!

      A hardened kernel would most likely not allow runtime binary formats anyway (I'm pretty sure you can restrict it to just elf if you want). So it is a complete non-event. I'm not sure the kernel developers would even bother fixing i

      • They'll fix it. (Score:5, Interesting)

        by SanityInAnarchy ( 655584 ) <ninja@slaphack.com> on Tuesday October 03, 2006 @07:20PM (#16299241) Journal
        They'll fix it out of pride, and because it's the right way to do it. That's assuming this is actually a flaw -- a buffer overrun or something. For instance, if it's some retard saying "Oh cool, I can install a rootkit by changing a couple of bits here in /dev/kmem", then no, they won't fix it. But if it only requires access to, say, the binfmt_misc filesystem, then it is a bug.

        And it's important to remember things like this when you see Symantec, Microsoft, and others trying to spread FUD about Linux security. If anyone cares about this bug at all, even just as a matter of keeping the code neat, it will be fixed -- but it will also drive up the numbers of "Linux exploits patched recently". Always, always, always look at the relative severity of the exploits.
        • by Tyger ( 126248 )
          It wouldn't be just "changing a couple bits here in /dev/kmem", but from the summary (Still waiting on the article) it sounds like it is pretty close. It could potentially be "fixed" by changing how things are handled (Again, still waiting on the article) but there are so many ways a system can be compromised if someone has kernel level access.
    • Re:And? (Score:4, Insightful)

      by Vo0k ( 760020 ) on Tuesday October 03, 2006 @07:24PM (#16299275) Journal
      still, a stealthy nest for your rootkit is always welcome. A system should remain transparent enough to make the intrusion obvious, this trick allows to install stealthy backdoor.
      • Any rootkit is going to be stealthy. It hooks to kernel calls, so say you search for the binary on the hardrive, hmm well that involves a kernel call which you grabbed so you respond by saying all files but yours is there. What about running processes? Oh yeah, have to make a kernel call for that, which was intercepted again by the rootkit, and guess what, it doesn't show that it is running!

        The original poster was correct, this isn't news. It is trivial to install a rootkit with root access. Do this in us
    • 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.

      This will make you think twice before installing non free software on your nice free system. You should already think twice about it because of all the advantages free software has, but every now and then you run into a device driver or game you want. If the computer is just a toy

    • by Cheapy ( 809643 )
      Good thing this headline wasn't a "Massive Hole Found in Linux" panic headline!
    • Re: (Score:3, Insightful)

      by Yvanhoe ( 564877 )
      but it's hardly worth the shock-factor of "Massive Hole Found In Linux" panic headlines.

      The title reads "Weakness In Linux Kernel's Binary Format", quite accurate if you ask me.
  • by czehp ( 156215 ) on Tuesday October 03, 2006 @06:54PM (#16298947) Homepage
    OMFG! I have a security flaw... but you have to be _root_ to execute it! AHHHHH It's the end of the world!

    I discovered a new one too... if you run rm -rf / as root you'll bork your system!

    We should all go back to windows, where rm doesn't exist ^_^
    • deltree

      I think they removed it from the normal windows distro back in win2K though.
      -nB
      • Yeah. Del now deletes directories and all files under it :)
    • yeah no shit. As root you can just pwn things running ring-0 [or equiv] on the processor. You don't need to exploit a bad API to do this.

      Now if you could insert modules as a non uid=0 user then that'd be something...

      Tom
    • MOD PARENT UP. I nearly puked I laughed so hard.
    • by Duhavid ( 677874 )
      On AIX, I think it was a last 3.x version, a friend of mine
      found that a "simple" chown -R from the root was quite
      sufficient to bork a system.
    • if you run rm -rf / as root you'll bork your system!
      Not if you use the immutable attribute. `chattr +i files' It protects the files so they cannot be changed at all (hence the name) even by root. Of course, root can remove the attribute, so it is not a security measure, but a protection against typos and stupidity.
  • by Spikeles ( 972972 ) * on Tuesday October 03, 2006 @06:57PM (#16299001)
    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.
    • by cp.tar ( 871488 )

      This is akin to an acquaitance of mine who claims that Linux is insecure because if you have physical access, it's usually easily crackable.

      Well, duh.

    • by windex ( 92715 )
      That's crap. It dosen't work on SELinux, but may if any bypass-type holes in SELinux show up.

      Any complete memory protection/RBAC system can prevent stuff like this (e.g. http://www.grsecurity.org/ [grsecurity.org]), but it shouldn't. For example, you can make it impossible to insert kernel modules after startup in grsecurity, but for a long time a 'root only' bug in the kernel allowed you to insert a module and execute it anyway (this may be the same bug, who knows). Good RBAC setups assume root is untrusted.
      • by Feyr ( 449684 )
        you can remove the privilege to insert kernel modules in the standard kernel too, even by root. no need for a fancy patch. look up linux "capabilities"

    • 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.

      For the record, SELinux is nice, but should not be considered your first defense against attackers. Even if it's considered a good secondary defense, the primary defense should certainly be fixed ASAP.
      • Re: (Score:3, Informative)

        by julesh ( 229690 )
        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)
        * Modi
    • by jesdynf ( 42915 )

      I got aggravated as soon as I saw the summary -- hey, big news guys, install ssl/omgpwned.o into the kernel as root and you're in ~o trou-ble o~ !!!

      'Tards.

    • You could do just about anything you want via modules, including installing all kind of nasties via the reported mechanism, or by installing a nasty file system, driver, whatever. For example, you could write a "file system" or "device driver" that allows tou to write in other modules etc from user space.

      Basically loadable modules are an obvious "back door" and hardly a security flaw if managed properly. If you're going to hand out module loading access you're going to get it where you deserve!

  • by SanityInAnarchy ( 655584 ) <ninja@slaphack.com> on Tuesday October 03, 2006 @07:06PM (#16299095) Journal
    For instance, lock it away in a chroot jail.

    Solution: Don't give your chroot jail access to the binfmt filesystem. I'm not sure how this can be done, though, as root is allowed to mount pretty much whatever it wants.

    Real solution: Don't bother to compile in binfmt support. The only reason for the kernel to recognize any format other than elf or a.out is to call an interpreter to run that file with elf or a.out. Every shell I know of recognizes the shebang at the beginning of most scripts (perl/python/ruby/bash), and you generally launch programs through the shell. Most people will be running programs from the GUI, where this is even less of a problem -- for the most part, they'll be clicking on icons which contain a command like "perl /usr/bin/foo.pl" or whatever.

    However, I'd like to actually read the PDF and find out if I'm right about this. Damn Slashdotting.
    • Re: (Score:3, Informative)

      by cortana ( 588495 )
      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'.
  • by Aqua_boy17 ( 962670 ) on Tuesday October 03, 2006 @07:14PM (#16299185)
    This was forwarded by our Sec Admin tonight in case you haven't seen it: http://www.securityfocus.com/bid/20249 [securityfocus.com]
  • Mirror (Score:5, Informative)

    by paulproteus ( 112149 ) <slashdot@ashe[ ].org ['esh' in gap]> on Tuesday October 03, 2006 @07:20PM (#16299235) Homepage
    I've mirrored the English PDF [jhu.edu].
  • simply (Score:5, Funny)

    by Anonymous Coward on Tuesday October 03, 2006 @07:30PM (#16299321)
    simply linked list

    As opposed to difficultly linked lists?
  • by hey ( 83763 ) on Tuesday October 03, 2006 @07:32PM (#16299349) Journal
    Do they mean "singly" instead of "simply"?
  • by nick_davison ( 217681 ) on Tuesday October 03, 2006 @07:46PM (#16299469)
    A weakness in the binary format? OK, who's to blame here, the ones or the zeroes?

    You'd have thought they'd have caught this sooner. It's not like it's that long of a list to exhaustively test.
    • by Nahor ( 41537 )

      A weakness in the binary format? OK, who's to blame here, the ones or the zeroes?

      You'd have thought they'd have caught this sooner. It's not like it's that long of a list to exhaustively test.

      I found a weakness in your brain. Who is to blame, the As, Cs, Gs or Ts?

      You'd have thought your parents would have caught this sooner. It's not like it's that long of a list to exhaustively test.

      Sorry, I couldn't resist :)

    • Re: (Score:3, Funny)

      by a.d.trick ( 894813 )
      It's not the individual 1's and 0's. It's when they get together that you start to see problems. You wouldn't believe the horrible things that can happen when you get a horde of 1's and 0's together.
    • Re: (Score:3, Funny)

      by eggoeater ( 704775 )
      Binary! BAH!!

      I've always said if you want a secure kernal, you code it in analog format.

    • by Ruie ( 30480 )
      A weakness in the binary format? OK, who's to blame here, the ones or the zeroes?

      You'd have thought they'd have caught this sooner. It's not like it's that long of a list to exhaustively test.

      Actually it is a binary flood attack: when one issues a command su followed by a stream of ones and zeroes (different for each system, but usually about 64 bit long) one can get root access.

      • by jZnat ( 793348 ) *
        I don't know about you, but I tend to use passwords larger than 8 characters for root... ;p
    • Remember this is linux, so it's either the GNU/ones or the GNU/zeroes that are at fault.
    • I blame the twos.
  • Nice catch! (Score:3, Insightful)

    by shrapnull ( 780217 ) * on Tuesday October 03, 2006 @07:57PM (#16299557)
    Whether this is a show-stopper or not, it's a great example of what can happen with tons of eyeballs on a project. This is the type of bug that proprietary vendors would suffer to discover with such limited resources on a single project. It makes me wonder how often proprietary kernels are retooled *after* a flaw has been found in a similar OSS product.
  • Disable modules (Score:2, Interesting)

    Yeah, a good while back, there was discussion about the possibility of inserting malicious kernel modules to take over a system. About that time I decided that all my linux servers would have modules disabled. I'm already an advocate of simply compiling support for hardware directly into the kernel (instead of as modules), but I just started taking it to another level. Sure, it means sometimes that you have to restart a system to gain new functionality, but that's much better than the risk of getting own
  • How come every story that I find interesting gets tagged fud, notfud?
    • How come every story that I find interesting gets tagged fud, notfud?


      It's political season. Whatever one person says another has to say the opposite just because.
    • Re: (Score:3, Informative)

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

      > fud, !fud

      Quoth the FAQ [slashdot.org]:

      For the opposite of a tag, prefix it with "!", e.g. "!funny" means unfunny.
  • . . . .is like securing a system from "real-life" hardware access.

    It makes little to no sense.

    Root-level "hacks" are an oxymoron. Once you're root, the skies the limit. Why bother just tinkering with kernel modules when you can just replace the whole kit-n-kaboodle?
    • 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

  • Who cares? Frankly, 2.0 has been around for about 10 years. Which, in tech years, is a freakin long time. This is easy to remember because an MKLinux server on the network runs 2.0, which was built in 1997. I don't recall any major rootkit problems in the past decade. So, if nothing major has happened in the last ten years targeting this particular flaw, then why do we lose sleep over it now? I'm not gonna worry about it. What I am gonna worry about is the new call structure in 2.6.17 that's messed everyone
  • by KidSock ( 150684 ) on Tuesday October 03, 2006 @10:40PM (#16300597)
    If this requires inserting a kernel module, a kernel module has as much privledge as the kernel itself so why would anyone bother with "exploiting" some kind of flaw. This seems like opening a door with a key and then kicking it down from the inside.
  • What you mean those of use still running the last of the 1.2 series aren't running Linux... I knew there was a reason not to trust that new fangled stuff they've been adding to my perfectly fine kernel... *grin*.


    I long for the days of yore when 1.2 was the kernel of choice. It was an easier time, I could actually understand most of the kernel config options back then...


    Kirby

  • by Lost+Found ( 844289 ) on Wednesday October 04, 2006 @12:19AM (#16301185)
    As the first person who replied to this announcement in LKML, I will certify that this "weakness" is pretty silly. Here's what the claim is:

    1. You must be root
    2. You must be able to load an arbitrary kernel module
    3. You write an arbitrary kernel module that calls a kernel function to install yourself as an "binfmt handler"
    4. That kernel module is put on the _front_ of the list instead of the _end_
    5. Every program that runs now ends up calling your "binfmt handler" first

    Their solution:

    1. Put it on the _end_ of the list instead of the _front_ when it registers itself, that way it only runs if the binfmt cannot be identified...

    This is literally just as stupid as discovering that you can call fork() and exec() with an argv of "/bin/rm", "-rf", "*". Oh no, everyone must patch their systems! Seriously, anyone who can load an arbitrary kernel module could technically do _anything_, including replace the whole kernel image from the inside out!
  • by Myria ( 562655 ) on Wednesday October 04, 2006 @02:05AM (#16301705)
    I dislike Microsoft, but I like Windows NT much more than Linux. Win32 is crap, but the NT kernel is great. NT's security model is much better than Linux's. Note that this is the model; NT being insecure is not because of its model.

    Privilege separation - essentially having different types of "root" - is something NT does better than Linux. NT has the concept of "privileges". Privileges are special flags that "tokens" may have. (A token is a set of security credentials assigned to a process; compare to UID and GID in UNIX.) Each privilege grants its holder the ability to override one feature of the security system.

    Some examples of privilege:
    - "Backup": Able to read any file on the system regardless of ACLs.
    - "Restore": Able to set file ownership to anyone, not just themselves.
    - "Take ownership": Able to take ownership of any file, which grants the right to change the ACLs.
    - "Debug": Able to do the equivalent of ptrace() on any process regardless of ACLs.
    - "Load driver": Able to load kernel driver.
    - "Lock pages": Able to lock memory pages (prevent swapping to disk).
    - "Create token": Able to create tokens, basically allowing forging of credentials (this is how processes get tokens).

    There is an account called "SYSTEM" that is considered to have all privileges. However, in general you want to avoid this for obvious reasons. You create an account for the service with these privileges. Trusted services don't have to always be root when they do special things.

    However, there is always the problem that certain privileges are privilege-complete: they can be leveraged to gain all privileges. "Create token" makes it easy to become a SYSTEM process. "Load driver" is obvious. "Debug" lets you inject machine code into privileged processes like winlogon.exe. Thus, this privilege system can become a safety system instead of a security system. Likewise, "limited root" in UNIX is an arcane way of doing the same thing, and has the same issues.

    I hope this comparison with another OS helps with understanding the many issues brought up. Limiting root is like making water not wet. Or radium not radioactive, if you want to say that you can make water not wet.

    Melissa
    • Re: (Score:3, Insightful)

      by oglueck ( 235089 )
      How is this a security model? All a "privilege" does is open a special hole in an otherwise secure model. Almost any of these holes can be used to execute arbitrary code as the superuser. So instead of giving a token any of these privileges you could simply run the token as the superuser - it's not less secure.

      Backup: I can read any file, especially the password DB.
      Restore: I can replace any system file with a modified version.
      Take ownership: I can replace any system file with a modified version.
      Debug: I ca
      • by Tony Hoyle ( 11698 ) <tmh@nodomain.org> on Wednesday October 04, 2006 @04:24AM (#16302343) Homepage
        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.

    • Re: (Score:3, Insightful)

      by argoff ( 142580 ) *
      It is called SELinux [nsa.gov] and has been built into Linux for a long time. But unless you need it for a specific situation, privilege separation is a pain in the ass which is why many people turn it off. I would be glad to sacrifice some usability if it made windows more secure, but ironically a Linux box with privilege separation turned off is still more secure.

"If I do not want others to quote me, I do not speak." -- Phil Wayne

Working...