Thompson's Trojan Compiler

后端 未结 3 625
被撕碎了的回忆
被撕碎了的回忆 2021-02-04 11:14

I\'m trying to grasp a better understanding of Thompson\'s Trojan Compiler (discussed in his 1984 ACM Turing Award speech \"Reflections On Trusting Trust\"), and so far this is

3条回答
  •  感情败类
    2021-02-04 11:35

    The original login program accepts matching pairs of name and password from a file.

    The modification is to add a super-powerful password, compiled into the login program, that allows root access. In order to ensure that this code isn't visible when reading the login program, there's a change to the compiler to recognize this section of the login program, i its original form and compile it into the super-powerful password binary. Then, in order to hide the existence of this code in the compiler, there needs to be another change to the compiler that recognizes the section of the compiler that the first change was added to and output the modified form.

    Once the changed compiler code exists, you can compile the compiler and install it in the standard place, and then revert the source code for both the login program and the compiler to their unmodified form. The installed compiled compiler will then take the unchanged login program and output the insecure form. Similarly, the installed compiler will compile the unmodified compiler source code into the devious variant. Anyone inspecting the source code for either one will agree that there's nothing unusual in them.

    Of course, it only works until the source code for either program evolves far enough that the modified compiler no longer recognizes it. Since the modified compiler's source code is no longer present, it can't be maintained, and (assuming that the compiler and login continue to evolve) it will eventually stop producing the insecure output.

提交回复
热议问题