70 points · by S4M · 13y ago · 27 comments
It seems sort of obvious when stated that way, but Ken's demonstration pointed out a few significant details. First, that such an attack didn't have to be large, only two or three changes to the compiler. Second, that such an attack was practical to implement instead of just theoretical. Third, that once a system is compromised, it couldn't even be relied upon to tell you that it was compromised (his follow-up included a third compiler tweak to alter the decompiler), which was probably the scariest point of all.
The type of attack that Ken described is still relevant, even if it's not the compiler that's the target. For example, if you could compromise Windows Update, you could do basically the exact same thing. That's why Windows Update requires crypto signatures.
If I was running a foreign intelligence service (or a sophisticated mafia operation (potato, potato)), I'd target trusted members of the communities around popular open source projects. A high ranking committer to a library that Rails depends on slips in a bit of clever code in a fix for a legitimate problem, and I can compromise a large number of websites.
Or, to put it another way, anybody with $20k can uncover an RCE in Rails without needing to suborn any community member.
What Thompson describes is a whole lot more devious and difficult to detect.
Thompson's scenario is more devious, more difficult to detect, and a lot, lot harder to implements (near impossible, as some of the SO answers point out). But at that time, people didn't generally download millions of lines of code written by perfect strangers and incorporate them into their programs, so that was the only way to pull such a thing off.
I'm sure everyone here is already aware, but the FBI may have already experimented with that:
http://arstechnica.com/information-technology/2010/12/fbi-ac...
I found this comment interesting:
"At some point, aboveboard modifications to the compiler or login program might get to the point where they defeat the backdoor's compiler-recognizer/login-recognizer, and subsequent iterations would lose the backdoor. This is analogous to a random biological mutation granting immunity to certain diseases."
When I read the title I thought maybe Ken Thompson's compiler hack was Go (golang), which he co-created, and I was going to hear a bunch of Python or Node fans talk about why Go is not a threat :)
marked with
From: Ken Thompson <ken@google.com> Date: Wed, Sep 28, 2011 at 6:27 PM Subject: Re: Was compiler from "Reflections" ever built or distributed? To: Ezra Lalonde <ezra@usefuliftrue.com>
edit: I hate having to ask, but instead of downvoting, are there actual reasons this fear is completely unwarranted?
It's a common practice, for example, to x-ray a critical piece of structure to verify it's free of cracks. A similar inspection would generally show if the hidden internals of a printed object conform to the original design.
Auditing the output of a compiler, on the other hand, would be devilishly hard, multiplied by the fact that every program it has ever produced is suspect. Given that this might include your kernel, filesystem, network drivers, etc., it's hard to find an adequate 3D printer parallel. Yes, a bit of crucial structure might be compromised by a pwned printer, but it would probably be relatively easy to spot.