This is a read-only archive. Find the latest Linux articles, documentation, and answers at the new Linux.com!

Linux.com

Feature: Linux

Linux kernel development process thwarts subversion attempt

By Robin 'Roblimo' Miller and Joe 'warthawg' Barr on November 06, 2003 (8:00:00 AM)

Share    Print    Comments   

In a stunning verification of Eric S. Raymond's open source adage, "Many eyes make all bugs shallow," an attempt to place malicious "backdoor" code in the Linux kernel 2.6 development tree was detected and rejected almost immediately. The code, if it had become part of the final kernel release, would have allowed a remote user to take control of machines running that Linux kernel version. Unauthorized code snippets, often called Easter Eggs, are common in closed-source programs but are relatively rare in the open source world. It's easy for developers to hide either humorous or malicious code in programs whose inner workings are hidden, but as this Linux kernel incident shows, the open source development process carries a degree of built-in immunity to this kind of problem.
Kerneltrap.org has an excellent blow-by-blow description of the backdoor insertion attempt and how it was detected.

The problem was first noted by Larry McVoy of BitMover, whose BitKeeper products are used heavily by Linus Torvalds and other Linux kernel developers. Only the kernel's public CVS tree was modified. The BitKeeper tree was not, and it was the difference between the two that made the malicious attempt obvious.

In an email to NewsForge this morning, Larry McVoy gave his account of the situation:

As a service to the kernel community, we provide a public machine. That machine hosts BitKeeper, CVS, and Subversion trees of the kernel; it's name is kernel.bkbits.net and it is aliased as cvs.kernel.org and svn.kernel.org. That machine was broken into.

BitMover created a gateway from BitKeeper to CVS for those people who prefer CVS. We run and maintain that gateway on internal BitMover machines and mirror the BK->CVS converted files to kernel.bkbits.net. After the mirroring is complete, just to be sure, we run a little remote comparison script over the BitMover data and the kernel.bkbits.net data. That script runs each night and sends mail if there is a problem. The problem got flagged yesterday, I looked into it, corrected the problem after saving the bad version of the file, and then sent mail to the lkml.

As some of the kernel developers have noted, this was only caught because we're paranoid. BitKeeper users have taught us that if anything can go wrong, it will go wrong, so you need to have safety checks built into your application. We did the same sort of thing with the CVS gateway and it paid off.

It's also worth noting that Linus himself pointed out that it was unlikely that this sort of thing could be done in BitKeeper because of BitKeeper's design.

A few minutes later, this email from Linus Torvalds arrived:
It wasn't really bad at all - except of course in the sense that it's always a nasty surprise that somebody would try something like that. But on a scale from "insignificant" to "very very serious" I'd call the hack attempt "interesting".

Inserting a back-door into a project CVS tree could be very serious in theory, and in that sense everything was done "right" - the code was made to look innocuous, and the CVS history looked fairly sane. Successfully doing something like that into the core CVS tree would quite potentially be very hard to detect, and two lines of code out of five million is obviously not a sore thumb that sticks out.

But the thing is, unlike a lot of other projects, Linux kernel development isn't actually done using a central CVS tree _at_all_. That CVS-tree was just an automatically generated read-only export for people who want to use CVS, and the back-door was never in any "real" tree in that sense. The real trees aren't public, and never have been.

So no damage done, and the thing was noticed when the CVS tree was re-generated. We're certainly taking it seriously in the sense that I think it's serious that somebody tried to insert a back-door, but it didn't matter in a _technical_ sense, if you see what I mean..

We're talking with the people whose machine was apparently used to try to do the thing, but it was a university machine so in a fairly relaxed environment. It's been cordoned off and they'll be taking a look at it.

The problem of coders inserting (or attempting to insert) malicious features in operating systems, compilers, and other low-level programs is far from new. Unix creator Ken Thompson demonstrated the possibility of inserting a Trojan into the C language compiler way back in 1984 in an article titled Reflections on Trusting Trust that contained these words:
You can't trust code that you did not totally create yourself. (Especially code from companies that employ people like me.) No amount of source-level verification or scrutiny will protect you from using untrusted code. In demonstrating the possibility of this kind of attack, I picked on the C compiler. I could have picked on any program-handling program such as an assembler, a loader, or even hardware microcode. As the level of program gets lower, these bugs will be harder and harder to detect. A well installed microcode bug will be almost impossible to detect.
In other words, no matter how secure your code development process may be, at some point, there must be some level of trust. While Thompson's statement, "No amount of source-level verification or scrutiny will protect you from using untrusted code," may have some truth to it, right now it's the best protection we have, especially when human code-vetting efforts are augmented by audits and code comparisons performed by software we have now, but didn't exist back in the 80s.

In its latest security test -- which is probably not what the malicious code-inserter wanted his or her efforts to become -- the Linux development process passed with flying colors and will use the experience to become even more attack-resistant in the future.

Could your code development process -- proprietary or open source -- could pass a similar test?

Share    Print    Comments   

Comments

on Linux kernel development process thwarts subversion attempt

Note: Comments are owned by the poster. We are not responsible for their content.

First attempt, or first detection?

Posted by: Anonymous Coward on November 07, 2003 04:16 AM
Distros ought to watch their ftp sites as well. Someone has tried to subvert Linux wholesale, but they might go after distros selectively, also.

Whoever this audacious criminal is, he or she ought to be thanked for providing a wake-up call... before getting kicked in the ass.

#

Re:First attempt, or first detection?

Posted by: Anonymous Coward on November 07, 2003 01:16 PM
That's a good point. Also, it should be noted that Linus considers the proprietary Bitkeeper to be more secure architecture than the open source CVS - not because it's proprietary, but because it was architected differently.

I'm wary of spinning news like this to be triumphs for open source or whatnot. It reminds me of some of Microsoft's spinning and the stupid attempts to compare security based on differences in patch counts. Let's use these incidents to try to improve the process and move on.

#

Re:First attempt, or first detection?

Posted by: Anonymous Coward on November 11, 2003 09:00 PM
Don't forget, though. iirc BitKeeper is "open source", just not Open Source.

Cheers,
Wol

#

re:

Posted by: nexex on November 07, 2003 05:43 AM
I don't think most people think of easter eggs as, "Unauthorized code snippets." I have always thought of them as more like this definition from <A HREF="http://catb.org/~esr/jargon/" TITLE="catb.org">The Jargon File</a catb.org>:

1. A message hidden in the object code of
a program as a joke, intended to be found by persons disassembling or
browsing the code.


2. A message, graphic, or sound effect emitted by a
program (or, on a PC, the BIOS ROM) in response to some undocumented set
of commands or keystrokes, intended as a joke or to display program
credits. One well-known early Easter egg found in a couple of OSes
caused them to respond to the command `make love' with `not war?'. Many
personal computers have much more elaborate eggs hidden in ROM,
including lists of the developers' names, political exhortations,
snatches of music, and (in one case) graphics images of the entire
development team.

#

"many eyes" has nothing to do with this story

Posted by: Anonymous Coward on November 07, 2003 06:09 AM
The conclusion drawn in the opening paragraph is erroneous and misleading. Quoting the notion that "Many eyes make all bugs shallow" leads one to believe that the problem was detected by the development community at large (the many eyes). In this case it wasn't.

#

Re:"many eyes" has nothing to do with this story

Posted by: Anonymous Coward on November 07, 2003 09:40 AM
It does apply because one of the many eyes caught the problem. That quote doesn't mean that all of the many eyes have to catch the problem. In a less open enviroment fewer people would have a chance to have caught such an attempt.

Of course being the paranoid sort I'd be looking for other backdoor attempts. Putting an easily identifiable intrusion to draw attention from more subtle intrusions is always a working trick. Break down the front door while you slide in the basement window.

#

Re:"many eyes" has nothing to do with this story

Posted by: SarsSmarz on November 07, 2003 10:54 AM
I was thinking that too, for a while. It was really the paranoid engineering that caught this. The telling quote was "it would be difficult to penetrate, by design". That says what I've always believed, that fundamental design determines security (and we all know what isn't well designed!)

But then I thought, why are these guys so paranoid? Why is the fundamental design so good? It's because they are an open shop on the Internet, where any loonie can waltz right in. People in a closed shop develop a certain laziness, and bureaucratic inbreeding.

#

Aha!

Posted by: SarsSmarz on November 07, 2003 07:39 AM
A last-minute attempt before a certain key trial. The evil ones can then say: "Look! We have that exact same code in all our proprietary software! Obviously copied!"<nobr> <wbr></nobr>:)

#

Fatware

Posted by: Danilo Câmara on November 08, 2003 08:54 AM
The marketing teams says: "Ok, you made a new version, but if you don't inflate enough its size, the costumers wont pay our new price". Then the programmers spend their time with Easter Eggs.

#

This story has been archived. Comments can no longer be posted.



 
Tableless layout Validate XHTML 1.0 Strict Validate CSS Powered by Xaraya