Clever attack exploits fully-patched Linux kernel

Ellipse

The Living Force
FOTCM Member
The Register
Dan Goodin
17th July 2009 22:32 GMT

---
'NULL pointer' bug plagues even super max versions.

A recently published attack exploiting newer versions of the Linux kernel is getting plenty of notice because it works even when security enhancements are running and the bug is virtually impossible to detect in source code reviews.

The exploit code was released Friday by Brad Spengler of grsecurity, a developer of applications that enhance the security of the open-source OS. While it targets Linux versions that have yet to be adopted by most vendors, the bug has captured the attention of security researchers, who say it exposes overlooked weaknesses.

Linux developers "tried to protect against it and what this exploit shows is that even with all the protections turned to super max, it's still possible for an attacker to figure out ways around this system," said Bas Alberts, senior security researcher at Immunity. "The interesting angle here is the actual thing that made it exploitable, the whole class of vulnerabilities, which is a very serious thing."

The vulnerability is located in several parts of Linux, including one that implements functions known as net/tun. Although the code correctly checks to make sure the tun variable doesn't point to NULL, the compiler removes the lines responsible for that inspection during optimization routines. The result: When the variable points to zero, the kernel tries to access forbidden pieces of memory, leading to a compromise of the box running the OS.

The "NULL pointer dereference" bug has been confirmed in versions 2.6.30 and 2.6.30.1 of the Linux kernel, which Spengler said has been incorporated into only one vendor build: version 5 of Red Hat Enterprise Linux that's used in test environments. The exploit works only when a security extension knows as SELinux, or Security-Enhanced Linux, is enabled. Conversely, it also works when audio software known as PulseAudio is installed.

An exploitation scenario would most likely involve the attack being used to escalate user privileges, when combined with the exploitation of another component - say, a PHP application. By itself, Spengler's exploit does not work remotely.

With all the hoops to jump through, the exploit requires a fair amount of effort to be successful. Still, Spengler said it took him less than four hours to write a fully weaponized exploit that works on 32- and 64-bit versions of Linux, including the build offered by Red Hat. He told The Register he published the exploit after it became clear Linus Torvalds and other developers responsible for the Linux kernel didn't regard the bug as a security risk.

"By the time I wrote the exploit, there was a fix floating around, but it didn't look like it was going to be going into any of the stable releases," he said. "It was just a trivial 'oops' instead of something that could give you arbitrary code execution in the kernel."

Comments that accompany Spengler's exploit code go on to detail statements Torvalds and other developers are said to have made in group emails discussing the bug.

"That does not look like a kernel problem to me at all," Torvalds is quoted as saying in one message. "He's running a setuid program that allows the user to specify its own modules. And then you people are surprised he gets local root?"

On that front, at least one security researcher agreed with the Linux team.

"Setuid is well-known as a chronic security hole," Rob Graham, CEO of Errata Security wrote in an email. "Torvalds is right, it's not a kernel issue, but it is a design 'flaw' that is inherited from Unix. There is no easy solution to the problem, though, so it's going to be with us for many years to come."

The larger point, Spengler said, is that the Linux developers are putting users at risk by failing to clearly disclose when security vulnerabilities have been discovered.

"Why is it that whenever there is an exploitable vulnerability in Linux, it's described as a denial of service?" he said. "It kind of makes the vendors think the security is better than it actually is."

Wherever the fault may lie, the potential damage is very real.

"It's not going to light the world on fire, but it is a very subtle bug and solid exploit," said Ed Skoudis, founder and senior security consultant for InGuardians. "The real story here is how subtle it is, and that the compiler itself introduced it during code optimization."

So far, Torvalds and company have yet to respond to the disclosure. We'll be sure to update this story if they do. ®

http://www.theregister.co.uk/2009/07/17/linux_kernel_exploit/
 
There are some people within the Linux community that
refuses to install SELinux and Pulse-Audio, because not
only are they painful to maintain, but simply does not work
well, and they do not trust SELinux, which was created by
Stephan Smalley of the NSA, go figure!

I have reviewed the page and the source code provided.
It all depends if these two applications mentioned above
are installed and that the compiler does not optimize
away the NULL dereference code check.

The other problem is, that most people depend on the
distro's software updater and have no idea if their kernel
is exploitable...

[edit: 10:23AM PST]

As for SELinux, the problem (so claims a SELinux maintainer) is
that this exploit could have been prevented had not the policy file
responsible for preventing this exploit had not contained a bug...
and another claims that the bug is exploitable whether SELinux
is used or not, but in any case, this goes to show that security
can be very easily compromised, anonymously and quickly due
to human "error", intended or not. Or so I think.

As expected, the RedHat Security Team was on top of this issue,
(see link below) but do note that this is for the 2.6.30/31 kernel on
Redhat 5, but what about YOUR distro's kernel older or newer?

http://blog.namei.org/2009/07/18/a-brief-note-on-the-2630-kernel-null-pointer-vulnerability/

Here is another explanation:
http://lwn.net/Articles/341773/rss

Perhaps one should check if their system kernel is compromised to
be sure? Have a read in the above link about some suggested checks
and perhaps even download and install the exploit "test" provided in
the theregister.co.uk news link to see if your kernel is compromised?

[Edit: 12:35PM]

Whew, from this link [http://lwn.net/Articles/341773/rss]
there is this:
========================================

>> Linux 2.6.30 exploit posted
Posted Jul 18, 2009 13:21 UTC (Sat) by jengelh (subscriber, #33263) [Link]
Does this affect immediate versions before 2.6.30 too? E.g. 2.6.27–2.6.29.

>> Linux 2.6.30 exploit posted
Posted Jul 18, 2009 17:49 UTC (Sat) by spender (subscriber, #23067) [Link]
No, as mentioned in the exploit the code that introduced the vulnerability was added in the 2.6.30 kernel. Previous kernels aren't vulnerable to this particular bug (but may be vulnerable to other bugs that not having the gcc optimization turned off made exploitable).

Additionally, the SELinux vulnerability likely affects all of your current distributions that use SELinux and is currently unfixed, so you're susceptible to exploitation of any existing null ptr dereference vulnerability.

-Brad
========================================

So, it appears the exploit is related only to the specific kernel
versions: 2.6.30/1.

As for Fedora, they are still way under that kernel version and
is not affected except that they are being diligent and will try to
update the SELinux policies for Fedora versions still being supported.
Rahul Sundaram (Fedora Maintainer) has been on top of things
and I have been watching! I can't say anything about the other
Linux distros out there as I don't use them (much) ;)

Dan
 
Thx dant for those precisions.

SELinux is useful to add rights management capacity lacking to Linux. Do you know if other such products exist ?


Talking of Linux make me wonder if Linus Torvald had been inspired by 6D or something like that...
 
Ellipse said:
Thx dant for those precisions.
You are welcome!

Ellipse said:
SELinux is useful to add rights management capacity lacking to Linux.
Do you know if other such products exist ?
I am not sure I understand your question...

(1) SELinux uses policy files and writes security-context
into special areas on the disk, or so I think. It is very
"fine-grained" when it comes to security context, but
it is not "perfect" in all cases, AFAIK and it is always in
flux, ever-changing/evolving. :)

(2) Are you asking if SELinux is supported by other Linux distros?

I would venture to say: "Yes", however, are all distros by default
pre-installed with SELinux? Some are and some are not.

I do know that Fedora 6 -> XX have SELinux installed by default,
but Fedora is not that easy for the average user, as compared to, say
Ubuntu, which is what I would recommend to those who are not very
computer literate, or so I think.

(3) Are there other products beside SELinux that do the same or simular
security functions? I don't know, I haven't checked, and even if there
are, why spend the money when many people seems to be using SELinux
daily?

So far, SELinux seems to be ok for the experienced, but could be quite a
steep learning curve for those who are not so familiar with it.

There are copious online docs/support that explains how to install, configure,
etc. SELinux, and it could be easy or hard depending on one's experience and
knowledge.

Ellipse said:
Talking of Linux make me wonder if Linus Torvald had been
inspired by 6D or something like that...
I don't know. Maybe you will need to ask Mr. Torvalds
himself for that answer ;)

Dan
 
Ellipse said:
Talking of Linux make me wonder if Linus Torvald had been inspired by 6D or something like that...
Whatever it was, the circumstances were quite important: As Linus himself once said in an interview, if 386BSD (another free *nix implementation, the first both free and open BSD distro for the PC) had been released (it was in development) at the time (instead of when Linux had already become what Linus considered usable), then Linux probably wouldn't have happened - and perhaps Linus would've become just yet another BSD developer instead, some form of BSD taking the role now held by Linux, instead of - as now, the BSDs forming several comparatively smaller, more specialized projects. Anyhow, much of the inspiration came from the Unix legacy - 70s groundbreaking OS work (since then, relatively few things have happened in terms of the major concepts) - though who knows what guided Linus to begin his project at just the right time for it to take off (and without it, the adverse effects on BSD development from the AT&T lawsuit would have left the state of free/open *nix quite stale for a few years). Probably, it was (as with Noah per C's) a case of doing what was interesting only for it to become unexpectedly handy.
 
I am not sure I understand your question...
Point (3) was the answer.
Thx Dant.

Csayeursost
Probably, it was (as with Noah per C's) a case of doing what was interesting only for it to become unexpectedly handy.
Yes but to share and distribute freely your work was not a so common attitude when Linux appear (1991). Seem STO attitude won some points with the free software movement.
 
Ellipse said:
Seem STO attitude won some points with the free software movement.

An interesting watch is Revolution OS (http://www.revolution-os.com) which explores the first stages of the battle between the Free Software Movement (which seems to be an STO approach) and the proprietary software company giants (definitely STS approach).
 
Back
Top Bottom