Skip to content

sxrose/evil-chibicc

 
 

Repository files navigation

Implementing Trusting Trust attack on chibicc

Inspired by Running the “Reflections on Trusting Trust” Compiler and original Ken Thompson's paper

Step 1. Build backdoored compiler

$ patch < tt-attack/attack.patch
$ make
$ ./chibicc tt-utils/hello.c
$ ./a.out 
backdooored

Then install ./chibicc executable somewhere in your PATH

Step 2. Rebuild with non-infected source

$ make clean
$ git restore tokenize.c

Now build from original source using infected compiler

$ make CC=chibicc

Replace old chibicc executable with newly built one

Step 3. Rebuild with new compiler

$ make clean
$ make CC=chibicc
$ ./chibicc tt-utils/hello.c
$ ./a.out
backdooored

About

Experimenting with Trusting Trust attack

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages

  • C 96.7%
  • Shell 2.8%
  • Other 0.5%