Control Data Attack Prevention Orthogonal to Memory Model
Total Page:16
File Type:pdf, Size:1020Kb
Minos: Control Data Attack Prevention Orthogonal to Memory Model Jedidiah R. Crandall and Frederic T. Chong University of California at Davis Computer Science Department crandall, chong @cs.ucdavis.edu Abstract used by the dynamic linker to calculate function pointers. Minos requires only a modicum of changes to the archi- We introduce Minos, a microarchitecture that imple- tecture, very few changes to the operating system, no binary ments Biba’s low-water-mark integrity policy on individual rewriting, and no need to specify or mine policies for indi- words of data. Minos stops attacks that corrupt control data vidual programs. In Minos, every 32-bit word of memory is to hijack program control flow but is orthogonal to the mem- augmented with a single integrity bit at the physical mem- ory model. Control data is any data which is loaded into the ory level, and the same for the general purpose registers. program counter on control flow transfer, or any data used This integrity bit is set by the kernel when the kernel writes to calculate such data. The key is that Minos tracks the in- data into a user process’ memory space. The integrity is set tegrity of all data, but protects control flow by checking this to either “low” or “high” based upon the trust the kernel has integrity when a program uses the data for control transfer. for the data being used as control data. Biba’s low-water- Existing policies, in contrast, need to differentiate between mark integrity policy [8] is applied by the hardware as the control and non-control data a priori, a task made impossi- process moves data and uses it for operations. ble by coercions between pointers and other data types such Biba’s low-water-mark integrity policy specifies that any as integers in the C language. subject may modify any object if the object’s integrity is not Our implementation of Minos for Red Hat Linux 6.2 on greater than that of the subject, but any subject that reads a Pentium-based emulator is a stable, usable Linux system an object has its integrity lowered to the minimum of the on the network on which we are currently running a web object’s integrity and its own. The only other implementa- server [3]. Our emulated Minos systems running Linux and tion of Biba’s low-water-mark integrity policy that we know Windows have stopped several actual attacks. We present a of is LOMAC [15] which applied this policy to file opera- microarchitectural implementation of Minos that achieves tions and ran into self-revocation problems. This monotonic negligible impact on cycle time with a small investment in behavior is the classic sort of problem with the low-water- die area, and minor changes to the Linux kernel to handle mark policy, which Minos ameliorates with a careful defini- the tag bits and perform virtual memory swapping. tion of trust. Intuitively, any control transfer involving un- trusted data is a system vulnerability. Minos detects exactly these vulnerabilities and consequently avoids false positives 1 Introduction under extensive testing. We chose to implement an entire system rather than demonstrating compatibility with just a Control data attacks form the overwhelming majority of handful of benchmarks. remote attacks on the Internet, especially Internet worms. If two data words are added, for example, an AND gate The cost of these attacks to commodity software users ev- is applied to the integrity bits of the operands to determine ery year now totals well into the billions of dollars. We the integrity of the result. A data word’s integrity is loaded propose a general microarchitectural mechanism to protect with it into general purpose registers. A hardware exception commodity systems from these attacks, namely, hardware traps to the kernel whenever low integrity data is used for that protects the integrity of control data. control flow purposes by an instruction such as a jump, call, Control data is any data which is loaded into the program or return. counter on control flow transfer, or any data used to calcu- Minos secures programs against attacks that hijack their late such data. It includes not just return pointers, function low-level control flow by overwriting control data. The def- pointers, and jump targets but variables such as the base ad- inition of trust in our Linux implementation stops all re- dress of a library and the index of a library routine within it mote intrusions based on control data corruption. We pro- Proceedings of the 37th International Symposium on Microarchitecture (MICRO-37’04) 1072-4451/04 $ 20.00 IEEE tect against local control data attacks designed to raise priv- In June of 2001, a month before Code Red, Microsoft ileges but only because the line between these and remote publicly stated that their new Windows XP operating system vulnerabilities is not clear. contained no buffer overflows because of a thorough code Virtually all remote intrusions are control data attacks. inspection [33]. Four months later a buffer overflow was The exceptions are directory traversal in URLs (for exam- found in the Universal Plug-and-Play functionality [2, CA- ple, “http://www.x.com/../../system/cmd.exe?/cmd”), con- 2001-37]. Control data protection problems in Microsoft trol characters in inputs to scripts that cause the inputs to software since have been a common occurrence, a batch of be interpreted as scripts themselves, or unchanged default about a dozen can be found in [2, TA04-104A]. All this passwords. These kinds of software indiscretions are out- suggests that perhaps the persistence of the buffer overflow side the scope of what the architecture is responsible for problem and control data protection problems in general is protecting. not due to lack of effort by software developers. Every ma- We begin by elaborating on the motivation behind Mi- jor Linux distribution’s security errata lists contain dozens nos. This is followed by related works in Section 3 to com- of control data protection vulnerabilities. This problem is pare Minos to existing and historical methods to add secu- an architecture problem. rity to the architecture and software. Then we describe the It is inevitable that large, complex systems written al- architectural support necessary for the system by consider- most entirely in C are going to have memory corruption ing its implementation on an out-of-order superscalar mi- bugs. The architecture’s failure to protect the integrity of croprocessor with two levels of on-chip cache in Section 4, control data, however, amplifies every memory corruption followed by Section 5 discussing our implementation of Mi- vulnerability into an opportunity to remotely hijack the con- nos for Red Hat Linux 6.2 on a Pentium emulator, as well trol flow of a process. as another implementation for Microsoft Windows XP. Sec- An integrity policy was chosen because the confidential- tion 6 explains our evaluation methodology and shows that ity and availability components of a full security policy are control data protection is a deeper issue than buffer over- not critical for control data protection. We chose Biba’s flows and C library format strings. The results in Section 7 low-water-mark policy over other integrity policies because show that Minos is very effective, that the low-water-mark it has the property that access controls are based on accesses integrity policy is stable, and that the performance overhead a subject has made in the past and therefore need not be of virtual memory swapping with tag bits is negligible. A specified. For a more thorough explanation of this property security assessment of Minos in Section 7.3 attempts to an- we refer the reader to [15]. alyze the security of the Minos approach against possibly more advanced attacks than are available today. This is fol- 3 Related Work lowed by recommendations for future research and conclu- sions. The key distinction of Minos is its orthogonality to the memory model. In Minos, integrity is a property of the 2 Motivation physical memory space, therefore Minos is applicable even to flat memory model machines. Minos should be equally Control data attacks form the overwhelming majority of as easy to implement on architectures with more complex remote attacks on the Internet, especially Internet worms, virtual addressing. and are a major constituent of local attacks designed to raise In the flat memory model, memory is viewed as a lin- privileges. These vulnerabilities allow control data such as ear array of untyped data words. The programmer is not return pointers on the stack, virtual function pointers, li- constrained by the architecture to treat any data word as a brary jump vectors, long jmp() buffers, or programmer de- particular type. This has obvious security disadvantages, fined hooks to be overwritten. When this data is read to be but this low-level control is the reason that the flat mem- used in a procedure call, return, a jump, or other transfer of ory model survived the vicissitudes of computer architec- control flow the attacker then has control of the program. ture when better designed, more secure architectures per- The cost of control data attacks to commodity software ished. users every year now totals well into the billions of dollars. Most commodity operating systems, such as Windows, The Code Red worm spread by a buffer overflow in Mi- Linux, or BSD, are based on this memory model and so are crosoft’s Internet Information Services (IIS) server, and this the languages they are built upon: C and C++. The suc- one worm alone is estimated to have caused more than $2.6 cess of Linux on dozens of architectures is facilitated by the billion in damage [23].