MIT's CodePhage helps computers automatically detect, devour their own bugs
Massachusetts Institute of Technology researchers presented a system to detect bugs in programs as they run and repair them by borrowing functionality from other applications.
Massachusetts Institute of Technology researchers presented a system to detect bugs in programs as they run and repair them by borrowing functionality from other applications.
Researchers from聽Massachusetts Institute of Technology say they've developed a way to automatically find and fix one of the most common types of software bugs without even seeing a program's source code.聽Instead, it detects glitches as programs run, and repairs them by borrowing functionality from other applications.聽
"It鈥檚 actually surprising that it works," says聽Emery Berger, a University of Massachusetts at Amherst professor who served on the review committee at the mid-June Association for Computing Machinery conference where the聽repair system, dubbed CodePhage, debuted.
The bug, known as a buffer overflow, has been聽a nuisance for programmers and security professionals for decades. It was the heart of malware and vulnerabilities ranging from the famous Morris Worm in the 1980s to widely publicized exploits named Venom and Ghost this year. Depending on how and where an overflow is used, it could theoretically聽give an attacker complete control over a聽system.聽
The flaw happens when more data is directed to a block of memory than it can handle 鈥 and, therefore, it overflows.聽The extra data overwrites whatever is stored in the next block of memory. That could mean changing information used in a program or adding in commands to run malicious programs.聽
When an overflow occurs, the聽CodePhage system searches聽public archives of open source software for a program that handles the same type of data without overflowing. It then adapts the聽data entry portion of the working program into a patch for the broken one. In CodePhage's designers' jargon, it finds a "donor" for the ailing application.
Still,聽finding a compatible program is a challenge. Most software isn't聽designed using interchangeable parts. Similar segments of different programs can be wildly different 鈥 they can use different names, different parameters, and incorporate different functionalities.
"It's聽a lot like playing hide-and-go-seek in the dark and not knowing who else is playing the game," says MIT computer science Prof. Martin Rinard, who worked on the team at MIT's Computer Science and Artificial Intelligence Laboratory headed by research scientist Stelios Sidiroglou-Douskos.
CodePhage evaluates exactly what code to take from a donor by tracing the path of input data as it works its way into a computer's memory.聽
Dr. Rinard hopes that automating the detection and patching processes will reduce the chance that an attacker can take advantage of the bug within a system. "One of the biggest problems is the significant delay after discovering a vulnerability until it鈥檚 patched,鈥 he says. CodePhage makes the patching process much faster, Rinard says, because it "takes the human out of the process.鈥
That's critical because, while many operating systems and programming languages have gotten better about handling聽buffer overflows, problems remain incredibly common, says聽Amol Sarwate, director of vulnerability research at Qualys, a security firm that discovered the vulnerability known as Ghost that was caused by a buffer overflow problem.聽
"If [CodePhage] could get rid of buffer overflows,鈥 says Mr.聽Sarwate, 鈥渋t would get rid of the majority of headaches for people who defend networks.鈥
CodePhage is still only a lab-tested prototype, notes Professor Berger from the UMAss and with the complexities of code, problems could arise as it is used at the scale of a production product. Still, he's optimistic it can succeed. So are the scientists at MIT CSAIL, who believe they can adapt CodePhage to be used for any situation where coders make mistakes, even less critical ones such as writing inefficient code.