Implementing Trusting Trust attack on chibicc
Inspired by Running the “Reflections on Trusting Trust” Compiler and original Ken Thompson's paper
$ patch < tt-attack/attack.patch
$ make
$ ./chibicc tt-utils/hello.c
$ ./a.out
backdoooredThen install ./chibicc executable somewhere in your PATH
$ make clean
$ git restore tokenize.cNow build from original source using infected compiler
$ make CC=chibiccReplace old chibicc executable with newly built one
$ make clean
$ make CC=chibicc
$ ./chibicc tt-utils/hello.c
$ ./a.out
backdooored