Friday, July 21, 2023

ABC C Compiler

Tom Murphy (PDF, via Nicolas Seriot):

Since only 37% of bytes are printable, if you inspect (i.e., “cat”) an executable program, it will almost always contain unprintable characters, and may beep at you, etc. However, since the printable bytes do stand for some subset of X86 opcodes, it is technically possible to make X86 sequences that are printable. One famous example is the EICAR Test File[…]


Most damningly, like many viruses it uses “self-modifying code” to first rewrite itself into different opcodes. This means that the processor ends up executing several non-printable opcodes. This is like telling the waiter that you don’t eat poultry but eggs are okay, and then they bring you an egg, but that egg hatches into a chicken right after they bring it to you. Come on.


In this paper I present a compiler for the C89 programming language called ABC. It produces completely printable executables from C code. While self-modifying code is a powerful technique, it makes this problem “too easy;” I want to explore what programs can be written natively in the printable subset of X86. Programs compiled with ABC do not modify themselves, or cause themselves to be modified; every instruction program executes (outside of the operating system) contains only the bytes 0x20-0x7E. Moreover, every byte in the file is printable, so programs can viewed as text.

Source code for this project is available at:

Tom Murphy:

But I also created the following video that explains the ideas involved, for interested non-experts or patient experts.

Comments RSS · Twitter · Mastodon

Leave a Comment