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.
1 meg PDF? (Score:5, Funny)
oh wait it's already gone
Re: (Score:2, Funny)
And? (Score:5, Informative)
And? Hol-e terror. (Score:3, Funny)
If I found Goatse.cx in Linux? I'd panic too.
Re: (Score:2, Informative)
Probably none. (Score:5, Informative)
Most Windows/IE attacks don't require you to even have local access, let alone root.
Re: (Score:2, Informative)
Re: (Score:3, Informative)
sudo - unclear on the concept (Score:2)
lemme guess, you run "sudo -u root su -"?
Re: (Score:2)
1. sudo passwd # set a root password
2. sudo visudo # add "rootpw" to the "Defaults" line
PS: "sudo -s" is enough to get a root shell.
Re:Probably none. (Score:5, Informative)
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.
Re:Probably none. (Score:5, Insightful)
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 --
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?
Re: (Score:2)
But remember, secure systems are a pain in the arse to use.
Re: (Score:2)
Re:Probably none. (Score:5, Funny)
Phew, I'm glad it's not just impossible. That might have been risky.
Re: (Score:3, Informative)
On most modern systems, it is also impossible, because the actual password hashes have been moved to
If you are root, you can still attempt to brute-force them -- which would be time-consuming and almost never has a point.
Re: (Score:2)
Re: (Score:3, Informative)
Old Navy Joke (I think) (Score:2)
Attributed to the Seabees - the Navy construction guys - usually civil engineers.
That's an insightful question (Score:4, Insightful)
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.
Re: (Score:2)
Re: (Score:2)
Re: (Score:2)
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)
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.
Re: (Score:2)
Re: (Score:2)
If it's an "exploit" resulting from inserting a custom module, then I doubt anyone will change anything, because this is not a vulnerability.
Re: (Score:2)
It took me over an hour to download, so for the next day or so (or if the writers insist I take it down), I'll be hosting this file at: http://effigies.ath.cx:85/~chris/binfmt-en.pdf [effigies.ath.cx]
Re:And? (Score:4, Insightful)
Re: (Score:2)
The original poster was correct, this isn't news. It is trivial to install a rootkit with root access. Do this in us
And, Who do You Trust? (Score:2)
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
Re: (Score:2)
Re: (Score:3, Insightful)
The title reads "Weakness In Linux Kernel's Binary Format", quite accurate if you ask me.
Re:What about other ELF systems? (Score:5, Informative)
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.
Re:What about other ELF systems? (Score:5, Informative)
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.
Too bad you have to be root. (Score:5, Funny)
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 ^_^
Re: (Score:2)
I think they removed it from the normal windows distro back in win2K though.
-nB
Re: (Score:2)
Re:Too bad you have to be root. (Score:5, Informative)
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)
Re:Too bad you have to be root. (Score:4, Informative)
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.
Re: (Score:2)
Actually, there is a reason for this. And it's not just limitations of the filesystem. It's that it actually was not uncommon for Windows users to "accidentally" delete their Windows directory (sometimes thinking they're clever for freeing up space for other things). Since there is no filesystem security on Windows by default, you ended up deleting many (but not all) DLLs ... and next time you tried to load something, crash. (Had that happen to my dad with Win3.1. Luckily, Win 3.1 was easy enough to re
Re: (Score:2)
Now if you could insert modules as a non uid=0 user then that'd be something...
Tom
Re: (Score:2)
Re: (Score:2)
found that a "simple" chown -R from the root was quite
sufficient to bork a system.
Re: (Score:2)
Re: (Score:2)
Re: (Score:2)
Re: (Score:2)
(Formatting
This is so not serious (Score:5, Informative)
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.
Re: (Score:2)
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.
Re: (Score:2)
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.
Re: (Score:2)
Re: (Score:2)
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)
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
Re: (Score:2)
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.
This is not limited to executable handlers. (Score:2)
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!
Re: (Score:2)
Name one.
I can name a user friendly distro that has SELinux enabled by default: Fedora.
Re: (Score:2)
Re: (Score:3, 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.
If that's the goal, Average Joe can fire up Ubuntu, right now. Ubuntu never t
Re: (Score:2)
Re:This is so not serious (Score:4, Interesting)
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.
Re:This is so not serious (Score:4, Insightful)
No, it's not, and you're an idiot for suggesting it. I really hope you're joking.
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:
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
Problem: Sometimes you want to limit root. (Score:4, Interesting)
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
However, I'd like to actually read the PDF and find out if I'm right about this. Damn Slashdotting.
Re: (Score:3, Informative)
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'.
Not the only one today (Score:4, Interesting)
Mirror (Score:5, Informative)
simply (Score:5, Funny)
As opposed to difficultly linked lists?
Re:simply (Score:5, Informative)
Simply? (Score:4)
Weakness In Linux Kernel's Binary Format (Score:5, Funny)
You'd have thought they'd have caught this sooner. It's not like it's that long of a list to exhaustively test.
Re: (Score:2)
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)
Re: (Score:3, Funny)
I've always said if you want a secure kernal, you code it in analog format.
Re: (Score:2)
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.
Re: (Score:2)
Re: (Score:2)
I think I even saw a... (Score:2)
Nice catch! (Score:3, Insightful)
Disable modules (Score:2, Interesting)
Pointless (Score:5, Insightful)
If someone is loading kernel modules on your machine, you've already been owned.
How come... (Score:2)
Re: (Score:2)
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]:
Securing a System from "Root". . . (Score:3, Interesting)
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?
Have modpoints, can't find an intelligent comment (Score:3, Informative)
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
Do I care? Not really (Score:2, Insightful)
Why "exploit" if you're already in? (Score:3, Insightful)
All kernels? (Score:2)
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
Nothing to see here, move along! (Score:5, Insightful)
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!
Re: (Score:3, Informative)
Windows NT and privilege separation (Score:3, Insightful)
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)
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
Re:Windows NT and privilege separation (Score:4, Informative)
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)
Re: (Score:2)
Re: (Score:2)
Re: (Score:2)
Re: (Score:3, Interesting)
Re: (Score:2)
Re: (Score:2)
If kmem isn't even available, there are other ways to get to kernel memory, they just aren't as easy.
Re: (Score:2)