login
Header Space

 
 

Linux: Auditing Kernel Code

January 18, 2005 - 10:26am
Submitted by Jeremy on January 18, 2005 - 10:26am.
Linux news

Following the recent string of security-related kernel issues [story], the question was raised on the lkml what formal effort is being made to audit new patches. Long time Linux kernel guru Alan Cox [interview] noted two trends that he considers positive. First, that "tools like coverity and sparse are significantly increasing the number of flaws found", often finding flaws that have been in the code a long time. Second, Alan noted that security holes tend to come in bursts all related to the same type of problem. He explains, "if you plot things like 'buffer overflow' 'structure passed to user space not cleaned' 'maths overflow check error' against time you'll see they show definite patterns with spikes decaying at different rates towards zero." Alan added, "there are also people other than Linus who read every single changeset. I do for one."

Theodore Ts'o went on to point out that "most of the kernel vulernabilities that have been found are not remote execution vulernabilities, but privilege escalation bugs, or data leakage bugs (technically a security vulnerability but most of the time what gets leaked is truly boring) or denial of service bugs (yawn; there are enough ways of carrying out DOS attacks that don't represent kernel bugs)." He also added, "it's important to take statistical analysis with a huge grain of salt sometimes; but an increase [in] bugs found doesn't mean that the product is getting buggier; just that more bugs are happenning to get fixed."


From: John Richard Moser [email blocked]
To:  linux-kernel
Subject: Linux Kernel Audit Project?
Date: 	Mon, 17 Jan 2005 02:17:37 -0500

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Is there an official Linux Kernel Audit Project to actively and
aggressively security audit all patches going into the Linux Kernel, or
do they just get a cursory scan for bugs and obvious screwups?
- --
All content of all messages exchanged herein are left in the
Public Domain, unless otherwise explicitly stated.

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.0 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iD8DBQFB62aRhDd4aOud5P8RAnaYAJ9Erare1zWYUTJhdQlyrVaHZxtL5wCfWCCy
Eft5UL62EbiWHjivvbjaSmg=
=hies
-----END PGP SIGNATURE-----


From: John Richard Moser [email blocked] Subject: Re: Linux Kernel Audit Project? Date: Mon, 17 Jan 2005 02:40:06 -0500 -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On the same line, I've been graphing Ubuntu Linux Security Notices for a while. I've noticed that in the last 5, the number of kernel-related vulnerabilities has doubled (3 more). This disturbs me. I categorized the vulns I'd found into fairly arbitrary categories; upon looking at a graph, I noticed that some bars were short and others were unbelievably long (duh). Reordering things, I came up with what looks suspiciously like a standard normal distribution. Kernel vulnerabilities appear to be falling within the first two standard distributions now, at a glance. 95% of vulnerabilities land here; 8.3% (kernel vulns excluding buffer overflows) fall within this range, I'm guessing about . . . well, 8.3% chance. Total I have 10% of the vulnerabilities graphed as being from the kernel. Every time a new kernel vulnerability is made (whether I see it or not), that bar moves towards the center. Every time a userspace vulnerability is made, that bar moves outwards. I can only graph what I can see, but I'm very worried; if that bar keeps moving the way it's going, faster than US vulns, then the probability of KS exploits is probably genuinely increasing in probability. Kernel space exploits can never be sanely protected against. Even if you can catch and kill them, you cause a system crash (major DoS), which is hardly a good solution. At least in userspace when SSP or PaX kills something, the user either restarts it, or init is running it as a daemon and just auto-restarts it immediately. And at least it only causes a small burp. SELinux won't help either. If you exploit the kernel, you're in. Sometimes this is root access and you get lucky because SE doesn't know who you think you want to be; other times this is arbitrary code execution from inside the kernel and it doesn't matter who the kernel thinks you are, you're in control. Oh well, at least they still get fixed when they're seen. John Richard Moser wrote: > Is there an official Linux Kernel Audit Project to actively and > aggressively security audit all patches going into the Linux Kernel, or > do they just get a cursory scan for bugs and obvious screwups? - -- All content of all messages exchanged herein are left in the Public Domain, unless otherwise explicitly stated. -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.0 (GNU/Linux) Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org iD8DBQFB62vUhDd4aOud5P8RAlNDAJ91Om3VdcNXpHJ/Yamm9cG3JyYMugCfaSzb Ngq2bR/PtAC+q0wASg5frng= =xsfz -----END PGP SIGNATURE-----
From: Alan Cox [email blocked] Subject: Re: Linux Kernel Audit Project? Date: Mon, 17 Jan 2005 12:23:35 +0000 On Llu, 2005-01-17 at 07:40, John Richard Moser wrote: > On the same line, I've been graphing Ubuntu Linux Security Notices for a > while. I've noticed that in the last 5, the number of kernel-related > vulnerabilities has doubled (3 more). This disturbs me. I've been monitoring the kernel security stuff for a long time too. There are several obvious trends and I think most are positive - Tools like coverity and sparse are significantly increasing the number of flaws found. In particular they are turning up long time flaws in code, but they also mean new flaws of that type are being found. People aren't really turning these tools onto user space - yet - - We get bursts of holes of a given type. If you plot things like "buffer overflow" "structure passed to user space not cleaned" "maths overflow check error" against time you'll see they show definite patterns with spikes decaying at different rates towards zero. There are also people other than Linus who read every single changeset. I do for one. Alan
From: Theodore Ts'o [email blocked] Subject: Re: Linux Kernel Audit Project? Date: Mon, 17 Jan 2005 13:16:52 -0500 On Mon, Jan 17, 2005 at 12:23:35PM +0000, Alan Cox wrote: > > - Tools like coverity and sparse are significantly increasing the number > of flaws found. In particular they are turning up long time flaws in > code, but they also mean new flaws of that type are being found. People > aren't really turning these tools onto user space - yet - > Also, most of the kernel vulernabilities that have been found are not remote execution vulernabilities, but privilege escalation bugs, or data leakage bugs (technically a security vulnerability but most of the time what gets leaked is truly boring) or denial of service bugs (yawn; there are enough ways of carrying out DOS attacks that don't represent kernel bugs). The percentage of vulnerabilities which are actually of the "browse a certain web page with Internet Exploder and you are 0wned" are far fewer with kernel bugs, by their very nature. That's not to say that such bugs shouldn't be fixed, but that unless you're some hack from the Yankee Group getting paid by Microsoft, there's no point to ring the alarm bells. Finally, it's important to take statistical analysis with a huge grain of salt sometimes; but an increase it bugs found doesn't mean that the product is getting buggier; just that more bugs are happenning to get fixed. You need to do a lot more analysis to discover if this is due to code analysis tools finding bugs in old code, or bugs being turned up in newly modified code, etc. - Ted



Related Links:

Pretty graphs anyone?

January 18, 2005 - 11:46am

I promise I'm not a manger, but I'm still a sucker for pretty graphs. Anyone know where a good vulnerabilities/bugs over time graph like Alan alluded to could be found?

What i'd like to see

January 18, 2005 - 12:33pm
Anonymous (not verified)

What i'd like to see is a graph containing how old the code that had the kernel vulnerability was. This would (somewhat) show how often the vulnerabilities are found in old versus new code.

People aren't really turning

January 18, 2005 - 12:10pm
jdunn14 (not verified)

People aren't really turning these tools onto user space - yet -

Shoot, I'd be happy to see people write code that passes precursory checks like compiling without wads of warnings, let alone using some kind of a correctness checking package. On a more serious note, how long until pretty basic correctness checking is just included in the build system? Preprocess, verify, compile, link.... Might be nice, and if generally on by default could help save us programmers from ourselves.

like openbsd ?

January 18, 2005 - 1:33pm
Anonymous (not verified)

we probably have to learn from the way OpenBSD works. Why not having the same process to audit code into the kernel ?

Somehow I doubt that Theo de

January 18, 2005 - 11:36pm

Somehow I doubt that Theo de Raadt would come work at OSDL. ;-)

Weenie

January 19, 2005 - 1:34am

I was at a LUG today and someone described Theo as a "weenie." The conversation went like this:

Heh. Ever talk to Theo de Raadt?
Hah! He's a weenie!
. . . *snicker!*

Kinda funny to see someone get described as a "weenie" in anything other than Freakazoid. . . DO NOT SAY THE WEENIE WORD!

-1 overrated

January 19, 2005 - 11:13am
Anonymous (not verified)

What do you want to learn from OpenBSD. Marketing? Flaming? Trolling? Lying?

Theo is an ass. The statement '1 remote hole in default installation for X years' is both overrated and untrue. OpenBSD has some things right, but its far from perfect and i wouldn't say the Holy Grail of security. For starters it doesn't even have capabilities, its cryptographic disk driver is insecure (NetBSD and Linux have better implementations). I could go on, oh well..

This is dismally depressing

January 18, 2005 - 5:16pm

There's too many kernel vulnerabilities popping up these days
Eh they're mostly privilege escallation and DoS and info leaks so it's no big deal.

Is it just me, or is this world starting to turn backwards? Privilege escallation is not remote code execution; but remote code execution is privilege escallation. Accessing an environment with privileges you don't have is privilege escallation. it means you can steal or destroy other peoples' files or, in the worst case, parts or all of the system.

A kernel level DoS is nasty. It either breaks random programs, starts breaking future programs, makes the system start hickuping and possibly corrupting things (maybe trash a filesystem), or in the most likely case causes a kernel halt or panic and thus a complete system crash. That last case is a lot different than "Apache crashed and start-stop-daemon restarted it." Everything everyone was doing just went down, and now we have to wait for a system reboot and possibly deal with filesystem corruption.

And I'm not the type to take an "information leak" of boring data as useless. Maybe the bug can be exploited in innovative ways to leak useful data; or maybe the boring data isn't really so boring. To some, the contents of /dev/random can be very interesting.

My little graph wasn't meant to be gold; but I spotted a potential trend that I want to clip off. Apparently though everyone seems to think that kernel level bugs are less dangerous than userspace bugs and so we shouldn't care.

Whatever.

At least in userspace when SS

January 18, 2005 - 5:36pm
Anonymous (not verified)

At least in userspace when SSP or PaX kills
something, the user either restarts it, or init is running it as a
daemon and just auto-restarts it immediately.

auto-restart? how?

Init watches things

January 18, 2005 - 5:58pm

When the process exits, it gives a return code. The process that called fork() and execve() to create that process can be informed and restart it.

Try killing getty and watch what happens. Init autorestarts it. The same happens if you kill X when using a display manager--the display manager restarts it. If you kill the DM, init usually restarts it. Too many kills in too little time and init decides its broken and stops, but eh.

yeah, but "init as a daemon"?

January 19, 2005 - 7:57pm
Anonymous (not verified)

yeah, but "init as a daemon"?

I would guess it just means s

January 20, 2005 - 2:42pm

I would guess it just means start the daemon from init in inittab, as opposed to starting it via SysV shell scripts.

Re: At least in userspace when SS

January 19, 2005 - 9:14am
Anonymous (not verified)

The process can even auto-restart it self through a signal handler.

SIGKILL

January 19, 2005 - 1:20pm

Tell me again how to register a signal handler for signal 9?

Linux Kernel Audit

January 19, 2005 - 12:38pm
Anonymous (not verified)

There is the kernel janitor project . the janitors have already squased a lot of bugs like memory leaks, wrong return codes etc.
Of cause if a vulnerability appear they look if they can find it on other places and try to fix it. that includes unsave procedures used by some programmers also.

re,
walter

see: http://www.kerneljanitors.org/

Comment viewing options

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