OpenBSD: Smashing The Kernel Stack For Fun And Profit

Submitted by Anonymous
on December 29, 2002 - 10:23am

This article is about recent exposures of many OpenBSD kernel level vulnerabilities
and advances in their exploitation which leads to trusted and robust exploits.

We will focus on 2 recent vulnerabilities in the OpenBSD kernel as our case studies. Out of the these we will mainly concentrate on exploitation of the select() system call buffer overflow. The setitimer() arbitrary memory overwrite vulnerability will be explained in the code section of this
article (as inline comments, so as not to repeat what we have already covered whilst exploring the select() buffer overflow).

This paper should not be viewed as an exploit construction tutorial, my goal is, rather, to explore and demonstrate generic ways to exploit stack overflows and signed/unsigned vulnerabilities in kernel space.

Case studies will be used to demonstrate these techniques, and reusable *BSD "kernel level shellcodes" -- with many cool features! -- will be presented.

cool

Anonymous
on
December 31, 2002 - 3:29pm

secure by default .... ????? ;-)

Nice article !

Of course these problems are

Anonymous
on
January 2, 2003 - 5:52pm

Of course these problems are fixed in 3.2 and 3.1-stable:
errata 015
errata 014

Old news

Anonymous
on
January 2, 2003 - 5:53pm

Of course these problems are fixed in 3.2 and 3.1-stable:
errata 015
errata 014

doest matter

Anonymous
on
January 2, 2003 - 7:42pm

what is interesting is the easy way to beak chroot / securelevel and such things. if ever in the future an exploit is found, we can easily get full control. so we should think twice about security... too many ppl think they are secure because the os manufacturer tellt them and uses such cool-sounding techniques like securelevel ;-)

Eugene

fixed in NetBSD more than 6 years ago

Anonymous
on
January 2, 2003 - 10:04pm

What i find interesting is that this same bug was fixed in NetBSD more than 6 years ago (1996/09/05), after OpenBSD was forked. Well, then how come it was not spotted during The (kernel) Security Audit(tm) OpenBSD people are so proud of?

software verifycation

Anonymous
on
January 2, 2003 - 10:53pm

...isnt possible. thats a fact some ppl seem to ignore. no kernel can be 100% secure, (if it has at least some lines of code) ;-)

so, just one more time one can state "do backups", do "security checks", do "updates" regularily and with some care...

Eugene

Well, it is possible for code

Anonymous
on
January 3, 2003 - 12:57pm

Well, it is possible for code to be correct. I think it is certainly conceivable that a kernel and OS could be 100% secure against the type of attacks described here. The complexity of modern operating systems makes it very difficult to eliminate all such attacks, but that doesn't mean that security breaches are inevitable.

It is possible, but unprovable

Anonymous
on
January 4, 2003 - 3:05am

To prove that:

#include
int main() {
printf("Hello World\n");
}

is correct, you have to check the libraries that the corresponding binary is linked against are also totally safe, in all cases.

A kernel (don't know details of OpenBSD) is
100s of thousands of lines of code. Okay, so a kernel tends to include its own library code, but the point is the interactions of the different chunks of code, more than the code itself.

So you don't just have to check printf (in this example), you have to check that each call of printf() is calling it in the expected manner - for which, you have to document the expected manner, along with every assumption made in the printf() function.
With the really simple, and the really complex, calls, this is difficult. The intermediate are, I suspect, the easier to prove correct (less frequently used, and used in more controlled ways).

Provable correctness

schneelocke
on
January 4, 2003 - 2:45pm

What's more, to prove that even the most simple of programs is correct not only in source, but also in compiled form, you'll also have to verify the compiler you are using - both the source code and the machine code, too, btw, as was shown in 1984 already (I think). The Verifix Project aims to implement provably correct compilers etc., for example.

--
schnee

Even that has a bug

Anonymous
on
January 6, 2003 - 9:12pm

You forgot to return a value in the range of 0-255 from main.

typo

Anonymous
on
January 7, 2003 - 1:25pm

you probably meant:

printf("Hello World\n");

;)

"Hello World(n+1)"

Anonymous
on
January 28, 2003 - 3:09am

"Hello World(n+1)"

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.