Comp.lang.lisp 有一段時間挺混亂的. 一個Lisp討論區,
最新的 post 卻都不是什麼lisp
討論. 有人在批評 C 語言, 有人在抱 怨 UNIX 的指令太難記, 當然有人批評就有人反駁. 一些老讀者 終於看不下去了,
不得不大聲疾呼要回歸這個討論區的本來面貌, 但看大家熱烈的興頭, 要打完這許多場筆戰還有得等的呢.
就在這時候, 有人又想起了 Ken Thomposon 在他的圖寧獎演講中 所提及, 放在C compiler 中的那個特洛伊木馬了.
我曾在資訊人 園地 『 Compiling a Compiler 』 中談到這個故事. 『特洛伊 木馬』, 指的是外表看起來無害,
但內裡暗藏玄機的程式. 據 Ken 所說, 他在 C compiler (事實上應該是 pre-processor)
中放了一個後門, 如果compiler發現它所處理的程式是 login 的 原始程式, 它就會在裡面加入一段程式碼, 讓 Ken
Thomposon 可以 login 進去. 由於 UNIX 得用 C compiler 來編譯, 這意味 著 Ken 將可以進入任何裝
UNIX 的電腦; 那麼, 我換個乾淨的 compiler 總可以吧? 但新 compiler 的原始碼也得由舊compiler
來編譯, 而為了讓這個特洛伊木馬能流傳久遠, 如果舊 com- piler 發現自己正處理的的是另一個 (正常的) C compiler,
它 就會把上面那段『如果是login, 就加入一段...』 的那段程式碼, 給插到這個compiler裡面去.
就在 comp.lang.lisp 正為了一些 UNIX / C 的問題吵得興高采
烈之際, 大家又回想起了這個老故事. 於是有人問了, 真有這麼
回事嗎? 抑或 Ken Thomposon 只是說說而已? 如果他真做了這麼
巧妙的一個特洛伊木馬 , 現在他已經可以進入世界上任何一台
UNIX 工作站, 如入無人之境了. 有人說, 這不過是 『一個可能
發生的假想』而已. 畢竟要寫出這樣的一個compiler, 可需要很
高的技術水準呢. 也有人說, 他當然把這個駭人聽聞的 compiler
給寫出來了, 只是沒有流出去罷了. 有人引了Ken的一段話, "
The actual bug I planted in the compiler would match
code in the UNIX 'login' command", 看到沒有, 『actual』
唷, 當然是真有其事啦. 更有人言之鑿鑿地保證, Ken 在一次
UNIX user group 集會中曾暗示著, 他已經把這個特洛伊木馬給
送出去啦!
終於有人在翻出Ken Thomposon的 email address後, 親自去向他
本人求證了. Ken 的回信說, 他並沒有看comp.lang.lisp 的習慣.
聽說了這個消息後, 才上去看了看相關的討論. 然而, 直接在
newsgroup 裡頭回話似乎會引起更多的誤會, 於是他就不親自出
面囉!
原來, Ken 在做出了這個特洛伊木馬之後, 便半哄半騙地讓 Unix
Support Group 裝了他們的compiler. 大約一個月後, login程式
就如同預期地被感染了. 然而Unix Support Group 也不是等閒之
輩. 不久之後, 有人發現了, 這個C pre-processor 的 symbol
table 怎麼怪怪的? 於是他們直接研究 compiler 產生的目的碼,
看看到底 Ken Thomposon 在搞什麼鬼. 最後 Ken 的計謀就曝光
啦.
Unix Support Group 也不急著找 Ken 算帳, 倒是用很妙的方法
解決了這個特洛伊木馬. 能直接產生目的碼的 compiler 大都有
一個 -S 的選項, 亦即要 compiler 產生組合語言檔, 而非目的
碼. 產生組合語言檔的一個理由是讓人來讀, 可以除錯用. 因此
為了避免被發現, 這個特洛伊木馬在用 -S 編譯的時候是不做壞
事的. Unix Support Group 便把所有的程式用 -S 選項編譯一次,
再另外用 assembler 產生目的檔. 於是, 這個特洛伊木馬就消失
啦!
Ken 說, 這個特洛伊木馬僅在他們之間被當作一個惡作劇的小把
戲, 從來沒有流出去過. 得到這個答案的 Jay R. Ashworth 很
得意地把這封 email 貼了出來, 並且告訴大家, 最好把這封信存
起來, 以備下次又有人說起這件懸案時, 就可以拿出來現寶囉!
以下是 Jay R. Ashworth 貼的原文. 檔頭和引言已經刪掉了.
---------------------------------------------------------
Proving that the real Mrs. Robinson stood up.
It occured to me last week that ken@research.att.com is _still_ a
valid
address, 25 years later... so I asked. Here, from Ken himself, is
the
Real Story:
) From ken@plan9.att.com Sun Apr 23 14:42 EDT 1995
) Received: from plan9.att.com by IntNet.net (5.x/SMI-SVR4)
) id AA19375; Sun, 23 Apr 1995 14:42:51 -0400
) Message-Id: <9504231842.AA19375@ IntNet.net>
) From: ken@plan9.att.com
) To: jra@IntNet.net
) Date: Sun, 23 Apr 1995 14:39:39 EDT
) Content-Type: text
) Content-Length: 928
) Status: RO
)
) thanks for the info. i had not seen
) that newsgroup. after you pointed it
) out, i looked up the discussion.
)
) writing to news just causes more
) misunderstandings in the future. there
) is no way to win.
[ note: I asked him if he minded my posting the reply, he had no objection
]
) fyi: the self reproducing cpp was
) installed on OUR machine and we
) enticed the "unix support group"
) (precursor to usl) to pick it up
) from us by advertising some
) non-backward compatible feature.
) that meant they had to get the
) binary and source since the source
) would not compile on their binaries.
)
) they installed it and in a month or
) so, the login command got the trojan
) hourse. later someone there noticed
) something funny in the symbol table
) of cpp and were digging into the
) object to find out what it was. at
) some point, they compiled -S and
) assembled the output. that broke
) the self-reproducer since it was
) disabled on -S. some months later
) the login trojan hourse also went
) away.
)
) the compiler was never released
) outside.
)
) ken
Everyone: please save this post, so the next time the question comes
up,
you can just go look. :-)
Cheers,
-- jr 'will bug legends for food' a
--
Jay R. Ashworth High Technology Systems Consulting Ashworth
Designer Linux: The Choice of a GNU Generation & Associates
ka1fjx/4 "I minored in babbling in college... and got +1 813 790 7592
jra@baylink.com honors in it." --Brian Heath NIC: jra3
Unix System Lab |