Where’s the FEEB?: Effectiveness of Instruction Set Randomization Nora Sovarel, David Evans, Nate Paul University of Virginia Computer Science USENIX Security.

Slides:



Advertisements
Similar presentations
Smashing the Stack for Fun and Profit
Advertisements

David Brumley Carnegie Mellon University Credit: Some slides from Ed Schwartz.
COMP 2003: Assembly Language and Digital Logic
Introduction to Information Security ROP – Recitation 5 nirkrako at post.tau.ac.il itamarg at post.tau.ac.il.
Richard Wartell, Vishwath Mohan, Dr. Kevin Hamlen, Dr. Zhiqiang Lin
University of VirginiaDARPA SRS - 27 Jan Effectiveness of Instruction Set Randomization Ana Nora Sovarel and David Evans DARPA SRS – Genesis Project.
1 CHAPTER 8 BUFFER OVERFLOW. 2 Introduction One of the more advanced attack techniques is the buffer overflow attack Buffer Overflows occurs when software.
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.
Assembly תרגול 8 פונקציות והתקפת buffer.. Procedures (Functions) A procedure call involves passing both data and control from one part of the code to.
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.
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
On the Effectiveness of Address-Space Randomization CS6V Brian Ricks and Vasundhara Chimmad.
6.828: PC hardware and x86 Frans Kaashoek
Code Generation Gülfem Savrun Yeniçeri CS 142 (b) 02/26/2013.
Introduction: Exploiting Linux. Basic Concepts Vulnerability A flaw in a system that allows an attacker to do something the designer did not intend,
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.
Sahar Mosleh California State University San MarcosPage 1 Nested Procedure calls and Flowcharts.
CS216: Program and Data Representation University of Virginia Computer Science Spring 2006 David Evans Lecture 22: Unconventional.
Where’s the FEEB? Effectiveness of Instruction Set Randomization CERIAS Security Seminar Purdue University 9 March 2005 David Evans University of Virginia.
CNIT 127: Exploit Development Ch 1: Before you begin.
Stack-based buffer overflows Yves Younan DistriNet, Department of Computer Science Katholieke Universiteit Leuven Belgium
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.
On the Effectiveness of Address-Space Randomization Hovav Shacham, Matthew Page, Ben Pfaff, Eu-Jin Goh, Nagendra Modadugu, Dan Boneh.
4. Kernel and VGA ENGI 3655 Lab Sessions. Richard Khoury2 Textbook Readings  None.
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.
Slides by Kent Seamons and Tim van der Horst Last Updated: Nov 11, 2011.
1 Assembly Language: Function Calls Jennifer Rexford.
CSC 221 Computer Organization and Assembly Language Lecture 15: STACK Related Instructions.
Assembly Language for Intel-Based Computers, 4 th Edition Lecture 22: Conditional Loops (c) Pearson Education, All rights reserved. You may modify.
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,
Assembly Language Addressing Modes. Introduction CISC processors usually supports more addressing modes than RISC processors. –RISC processors use the.
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.
Stack Operations Dr. Hadi AL Saadi.
Introduction to Information Security
C function call conventions and the stack
The Hardware/Software Interface CSE351 Winter 2013
Introduction to Information Security
Chapter 4 Data Movement Instructions
Assembly IA-32.
The Effectiveness of Instruction Set Randomization
CS 301 Fall 2002 Control Structures
Computer Architecture adapted by Jason Fritts then by David Ferry
Summary by - Bo Zhang and Shuang Guo [Date: 03/31/2014]
Machine-Level Programming 4 Procedures
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
Machine-Level Programming III: Procedures Sept 18, 2001
Practical Session 4.
Multi-modules programming
X86 Assembly Review.
Low-Level Thread Dispatching on the x86
ICS51 Introductory Computer Organization
Computer Architecture and System Programming Laboratory
Presentation transcript:

Where’s the FEEB?: Effectiveness of Instruction Set Randomization Nora Sovarel, David Evans, Nate Paul University of Virginia Computer Science USENIX Security August 2005 Baltimore, MD

Security Through Diversity Monoculture –Windows, x86 ISA, Cisco, Apache Diversity –Address Space Layout Randomization - PaX, Exec Shield Brute force attack [Shacham+, CCS 04] –Instruction Set Randomization [Barrantes+, CCS 03] [Kc+, CCS 03]

Instruction Set Randomization Encryption Key CompileLoadIn memoryExecution Decryption Key [Barrantes+, CCS 03] [Kc+, CCS 03]

ISR Effectiveness Can an attacker determine the randomization key remotely? –Next: incremental guessing technique Can an attacker spread a worm on network of ISR-protected servers? –Later this talk: MicroVM technique

Incremental Guessing Key space too large (2 4K ) for brute force guessing Need to guess key bytes incrementally: XOR encryption allows this Attacker needs to find a short instruction sequence that produces remotely observable behavior

Remotely Observable Behavior TCP sockets Wrong guess - application crash, the socket is closed immediately Correct guess – the socket stays open / application sends the expected result False positives –Wrong guess which looks like a good one

Guessed Instructions Short control flow instructions Return instruction ( 0xc3 ) –One-byte instruction –Changes control flow noticeably –Problem: mangles stack, server will usually crash soon after correct guess Jump instruction ( 0xebfe ) –Two-byte instruction –jmp -2 produces an infinite loop

Jump – first two bytes fe eb Overwritten Return Address Infinite loop – jmp -2 False positives –Small negative offset jmp -4 –Conditional jumps jnz -2 –Others (see paper)

Conditional Jumps 16 conditional jumps ( 0x70  0x7f ) Opposite conditions differ by last bit –JZ (0x74), JNZ (0x75) At most 32 attempts to find first infinite loop –0x00,0x10,…,0xf0, 0x01,0x11,…,0xf1 Average number of attempts –15.75 to find first infinite loop –23.5 to guess the key

Next bytes fe eb 0xbfffe991 cd fe 0xbfffe990 eb

Extended attack cd 06 Overwritten Return Address eb cd e9 Use a combination of short ( 0xeb ) and near jump ( 0xe9 ) Reduce false positives by using interrupt instruction ( 0xcd ) 32 bitoffset cd

Attack Requirements Multiple guess attempts on same key –Server forks process –No rerandomization Remotely observable behavior Vulnerability that allows injection at known address Simple encryption scheme –Byte-wise –Learn key from one plain/cipher pair

Experiment Simple echo server with a buffer overflow vulnerability Forks a process for each request New Mexico RISE [Barrantes+, CCS 03] Modified RISE to initialize the encryption keys before fork Turned off Fedora address space layout randomization

Attempts per Byte Attempts/Byte Key Bytes Acquired

Time

Is attack practical? Attack one server –Inject malicious code –Sapphire: 376 bytes (under 10 minutes) Spread a worm –Need to add guessing code: 34,723 bytes –Need to crash server ~ 800k times Can we do better ?

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 Loop: 1.Load block into execution buffer 2.Execute block

Micro VM – 100 bytes push dword ebp mov 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 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 jmp read_more_worm ; restore microVM register vals and read more

Deploying a Worm Learn 100 key bytes to inject MicroVM –Median 8694 attempts –Fast enough for a worm to spread effectively Inject pre-encrypted worm code –XORed with the known key at location Inject key bytes –needed to propagate

Worm code Worm code split into 22 byte basic blocks (noop padding) Jumps –Within a block - short relative jump is fine –Between worm blocks 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

Countermeasures Eliminate all vulnerabilities –Attacker can not inject anymore Fixed known address –Combine ISR with ASLR Rerandomize periodically –Monitor the process crashes Stronger encryption –Use a stronger cipher like AES

Summary ISR promising and effective But, vulnerable when –attacker can send multiple guess attempts against the same key –simple encryption is used

Done