Where’s the FEEB? Effectiveness of Instruction Set Randomization CERIAS Security Seminar Purdue University 9 March 2005 David Evans University of Virginia.

Slides:



Advertisements
Similar presentations
Smashing the Stack for Fun and Profit
Advertisements

Machine/Assembler Language Putting It All Together Noah Mendelsohn Tufts University Web:
Introduction to Information Security ROP – Recitation 5 nirkrako at post.tau.ac.il itamarg at post.tau.ac.il.
University of VirginiaDARPA SRS - 27 Jan Effectiveness of Instruction Set Randomization Ana Nora Sovarel and David Evans DARPA SRS – Genesis Project.
Buffer Overflow Prevention ”\x31\xc0\x50\x68\x2f\x2f\x73\x68\x68\x2f\x62\x69\x6e \x89\xe3\x50\x53\x50\x54\x53\xb0\x3b\x50\xcd\x80” Presented to CRAB April.
1 CHAPTER 8 BUFFER OVERFLOW. 2 Introduction One of the more advanced attack techniques is the buffer overflow attack Buffer Overflows occurs when software.
Instruction-Set Randomization “Countering Code-Injection Attacks With Instruction-Set Randomization” G. Kc, A. Keromytis, and V. Prevelakis CCS October.
PC hardware and x86 3/3/08 Frans Kaashoek MIT
Accessing parameters from the stack and calling functions.
Practical Session 3. The Stack The stack is an area in memory that its purpose is to provide a space for temporary storage of addresses and data items.
Microprocessors Frame Pointers and the use of the –fomit-frame-pointer switch Feb 25th, 2002.
Andrea Bittau, Adam Belay, Ali Mashtizadeh, David Maziéres, Dan Boneh
Web siteWeb site ExamplesExamples Irvine, Kip R. Assembly Language for Intel-Based Computers, Stack Operations Runtime Stack PUSH Operation POP.
1 RISE: Randomization Techniques for Software Security Dawn Song CMU Joint work with Monica Chew (UC Berkeley)
Efficient Instruction Set Randomization Using Software Dynamic Translation Michael Crane Wei Hu.
Address Obfuscation: An Efficient Approach to Combat a Broad Range of Memory Error Exploits Sandeep Bhatkar, Daniel C. DuVarney, and R. Sekar Stony Brook.
David Evans CS201j: Engineering Software University of Virginia Computer Science Lecture 18: 0xCAFEBABE (Java Byte Codes)
G ENESIS : A Framework For Achieving Component Diversity John C. Knight, Jack W. Davidson, David Evans, Anh Nguyen-Tuong University of Virginia Chenxi.
Address Space Layout Permutation
Buffer overflows.
6.828: PC hardware and x86 Frans Kaashoek
Programming Models CT213 – Computing Systems Organization.
CS533 Concepts of Operating Systems Jonathan Walpole.
Assembly Language for Intel-Based Computers, 6 th Edition Chapter 8: Advanced Procedures (c) Pearson Education, All rights reserved. You may.
N-Variant Systems A Secretless Framework for Security through Diversity Institute of Software Chinese Academy of Sciences 29 May 2006 David Evans
Security through Diversity MIT (a “UVa-spinoff University”) 23 June 2005 David Evans University of Virginia Computer Science.
The N-Variant Systems Framework Polygraphing Processes for Secretless Security University of Texas at San Antonio 4 October 2005 David Evans
Automatic Diagnosis and Response to Memory Corruption Vulnerabilities Presenter: Jianyong Dai Jun Xu, Peng Ning, Chongkyung Kil, Yan Zhai, Chris Bookhot.
Stamping out worms and other Internet pests Miguel Castro Microsoft Research.
1 cs205: engineering software university of virginia fall 2006 Forgiveness and Permissions.
CISC Machine Learning for Solving Systems Problems Presented by: Sandeep Dept of Computer & Information Sciences University of Delaware Detection.
CS216: Program and Data Representation University of Virginia Computer Science Spring 2006 David Evans Lecture 22: Unconventional.
Microprocessors The ia32 User Instruction Set Jan 31st, 2002.
Buffer Overflow Attack Proofing of Code Binary Gopal Gupta, Parag Doshi, R. Reghuramalingam, Doug Harris The University of Texas at Dallas.
What is exactly Exploit writing?  Writing a piece of code which is capable of exploit the vulnerability in the target software.
G ENESIS : A Framework For Achieving Component Diversity John C. Knight, Jack W. Davidson, David Evans, Anh Nguyen-Tuong University of Virginia Chenxi.
Assembly Language. Symbol Table Variables.DATA var DW 0 sum DD 0 array TIMES 10 DW 0 message DB ’ Welcome ’,0 char1 DB ? Symbol Table Name Offset var.
Introduction to Information Security ROP – Recitation 5.
Information Leaks Without Memory Disclosures: Remote Side Channel Attacks on Diversified Code Jeff Seibert, Hamed Okhravi, and Eric Söderström Presented.
Where’s the FEEB?: Effectiveness of Instruction Set Randomization Nora Sovarel, David Evans, Nate Paul University of Virginia Computer Science USENIX Security.
G ENESIS: Security Through Software Diversity John C. Knight, Jack W. Davidson, David Evans, Anh Nguyen-Tuong University of Virginia Chenxi Wang Carnegie.
N-Variant Systems A Secretless Framework for Security through Diversity Benjamin Cox David Evans, Adrian Filipi, Jonathan Rowanhill, Wei Hu, Jack Davidson,
Group 9. Exploiting Software The exploitation of software is one of the main ways that a users computer can be broken into. It involves exploiting the.
Security Attacks Tanenbaum & Bo, Modern Operating Systems:4th ed., (c) 2013 Prentice-Hall, Inc. All rights reserved.
Slides by Kent Seamons and Tim van der Horst Last Updated: Nov 11, 2011.
CSC 221 Computer Organization and Assembly Language Lecture 15: STACK Related Instructions.
ROP Exploit. ROP Return Oriented Programming (ROP): is a hacking exploit technique where you exploit buffer overflow to inject a chain of gadgets. Each.
Week-14 (Lecture-1) Malicious software and antivirus: 1. Malware A user can be tricked or forced into downloading malware comes in many forms, Ex. viruses,
Paradyn Project Paradyn / Dyninst Week Madison, Wisconsin April 12-14, 2010 Paradyn Project Safe and Efficient Instrumentation Andrew Bernat.
Introduction to Information Security
Remix: On-demand Live Randomization
Buffer Overflow Buffer overflows are possible because C doesn’t check array boundaries Buffer overflows are dangerous because buffers for user input are.
Introduction to Information Security
The Hardware/Software Interface CSE351 Winter 2013
University of Virginia
Introduction to Information Security
Introduction to Compilers Tim Teitelbaum
The Effectiveness of Instruction Set Randomization
CS 465 Buffer Overflow Slides by Kent Seamons and Tim van der Horst
Defeating Instruction Set Randomization Nora Sovarel
Stealing Secrets and Secretless Security Structures
Stack Frames and Advanced Procedures
        Jefferson’s Polygraph
Practical Session 4.
System Calls David Ferry CSCI 3500 – Operating Systems
X86 Assembly Review.
Low-Level Thread Dispatching on the x86
Computer Architecture and System Programming Laboratory
Return-to-libc Attacks
Presentation transcript:

Where’s the FEEB? Effectiveness of Instruction Set Randomization CERIAS Security Seminar Purdue University 9 March 2005 David Evans University of Virginia work with Nora Sovarel, Nate Paul and the UVa/CMU Genesis Project

2 Security Through Diversity Today’s Computing Monoculture –Exploit can compromise billions of machines since they are all running the same software Biological Diversity –All successful species use very expensive mechanism (i.e., sex) to maintain diversity Computer security research: [Cohen 92], [Forrest + 97], [Cowan ], [Barrantes ], [Kc ], [Bhatkar ], [Just ]

3 Instruction Set Randomization [Barrantes+, CCS 03] [Kc+, CCS 03] Code injection attacks depend on knowing the victim machine’s instruction set Defuse them all by making instruction sets different and secret –Its expensive to design new ISAs and build new microprocessors

4 Derandomizer Processor Automating ISR Randomizer Secret Key Original Code Original Executable Randomized Executable

5 Derandomizer Processor ISR Defuses Attacks Randomizer Secret Key Original Executable Randomized Executable Malicious Injected Code Broken Malicious Code

6 ISR Designs Columbia [Kc 03]RISE [Barrantes 03] Randomization Function XOR or 32-bit transposition XOR Key Size 32 bits (same key used for all locations) program length (each location XORed with different byte) Transformation Time Compile TimeLoad Time DerandomizationHardwareSoftware (Valgrind)

7 How secure is ISR? Slows down an attack about 6 minutes! Under the right circumstances…

8 Memory Randomization Attack Brute force attack on memory address space randomization (Shacham et. al. [CCS 2004]): 24-bit effective key space Can a similar attack work against ISR? –Larger key space: must attack in fragments –Need to tell if partial guess is correct

9 ISR Attack Attack Client ISR-protected Server Incorrect Guess Crash! Attack Client Correct Guess ISR-protected Server Observable Behavior

10 Server Requirements Vulnerable: buffer overflow is fine Able to make repeated guesses –No rerandomization after crash –Likely if server forks requests (Apache) Observable: notice server crashes Cryptanalyzable –Learn key from one ciphertext-plaintext pair –Easy with XOR

11 Two Attack Ideas RET (0xC3): return from procedure –1-byte instruction: up to 256 guesses –Returns, leaves stack inconsistent Only works if server does something observable before crashing JMP -2 (0xEBFE): jump offset -2 –2-byte instruction: up to 2 16 guesses –Produces infinite loop Incorrect guess usually crashes server

12 Jump Attack Vulnerable Buffer Overwritten Return Address 0xEB (JMP) 0xFE (-2) Unknown Masks Correct guess produces infinite loop 2 16 possible guesses for 2-byte instruction

13 Incremental Jump Attack Guessing next byte: < 256 attempts Vulnerable Buffer Overwritten Return Address 0xEB (JMP) 0xFE (-2) Unknown Masks Guessing first 2 byte masks Overwritten Return Address 0xEB (JMP) 0xFE (-2) Unknown Masks 0xCD (INT) Guessed Masks

14 Guess Outcomes Observe “Correct” Behavior Observe “Incorrect” Behavior Correct GuessSuccessFalse Negative Incorrect GuessFalse PositiveProgress

15 False Positives Injected bytes produce an infinite loop: –JMP -4 –JNZ -2 Injected bytes are “harmless”, later executed instruction causes infinite loop Injected guess causes crash, but timeout expires before remote attacker observes

16 False Positives – Good News Can distinguish correct mask using other instructions Try injecting a “harmless” one-byte instruction –Correct: get loop –Incorrect: usually crashes Difficulty: dense opcodes –No pair that differs in only last bit are reliably different in harmfullness Overwritten Return Address 0x90 (NOOP) 0xEB (JMP) Unknown Masks 0xFE (-2) Guessed Masks

17 False Positives – Better News False positives are not random –Conditional jump instructions –Opcodes All are complementary pairs: 0111 xyz a not taken  0111 xyz ā is! 32 guesses always find an infinite loop About 8 additional guesses to determine correct mask

18 Extended Attack “Crash Zone” Overwritten Return Address 0xCD (INT) 0xE9 (Near Jump) 32-bit offset (to jump to original return address) 0xCD (INT) 0x06 (offset) 0xEB (JMP) Near jump to return location –Execution continues normally –No infinite loops 0xCD 0xCD is interrupt instruction guaranteed to crash

19 Expected Attempts ~ 15½ to find first jumping instruction + ~ 8 to determine correct mask 23½ expected attempts per byte “Crash Zone” Overwritten Return Address 0xCD (INT) 0xE9 (Near Jump) 32-bit offset (to jump to original return address) 0xCD (INT) 0x06 (offset) 0xEB (JMP)

20 Experiments Implemented attack against constructed vulnerable server protected with RISE [Barrantes et. al, 2003] –Memory space randomization works! Turned of Fedora’s address space randomization –Needed to modify RISE Ensure forked processes use same randomization key (other proposed ISR implementations wouldn’t need this) Obtain correct key over 95% of the time

21 Attempts Required 4339 attempts to get first 2 bytes 101,651 attempts to get 4096 bytes

22 Attempts per Byte Drops to below 24 average attempts per byte ~2 12 attempts for first 2 bytes

23 Total Time 4-byte key (Columbia implementation) in < 3½ minutes 4096-byte key in 48 minutes Attacker: “Is this good enough?” Defender: “Is this bad enough?”

24 How many key bytes needed? Inject malcode in one ISR-protected host –Sapphire worm = 376 bytes Create a worm that spreads on a network of ISR-protected servers –Space for FEEB attack code: 34,723 bytes –Need to crash server ~800K times

25 Maybe less…? VMWare: 3,530,821 bytes Java VM: 135,328 bytes Minsky’s UTM: 7 states, 4 colors MicroVM: 100 bytes

26 Entire MicroVM Code push dword ebpmov ebp, WORM_ADDRESS + WORM_REG_OFFSET pop dword [ebp + WORM_DATA_OFFSET] xor eax, eax ; WormIP = 0 (load from ebp + eax) read_more_worm: ; read NUM_BYTES at a time until worm is done cld xor ecx, ecx mov byte cl, NUM_BYTES mov dword esi, WORM_ADDRESS ; get saved WormIP add dword esi, eax mov edi, begin_worm_exec rep movsb; copies next Worm block into execution buffer add eax, NUM_BYTES ; change WormIP pushad ; save register vals mov edi, dword [ebp] ; restore worm registers mov esi, dword [ebp + ESI_OFFSET] mov ebx, dword [ebp + EBX_OFFSET] mov edx, dword [ebp + EDX_OFFSET] mov ecx, dword [ebp + ECX_OFFSET] mov eax, dword [ebp + EAX_OFFSET] begin_worm_exec: ; this is the worm execution buffer nop nop nop nop nop nop nop nop nop nop nop nop mov [ebp], edi; save worm registers mov [ebp + ESI_OFFSET], esi mov [ebp + EBX_OFFSET], ebx mov [ebp + EDX_OFFSET], edx mov [ebp + ECX_OFFSET], ecx mov [ebp + EAX_OFFSET], eax popad ; restore microVM register vals jmp read_more_worm

27 save worm address in ebp move stack frame pointer WormIP  0 copy worm code into buffer update WormIP save MicroVM registers load worm registers 22-byte worm execution buffer save worm registers load MicroVM registers jmp to read next block saved registers worm code host key masks guessed (target) masks other worm data Learned Key Bytes 76 bytes of code + 22 bytes for execution + 2 bytes to avoid NULL = 100 bytes is enough > 99% of the time MicroVM Worm code must be coded in blocks that fit into execution buffer (pad with noops so instructions do not cross block boundaries)

28 Making Jumps Within a block - short relative jump is fine Between worm blocks –From end of block, to beginning of block –Update the WormIP stored on the stack –Code conditional jump, JZ target in worm as: JNZ +5 ; if opposite condition, skip MOV [ebp + WORMIP_OFFSET] target

29 Deploying a Worm Learn 100 key bytes to inject MicroVM –Median time: 311 seconds, 8422 attempts –Fast enough for a worm to spread effectively Inject pre-encrypted worm code –XORed with the known key at location –Insert NOOPs when necessary to avoid NULLs Inject key bytes –Needed to propagate worm

30 Preventing Attack: Break Requirement Vulnerable: eliminate vulnerabilities –Rewrite all your code in a type safe language Able to make repeated guesses –Rerandomize after crash Observable: notice server crashes –Maintain client socket after crash? Cryptanalyzable –Use a strong cipher like AES instead of XOR

31 Better Solution Avoid secrets! –Keeping them is hard –They can be broken or stolen Prove security properties without relying on assumptions about secrets or probabilistic arguments

32 Secretless Security Structure work with Jack Davidson, Jonathan Hill, John Knight & Anh Nguyen-Tuong Input (Possibly Malicious) Server Variant A Server Variant B Monitor Output Input Replicator

33 Disjoint Variants Any attack that succeeds against Variant A must cause Variant B to crash Monitor observes crash and recovers Input Server Variant A Server Variant B Monitor Output Input Replicator Examples: Instruction Sets Memory Addresses Schedule Interleaving

34 JO JNO JB JNB JZ JNZ JMP CALL … Variant AVariant B JNO JNB JNZ CALL JO JB JZ JMP Making Disjoint Variants

35 Challenges Engineering –Input replicator and monitor –Shared state (databases, files) –Nondeterminism (session state) Security –Proving variants are disjoint –Multi-stage attacks –Achieving high-level disjoint properties

36 Jaws Diversity depends on your perspective Slide from my USENIX Security 2004 Talk, What Biology Can (and Can’t) Teach us about Security

37 Summary Diversity defenses defeat undetermined adversaries Determined adversaries may be able to determine secrets –Break ISR-protected server in < 6 minutes Secretless diversity designs promise provable security against classes of attack

38 Credits Nora “NORAndomizer” Sovarel Nate “Byte Annihilator” Paul Genesis Project: Jack Davidson, Adrian Filipi, Jonathan Hill, John Knight, Anh Nguyen-Tuong, Chenxi Wang (CMU) Thanks: Gabriela Barrantes (RISE code), Stephanie Forrest, Fred Schneider Sponsor: DARPA SRS (Lee Badger), NSF CAREER/ITR

39 Questions?