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.

57 of 281 comments (clear)

  1. 1 meg PDF? by Lehk228 · · Score: 4, Funny

    yes, a pdf linked from slashdot will last a long time...

    oh wait it's already gone

    --
    Snowden and Manning are heroes.
    1. Re:1 meg PDF? by Kingrames · · Score: 2, Funny

      Let's hope it didn't contain the malicious code. You know someone thought of it.

      --
      If you can read this, I forgot to post anonymously.
  2. 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. Re:And? by Vo0k · · Score: 3, Insightful

      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.

      --
      Anagram("United States of America") == "Dine out, taste a Mac, fries"
    3. Re:And? by Yvanhoe · · Score: 2, Insightful

      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.

      --
      The Wise adapts himself to the world. The Fool adapts the world to himself. Therefore, all progress depends on the Fool.
  3. Too bad you have to be root. by czehp · · Score: 5, Funny

    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 ^_^

    1. 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.
    2. 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.

  4. 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 SanityInAnarchy · · Score: 2, Insightful

      As someone else mentioned, Linspire has not done this in a long time. In fact, I believe they've never actually released a stable version that ran as root. They just (quite retardedly) went around claiming that running as root was secure, in defense of what they did once, in a development version, likely never seen by Average Joe.

      It should be secure for Average Joe. He might not be running Linux now, but it should be the goal.

      If that's the goal, Average Joe can fire up Ubuntu, right now. Ubuntu never tells the user anything about root, but requires the user to enter their own password occasionally, so that sudo can grant privileges to change critical system settings, install software, etc. This is the same model OS X uses, yet Ubuntu is more secure, because installing new apps does not necessarily require downloading and executing unverified executables.

      --
      Don't thank God, thank a doctor!
    2. Re:This is so not serious by SanityInAnarchy · · Score: 3, Interesting

      If you assume Average Joe doesn't get even the least suspicious when something asks him for a password, then Average Joe is doomed.

      Think about it. Average Joe will demand admin access in order to change settings and install software. So we have to choose between removing that access entirely (so there's no password for Joe to type), or praying that Joe is smart enough to realize he's giving something admin access.

      Really, can you possibly think of a solution to this kind of stupidity? Hell, I could simply craft a website -- maybe a Flash page -- that looks just like the Ubuntu password prompt. That way, I don't even need local user access.

      I say this solution is reasonably secure because we don't really have anything more secure. Kind of like how Democracy sucks, but it's also the best we've got.

      --
      Don't thank God, thank a doctor!
    3. 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.

    4. Re:This is so not serious by SanityInAnarchy · · Score: 3, Insightful

      But an exploit in the Linux kernel that requires root-access is as serious as any other exploit.

      No, it's not, and you're an idiot for suggesting it. I really hope you're joking.

      Average Joe: OK!

      Average Joe will have already hosed his system, and there isn't a damned thing we can do about it other than send Average Joe to a newbie concentration camp. (Before you say anything, I was raised Jewish. I don't really condone newbie genocide. Think of it more like driver's ed.)

      Let me put it this way: If Average Joe will type his password to add a precompiled binary to his kernel, he'll certainly type his password to install a custom kernel to his /boot. He also won't have a problem with rebooting -- Windows makes him do that all the time, whether or not the installed program really needs him to. Thus, even if we completely prevent the kernel from being modified at runtime, the kernel can be replaced wholesale.

      That's ignoring the numerous other ways to modify a running kernel. /proc/kmem is one. But this exploit in particular requires a module to be loaded. If you can convince the user to load a module, you don't NEED this exploit -- there is nothing to stop you from rampaging all over the kernel space anyway.

      But even with modules disabled, it's far too easy for root to install a rootkit, or do other evil things to users. Hell, a rootkit could be as simple as writing a glibc wrapper. And if Average Joe will go root so easily, Average Joe is probably not a good target for a rootkit. How often is he going to actually look for files that a rootkit might otherwise hide? Couldn't malware simply hide in dot-files and be perfectly safe from Joe?

      There simply isn't a way of giving the user enough power to do what they want, without also giving them the ability to screw it all up. The only solution for morons like Joe is to not give them that power. Reserve enough for admins, and Joe is not an admin.

      Your statement is like saying a pistol you can shoot yourself in the foot with is just as dangerous as a pistol that explodes in your face. Look, it's simply not possible to make a useful handgun that you can't shoot yourself in the foot with -- by its very definition, a handgun will shoot wherever you point it, and it will always be physically possible to point it at your foot. You have these options to attempt to secure Average Joe:

      • Actually teach people about gun safety before you give them a gun. (Teach sane computer use in the store.)
      • Don't let people have a gun unless they can use it safely. (Test people's computer sanity in the store.)
      • Offer your services as a bodyguard or hitman instead. (Don't let them have the root password. Admin their computer for them, installing software when they ask, updating when they don't.)
      • Sell them an armored boot (firewall, online AV). Some will take it off because it's uncomfortable (blocks things they want), or to get a better shot at their foot (willingly let in known malware).
      • Sell them health insurance (antivirus) and emergency medical care (recovery tools, Geek Squad).
      • Sell them prosthetic feet, which they can blow off and replace at will. (Sell them a new, faster computer, rather than clean up their old one.)

      I can't think of any other alternatives. Sure, you could give them a club instead of a pistol (UAC, Knoppix, restrict them to oblivion), but they'll still be able to beat their foot into a pulp (though it'll be harder), and it's a hell of a lot harder to club birds down than to shoot them down (insane restrictions make it harder to use the computer in the first place). The current approach seems to be to try to grab their hand every time they're about to, and say "Are you sure you want to blow your leg off?" But no one pays attention, because we do that anyway when they are shooting in the right direction (UAC being annoying), and sometimes

      --
      Don't thank God, thank a doctor!
  5. And? Hol-e terror. by Anonymous Coward · · Score: 3, Funny

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

  6. Problem: Sometimes you want to limit root. by SanityInAnarchy · · Score: 3, Interesting

    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.

    --
    Don't thank God, thank a doctor!
  7. Not the only one today by Aqua_boy17 · · Score: 3, Interesting

    This was forwarded by our Sec Admin tonight in case you haven't seen it: http://www.securityfocus.com/bid/20249

    --
    What if the Hokey Pokey really is what it's all about?
  8. 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 SanityInAnarchy · · Score: 5, Insightful

      This argument has been tried over and over again. It is prohibitively difficult to make an attack like this work.

      The only way I know of to change the user's password requires the user to type their password.

      Yes, you could use a keylogging-type attack, but sudo does make this prohibitively slow unless you really know what you're looking for. Even if you do, you still have to wait for the user to answer a sudo prompt.

      You could theoretically crack the user's password from the password hash, but this is both time consuming and impossible -- /etc/shadow is not readable by ordinary users.

      Beyond this, you could try a phishing attack -- put up your own sudo-like prompt and hope they bite -- but that's about it.

      How would you propose to remedy this situation? Do you switch to another VT or use a magic sysrq key everytime you become root?

      --
      Don't thank God, thank a doctor!
    3. Re:Probably none. by TeraCo · · Score: 4, Funny
      but this is both time consuming and impossible

      Phew, I'm glad it's not just impossible. That might have been risky.

      --
      Not Meta-modding due to apathy.
    4. 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.

    5. 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!
    6. 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.
    7. 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!
    8. Re:Probably none. by tehcyder · · Score: 2, Insightful
      This has got to be the most obnoxious thing people do on Slashdot
      It's not quite as bad as linking to that web page which blasts out "I'm looking at gay porn" over your speakers when your boss is wandering past, surely?
      --
      To have a right to do a thing is not at all the same as to be right in doing it
  9. Mirror by paulproteus · · Score: 4, Informative
    --
    |/usr/games/fortune
  10. They'll fix it. by SanityInAnarchy · · Score: 4, Interesting

    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.

    --
    Don't thank God, thank a doctor!
  11. 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.

  12. simply by Anonymous Coward · · Score: 5, Funny

    simply linked list

    As opposed to difficultly linked lists?

    1. 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
  13. Simply? by hey · · Score: 3

    Do they mean "singly" instead of "simply"?

  14. Weakness In Linux Kernel's Binary Format by nick_davison · · Score: 5, Funny

    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.

    1. Re:Weakness In Linux Kernel's Binary Format by a.d.trick · · Score: 2, Funny

      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.

    2. Re:Weakness In Linux Kernel's Binary Format by eggoeater · · Score: 2, Funny

      Binary! BAH!!

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

  15. Nice catch! by shrapnull · · Score: 2, Insightful

    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.

    --
    If you're half as beautiful naked, you'd be 4 times as beautiful with twice as many clothes on.
  16. 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.

  17. 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'.

  18. Disable modules by DeathAndTaxes · · 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 owned by some kernel module. ;-)

  19. Re:Compile Options by Tyger · · Score: 2, Interesting

    It wouldn't require a reboot any more than Windows viruses require a reboot to start their infection. Just because the kernel is fully monolithic and does not have loadable kernel modules does not mean you can't change it. If you have access to /dev/kmem, you can still open it up and modify kernel data structures and insert code into kernel memory yourself. (In fact, IIRC, that's exactly how the original implementation of LKM for Linux worked.)

  20. Pointless by ZxCv · · Score: 4, Insightful

    .... but that's much better than the risk of getting owned by some kernel module. ;-)

    If someone is loading kernel modules on your machine, you've already been owned.

    --

    Perl - $Just @when->$you ${thought} s/yn/tax/ &couldn\'t %get $worse;
  21. Securing a System from "Root". . . by WhiteWolf666 · · Score: 2, Interesting

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

    --
    WhiteWolf666 an exBush supporter. All you new-school,compassionate,save the children Republicans can rot in hell
  22. Do I care? Not really by Ice+Wewe · · Score: 2, Insightful

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

  23. 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.
  24. Why "exploit" if you're already in? by KidSock · · Score: 2, Insightful

    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.

  25. Nothing to see here, move along! by Lost+Found · · Score: 5, Insightful

    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!

    1. Re:Nothing to see here, move along! by Dogun · · Score: 2, Informative

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

  26. That's an insightful question by Beryllium+Sphere(tm) · · Score: 3, Insightful

    >How would you propose to remedy this situation? Do you switch to another VT or use a magic sysrq key everytime you become root?

    Also known as the "trusted path" problem.

    Everyone ridiculed the idea of pressing control-alt-delete to log in (and it is pretty funny), but it addressed a real problem. Once you pressed the "secure attention sequence", you had a theoretical guarantee that a phishing program wouldn't have the keyboard focus. Ctrl-Alt-Del was the "magic sysrq key".

    There's another kind of attack, too. A typical sudo configuration only prompts you for a password once then lets you sudo without a password for 5 minutes or so. So imagine a background process that waits for a sudo command to be entered and then issues its own "sudo su" or "sudo sh". Or that skips the waiting and just issues one every five minutes until it gets lucky someday.

    Not that I'm *paranoid* or anything.

  27. Windows NT and privilege separation by Myria · · Score: 2, Insightful

    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

    --
    "Screw Sun, cross-platform will never work. Let's move on and steal the Java language." - Visual J++ Product Manager
    1. Re:Windows NT and privilege separation by oglueck · · Score: 2, Insightful

      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 can read system memory and obtain secure information like cached passwords.
      Load driver: I can install a rootkit.
      Lock pages: I can run the system out of memory and force swapping security related information to disk from where it is easier to intercept.
      Create token: not sure what it does in detail, but sounds scary.

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

    3. Re:Windows NT and privilege separation by LinuxIsRetarded · · Score: 2, Interesting
      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).
      You still need the user name and password to be able to create a token to execute code as another user (look at the documentation for LogonUser). To state that anyone with this privilege "has all rights to the system and you cannot stop them" is incorrect.
    4. Re:Windows NT and privilege separation by argoff · · Score: 2, Insightful

      It is called SELinux 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.

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

  29. 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
  30. Re:Sysrq. by BJH · · Score: 2, Insightful

    It was a joke, dork. Try it and you will indeed see that it does exactly what I said it does... just not in the way you expect it to.

  31. What about SELinux? was Re:A Non-Exploit by Peter+Desnoyers · · Score: 2, Insightful

    rootkit: "a set of software tools intended to conceal running processes, files or system data, thereby helping an intruder to _maintain_ access to a system while avoiding detection." (Wikipedia)

    Adding a binfmt handler (as described in this document) is one way in which a rootkit may be installed. This registration has no SELinux checks, and thus any root process with the capability to install a module (CAP_SYS_MODULE) can register a hook to redirect exec calls.

    However, I don't think fixing this makes much of a difference, as I can think of half a dozen other ways of adding such a hook from a module. (e.g. hooking the exec handler, which is pretty easy even though the address of the syscall table is no longer exported.) I think the main lesson of this paper - which the author does not seem to appreciate - is that CAP_SYS_MODULE is a free pass to do whatever you want, regardless of any other SELinux capabilities, and that there is no way to change this without *major* changes to the linux architecture.