Tuesday, March 02, 2004

The most clever hack of all time

Any computer systems using early Unix versions created a password for one of it's developers granting complete access to the system.

Ken Thompson's 1983 Turing Award lecture to the ACM revealed the existence of a back door in early Unix versions that may have qualified as the most fiendishly clever security hack of all time. The C compiler contained code that would recognize when the "login" command was being recompiled and insert some code recognizing a password chosen by Thompson, giving him entry to the system whether or not an account had been created for him.

Normally such a back door could be removed by removing it from the source code for the compiler and recompiling the compiler. But to recompile the compiler, you have to *use* the compiler - so Thompson also arranged that the compiler would *recognize when it was compiling a version of itself*, and insert into the recompiled compiler the code to insert into the recompiled "login" the code to allow Thompson entry - and, of course, the code to recognize itself and do the whole thing again the next time around! And having done this once, he was then able to recompile the compiler from the original sources; the hack perpetuated itself invisibly, leaving the back door in place and active but with no trace in the sources.

The talk that revealed this truly terrific hack was published as ["Reflections on Trusting Trust", "Communications of the ACM 27", 8 (August 1984), pp. 761--763].

Other operating systems and devices also commonly have some default passwords for technicians, commonly called a back door. Historically, back doors have often lurked in systems longer than anyone expected or planned, and a few have become widely known. A worm in 1988 exploited a Unix sendmail back door and was the first major event to make the computer community worry about hackers.

Vernor Vinge uses the concepts of back doors and hacks in layers of programming in operating systems centuries old in his novel A Deepness in the Sky. The same universe is seen 30,000 years late in his A Fire Upon the Deep which was written first and may be read first. Both books are highly recommended - 5 out of 5 stars.

No comments: