Saturday, March 28, 2009

An Idea: Internet Security Though Random Compilation

This morning an idea occurred to me -- a way to stop malware, viruses, and worms. When someone wishes to crack an internet protocol for nefarious purposes, one way to do so is to exploit bugs in buffer handling. For example, some specific implementation of the email protocol might have a bug whereby if certain characters are passed in the addess field then it causes a buffer overflow that could permit writing onto the stack. By sending the right set of characters, the overflow might be directed to upload and execute arbitrary instructions. Similar exploits have existed/still exist in many systems such as the image handlers for Microsoft Outlook and countless other programs.

As clever as it is, exploiting such a bug requires having a copy of the code locally during development so that the programmer can step through it and figure out exactly how to exploit the overflow. Thus, a way to defeat this is to ensure that every single instance of that code running on every machine is unique. Therefore the solution is simple. Write a compiler that generates random code that performs the same task but with different execution paths. Such a complier would stop all such exploits by effectively creating a local unique encryption. A random compiler would be easy to write and indeed already exists in Java as "code obfuscators" for the purposes of reducing reverse engineering. The only difficulty in deploying such a system is that the relevant software could no longer be deployed on mass-produced media such as CDs since each instance has to be different. But this is a declining issue as more and more software is delivered online where each instance could be different. Furthermore, many of the main internet protocols are open source implementations and where local compilation is already possible or, in many cases, already occuring. Therefore adding this feature to Gnu C would be a big step in the right direction.

No comments: