Nav: Home

Good code, bad computations: A computer security gray area

October 27, 2008

If you want to make sure your computer or server is not tricked into undertaking malicious or undesirable behavior, it's not enough to keep bad code out of the system.

Two graduate students from UC San Diego's computer science department--Erik Buchanan and Ryan Roemer--have just published work showing that the process of building bad programs from good code using "return-oriented programming" can be automated and that this vulnerability applies to RISC computer architectures and not just the x86 architecture (which includes the vast majority of personal computers).

Last year, UC San Diego computer science professor Hovav Shacham formally described how return-oriented programming could be used to force computers with the x86 architecture to behave maliciously without introducing any bad code into the system. However, the attack required painstaking construction by hand and appeared to rely a unique quirk of the x86 design.

This new automation and generalization work from graduate students and professors from UC San Diego's Jacobs School of Engineering will be presented on October 28 at ACM's Conference on Communications and Computer Security (CCS) 2008, one of the premier academic computer security conferences.

"Most computer security defenses are based on the notion that preventing the introduction of malicious code is sufficient to protect a computer. This assumption is at the core of trusted computing, anti-virus software, and various defenses like Intel and AMD's no execute protections. There is a subtle fallacy in the logic, however: simply keeping out bad code is not sufficient to keep out bad computation," said UC San Diego computer science professor Stefan Savage, an author on the CCS 2008 paper.

Return-oriented Programming

Return-oriented programming exploits start out like more familiar attacks on computers. The attacker takes advantage of a programming error in the target system to overwrite the runtime stack and divert program execution away from the path intended by the system's designers. But instead of injecting outside code--the approach used in traditional malicious exploits--return-oriented programming enables attackers to create any kind of nasty computation or program by using just the existing code.

"You can create any kind of malicious program you can imagine--Turing complete functionality," said Shacham.

For example, a user's Web browser could be subverted to record passwords typed by the user or to send spam e-mail to all address book contacts, using only the code that makes up the browser itself.

"There is value in showing just how big of a potential problem return-oriented programming may turn out to be," said computer science graduate student Erik Buchanan.

The term "return-oriented programming" describes the fact that the "good" instructions that can be strung together in order to build malicious programs need to end with a return command. The graduate students showed that the process of building these malicious programs from good code can be largely automated by grouping sets of instructions into "gadgets" and then abstracting much of the tedious work behind a programming language and compiler.

Imagine taking a 700 page book, picking and choosing words and phrases in no particular order and then assembling a 50 page story that has nothing to do with the original book. Return-oriented programming allows you to do something similar. Here the 700 page book is the code that makes up the system being attacked--for example, the standard C-language library libc--and the story is the malicious program the attacker wishes to have executed.

"We found that return-oriented programming poses a much more general vulnerability than people initially thought," said computer science graduate student Ryan Roemer. He and Buchanan chose to study return-oriented programming for a class project after they heard Shacham outline a series of open questions in a guest lecture he gave in Savage's computer security course last winter.

Living with Return-Oriented Programming

"The threat posed by return-oriented programming, across all architectures and systems, has negative implications for an entire class of security mechanisms: those that seek to prevent malicious computation by preventing the execution of malicious code," the authors write in their CCS 2008 paper.

For instance, Intel and AMD have implemented security functionality into their chips (NX/XD) that prevents code from being executed from certain memory regions. Operating systems in turn use these features to prevent input data from being executed as code (e.g., Microsoft's Data Execution Prevention feature introduced in Windows XP SP2). The new research from UC San Diego, however, highlights an entire class of exploits that would not be stopped by these security measures since no malicious code is actually executed. Instead, the stack is "hijacked" and forced to run good code in bad ways.

"We have demonstrated that return-oriented exploits are practical to write, as the complexity of gadget combination is abstracted behind a programming language and compiler. Finally, we argue that this approach provides a simple bypass for the vast majority of exploitation mitigations in use today," the computer scientists write.

The authors outline a series of approaches to combat return-oriented programming. Eliminating vulnerabilities permitting control flow manipulation remains a high priority--as it has for 20 years. Other possibilities: hardware and software support for further constraining control flow and addressing the power of the return-oriented approach itself.

"Finally, if the approaches fail, we may be forced to abandon the convenient model that code is statically either good or bad, and instead focus on dynamically distinguishing whether a particular execution stream exhibits good or bad behavior," the authors write.
"When Good Instructions Go Bad: Generalizing Return-Oriented Programming to RISC," by Erik Buchanan, Ryan Roemer, Hovav Shacham, and Stefan Savage, Department of Computer Science & Engineering University of California, San Diego's Jacobs School of Engineering.

This work was made possible by the National Science Foundation (NSF).

University of California - San Diego

Related Computer Security Articles:

Computer-based weather forecast: New algorithm outperforms mainframe computer systems
The exponential growth in computer processing power seen over the past 60 years may soon come to a halt.
Focus on food security and sustainability
The number of malnourished people is increasing worldwide. More than two billion people suffer from a lack of micronutrients.
Eliminating infamous security threats
Speculative memory side-channel attacks like Meltdown and Spectre are security vulnerabilities in computers.
UBC study: Publicizing a firm's security levels may strengthen security over time
New research from the UBC Sauder School of Business has quantified the security levels of more than 1,200 Pan-Asian companies in order to determine whether increased awareness of one's security levels leads to improved defense levels against cybercrime.
Discovery casts dark shadow on computer security
Two international teams of security researchers have uncovered Foreshadow, a new variant of the hardware vulnerability Meltdown announced earlier in the year, that can be exploited to bypass Intel Processors' secure regions to access memory and data.
Shh! Proven security for your secrets
Researchers show the security of their cipher based on chaos theory.
A library for food security
Researchers are uncovering the genome of cowpeas, also known as black-eyed peas, in response to challenging growing conditions and the need for food security.
Bring your own (security) disaster
Bring your own device (BYOD) to work is common practice these days.
'Security fatigue' can cause computer users to feel hopeless and act recklessly
A new study from National Institute of Standards and Technology researchers found that a majority of the typical computer users they interviewed experienced security fatigue -- weariness or reluctance to deal with computer security -- that often leads users to risky computing behavior at work and in their personal lives.
Computer scientists find way to make all that glitters more realistic in computer graphics
Iron Man's suit. Captain America's shield. The Batmobile. These all could look a lot more realistic thanks to a new algorithm developed by a team of US computer graphics experts.
More Computer Security News and Computer Security Current Events

Trending Science News

Current Coronavirus (COVID-19) News

Top Science Podcasts

We have hand picked the top science podcasts of 2020.
Now Playing: TED Radio Hour

Making Amends
What makes a true apology? What does it mean to make amends for past mistakes? This hour, TED speakers explore how repairing the wrongs of the past is the first step toward healing for the future. Guests include historian and preservationist Brent Leggs, law professor Martha Minow, librarian Dawn Wacek, and playwright V (formerly Eve Ensler).
Now Playing: Science for the People

#566 Is Your Gut Leaking?
This week we're busting the human gut wide open with Dr. Alessio Fasano from the Center for Celiac Research and Treatment at Massachusetts General Hospital. Join host Anika Hazra for our discussion separating fact from fiction on the controversial topic of leaky gut syndrome. We cover everything from what causes a leaky gut to interpreting the results of a gut microbiome test! Related links: Center for Celiac Research and Treatment website and their YouTube channel
Now Playing: Radiolab

The Flag and the Fury
How do you actually make change in the world? For 126 years, Mississippi has had the Confederate battle flag on their state flag, and they were the last state in the nation where that emblem remained "officially" flying.  A few days ago, that flag came down. A few days before that, it coming down would have seemed impossible. We dive into the story behind this de-flagging: a journey involving a clash of histories, designs, families, and even cheerleading. This show is a collaboration with OSM Audio. Kiese Laymon's memoir Heavy is here. And the Hospitality Flag webpage is here.