Lecture Embedded System Security A. R. Darmstadt, Runtime Attacks

Size: px
Start display at page:

Download "Lecture Embedded System Security A. R. Darmstadt, Runtime Attacks"

Transcription

1

2 2

3 ARM stands for Advanced RISC Machine Application area: Embedded systems Mobile phones, smartphones (Apple iphone, Google Android), music players, tablets, and some netbooks Advantage: Low power consumption ARM features XN (execute Never) Bit This Bit allows operating systems to enforce the W xor X (Writable xor Executable) security model Follows RISC design Mostly single cycle execution Fixed instruction length Dedicated load and store instructions 3

4 Some features of ARM Conditional Execution Reducing branch overhead by allowing instructions only to be executed under certain conditions Two Instruction Sets ARM (32 Bit) The traditional instruction set THUMB (16 Bit) Suitable for devices that provide limited memory space The processor can switch the instruction set on the fly Both instruction sets may occur in a single program 3 Register Instruction Set instruction destination, source, source ADD r0,r1,r2 r0 = r1 + r2 4

5 ARM s 32 Bit processor features 16 registers All registers r0 to r15 are directly accessible Hence, in contrast to Intel x86, it is possible to directly change the program counter r15 Caller Save registers are registers that the callee (e.g., a subroutine) can freely change, i.e., the caller has to back up these registers himself Callee save registers are registers that the callee needs to reset to their original content before returning to the caller Function arguments and results from function (caller save) Register variables (callee save) r0 r1 r2 r3 r4 r5 r6 r7 r8 r9 r10 r11 Intra Procedure Call Register Holds Top Address of Stack Pointer the Stack Link Register Program Counter Holds Return Address Status Register: e.g., Carry Flag Sometimes used for long jumps, i.e., branches that require the full ARM 32 Bit address space Control Program Status Register r12/ip r13/sp r14/lr r15/pc Next address of instruction to be executed cpsr 5

6 Specified in AAPCS ARM Architecture Procedure Call Standard No dedicated call and return instructions Instead any jump instruction can be used as call and return Example for Function Call Instructions BL addr Branch with Link Branches to addr, and stores the return address in the link register r14 The return address is simply the address that follows the BL instruction BLX addr/reg Branch with Link and Exchange (allows indirect calls) Branches to addr or to an address that is specified in a processor register reg As BL, the BLX instruction stores the return address in r14 This instruction allows the exchange between ARM and THUMB A change from ARM to THUMB is performed when the last bit of the target address is set (address is odd) A change from THUMB to ARM is performed when the last bit of the target address is not set (address is even) 6

7 Example for Function Return Instructions BX lr Branch to Link Register r14 Branches to the return address stored in the link register POP {pc} Pops top of the the stack into the program counter r15 In case the return address has been saved on the stack, this instruction would allow the return address to be loaded in the program counter 7

8 To understand how a runtime attack works, we take a deeper look at the stack frame and its elements High Addresses Stack grows downwards Stack Frame Low Addresses Stack Function Arguments Return Address Saved Frame Pointer Callee Save Registers* Local Variables Frame Pointer (r7 or r11) Stack Pointer (sp) *Note that a subroutine does not always store all callee save registers (r4 r11); instead it stores those registers that it really uses/changes 8

9 Stack is a last in, first out (LIFO) memory area where the stack pointer (sp) points to the top word on the stack Usually, the stack grows downwards (from high to low memory addresses) The stack can be accessed by two basic operations 1. Push elements onto the stack (SP is decremented) 2. Pop elements off the stack (SP is incremented) Stack is divided into individual stack frames Each function call sets up a new stack frame on top of the stack 1. Function arguments 2. Callee save Registers Registers that a subroutine (callee) needs to reset before returning to the caller of the subroutine 3. Saved Frame Pointer (on x86, referred to as Saved Base Pointer) Frame pointer of the calling function Variables/arguments are accessed via an offset to the frame pointer Provided in register r11 (ARM code) or r7 (THUMB code) 4. Return address Upon function return, control transfers to the code pointed to by the return address (i.e., control transfers back to the caller of the function) Provided in link register lr 5. Local variables 9

10 Function Call: BL Function_A The BL instruction automatically loads the return address into the link register lr Stack sp <main>: Code BL Function_A <Function_A>: PUSH {r4,r7,lr} SUB sp,sp,#16 ADD sp,sp,#16 POP {r4,r7,pc} 10

11 Function Call: BL Function_A The BL instruction automatically loads the return address into the link register lr Function Prologue 1: PUSH {r4,r7,lr} Stores callee save register r4, the frame pointer r7, and the return address lr on the stack <main>: Stack Return Address lr SFP (r7) r4 Code BL Function_A sp <Function_A>: PUSH {r4,r7,lr} SUB sp,sp,#16 ADD sp,sp,#16 POP {r4,r7,pc} 11

12 Function Call: BL Function_A The BL instruction automatically loads the return address into the link register lr Function Prologue 1: PUSH {r4,r7,lr} Stores callee save register r4, the frame pointer r7, and the return address lr on the stack Function Prologue 2: SUB sp,sp,#16 Allocates 16 Bytes for local variables on the stack <main>: Stack Return Address lr SFP (r7) r4 16 Bytes for local variables Code BL Function_A sp <Function_A>: PUSH {r4,r7,lr} SUB sp,sp,#16 ADD sp,sp,#16 POP {r4,r7,pc} 12

13 Function Call: BL Function_A The BL instruction automatically loads the return address into the link register lr Function Prologue 1: PUSH {r4,r7,lr} Stores callee save register r4, the frame pointer r7, and the return address lr on the stack Function Prologue 2: SUB sp,sp,#16 Allocates 16 Bytes for local variables on the stack Function Body: Instructions, <main>: Stack Return Address lr SFP (r7) r4 16 Bytes for local variables Code BL Function_A <Function_A>: PUSH {r4,r7,lr} SUB sp,sp,#16 ADD sp,sp,#16 POP {r4,r7,pc} sp 13

14 Function Call: BL Function_A The BL instruction automatically loads the return address into the link register lr Function Prologue 1: PUSH {r4,r7,lr} Stores callee save register r4, the frame pointer r7, and the return address lr on the stack Function Prologue 2: SUB sp,sp,#16 Allocates 16 Bytes for local variables on the stack Function Body: Instructions, Function Epilogue 2: ADD sp,sp,#16 Reallocates the space for local variables <main>: Stack Return Address lr SFP (r7) r4 16 Bytes for local variables Code BL Function_A <Function_A>: PUSH {r4,r7,lr} SUB sp,sp,#16 ADD sp,sp,#16 POP {r4,r7,pc} sp 14

15 Function Call: BL Function_A The BL instruction automatically loads the return address into the link register lr Function Prologue 1: PUSH {r4,r7,lr} Stores callee save register r4, the frame pointer r7, and the return address lr on the stack Function Prologue 2: SUB sp,sp,#16 Allocates 16 Bytes for local variables on the stack Function Body: Instructions, Function Epilogue 2: ADD sp,sp,#16 Reallocates the space for local variables Function Epilogue 2: POP {r4,r7,pc} The POP instruction pops the callee save register r4, the saved frame pointer r7, and the return address off the stack which is loaded it into the program counter pc Hence, the execution will continue in the main function <main>: Stack Return Address lr SFP (r7) r4 16 Bytes for local variables Code BL Function_A <Function_A>: PUSH {r4,r7,lr} SUB sp,sp,#16 ADD sp,sp,#16 POP {r4,r7,pc} sp 15

16 16

17 Runtime attacks are major threats to today's applications Control flow of an application is compromised at runtime Typically, runtime attacks include injection of malicious code Reasons for runtime attacks Software is written in unsafe languages such as C/C++ Thus, it suffers from various memory related vulnerabilities Most prominent example: Buffer overflow Are known for 2 decades Various techniques exist (e.g., Stack Smashing, Heap Overflow, Integer Overflow, Format String) 17

18 18 18

19 Basic Block BBL 1 entry ins, ins, ins, exit BBL 3 entry ins, ins, ins, exit BBL 2 entry ins, ins, ins, exit BBL 4 entry ins, ins, ins, exit BBL 5 entry ins, ins, ins, exit Entry: Any instruction that is target of a branch (e.g., first instruction of a function) Exit: Any branch (e.g., indirect or direct jump/call, return) 19

20 Basic Block BBL 1 entry ins, ins, ins, exit BBL 3 entry ins, ins, ins, exit BBL 2 entry ins, ins, ins, exit 1 Code Injection Attacks Malicious Code Shellcode 2 Code Reuse Attacks Library Code BBL 4 BBL 5 Instruction Sequences Library Functions entry ins, ins, ins, exit entry ins, ins, ins, exit Entry: Any instruction that is target of a branch (e.g., first instruction of a function) Exit: Any branch (e.g., indirect or direct jump/call, return) 20

21 21 21

22 Target of Buffer Overflow Attacks Subvert the usual execution flow of a program by redirecting it to a injected (malicious) code The attack consists of 1. injecting new (malicious) code into some writable memory area, 2. and changing a code pointer (usually the return address) in such a way that it points to the injected malicious code Code Injection Code can be injected by overflowing a local buffer allocated on the stack The target of the injected code is usually to launch a shell to the adversary Therefore the injected code is often referred to as shellcode 22

23 Simple Echo program suffering from a stack overflow vulnerability The gets() function does not provide bounds checking 23

24 24 24

25 Stack Adversary <main>: Code BL echo() BL printf(), <echo>: Function Prologue BL gets(buffer), Function Epilogue Program Memory 25

26 Stack Adversary <main>: Code BL echo() BL printf(), <echo>: Function Prologue BL gets(buffer), Function Epilogue Program Memory 26

27 Adversary Stack Return Address SFP & Other Regs. Local Buffer Buffer[80] sp <main>: Code BL echo() BL printf(), <echo>: Function Prologue BL gets(buffer), Function Epilogue Program Memory 27

28 Stack Adversary Corrupt Control Structures <main>: Return Address SFP & Other Regs. Local Buffer Buffer[80] Code BL echo() BL printf(), sp <echo>: Function Prologue BL gets(buffer), Function Epilogue Program Memory 28

29 Stack Adversary Corrupt Control Structures NEW RETURN ADDR PATTERN <main>: SHELLCODE Code BL echo() BL printf(), sp <echo>: Function Prologue BL gets(buffer), Function Epilogue Program Memory 29

30 Stack Adversary Corrupt Control Structures echo() now returns! NEW RETURN ADDR PATTERN <main>: Code BL echo() BL printf(), <echo>: SHELLCODE Function Prologue BL gets(buffer), Function Epilogue sp Program Memory 30

31 Adversary Stack NEW RETURN ADDR PATTERN SHELLCODE sp Corrupt Control Structures echo() now returns! <main>: Code BL echo() BL printf(), <echo>: Function Prologue BL gets(buffer), Function Epilogue Program Memory 31

32 Adversary Stack NEW RETURN ADDR PATTERN SHELLCODE sp Shellcode executes <main>: Code BL echo() BL printf(), <echo>: Function Prologue BL gets(buffer), Function Epilogue Program Memory 32

33 Why the attack is possible? The gets() function provides no bounds checking C/C++ includes various functions providing no boundschecking, e.g., strcpy(): Copies a string into a buffer strcat(): Concatenates two strings scanf(): Read data from stdin (Standard Input) General defense against code injection attacks is W ^ X (Writable Xor Executable) With W ^ X memory pages can be either marked writable or executable Stack is marked writable Hence, the adversary can only inject his malicious code, but cannot execute it 33

34 34 34

35 35 35

36 Basic idea Instead of injecting code, use existing code Subvert the usual execution flow by redirecting it to functions in linked system libraries The process's image consists of 1. writable memory areas like stack and heap, 2. and executable memory areas such as the code segment and the linked system libraries The target for useful code can be found in the C library libc The C library libc Libc is linked to nearly every Unix program This library defines system calls and other basic facilities such as open(), malloc(), printf(), system(), execve(), etc. E.g., system ( /bin/sh ) 36

37 Libc provides the following useful functions to the adversary The system() function Executes a new program within a running program Example: system ("/bin/sh") This function executes the /bin/sh file (i.e., a new shell is launched) The execve() function Execute a new program and replace the (old) running program Example: execve (argv[0], argv, NULL); argv is a string array, where argv[0] = "/bin/sh" This function launches a new shell and replaces the running program 37

38 38 38

39 Stack Adversary Program Code <main>: BLX echo() <echo>: Function Prologue BLX gets(buffer), Function Epilogue Library Code <system>: Function Prologue Function Epilogue <XYZ_function>: POP {R0} POP {PC} Inject environment variable Environment Variables $SHELL = "/bin/sh" Program Memory 39

40 Stack Adversary Program Code <main>: BLX echo() <echo>: Function Prologue BLX gets(buffer), Function Epilogue Library Code <system>: Function Prologue Function Epilogue <XYZ_function>: POP {R0} POP {PC} Environment Variables $SHELL = "/bin/sh" Program Memory 40

41 Stack Adversary Return Address SFP & Other Regs. Local Buffer Buffer[80] sp Program Code <main>: BLX echo() <echo>: Function Prologue BLX gets(buffer), Function Epilogue Library Code <system>: Function Prologue Function Epilogue <XYZ_function>: POP {R0} POP {PC} Environment Variables $SHELL = "/bin/sh" Program Memory 41

42 Stack Adversary Return Address SFP & Other Regs. Local Buffer Buffer[80] sp Program Code <main>: BLX echo() <echo>: Function Prologue BLX gets(buffer), Function Epilogue Library Code <system>: Function Prologue Function Epilogue <XYZ_function>: POP {R0} POP {PC} Environment Variables $SHELL = "/bin/sh" Program Memory 42

43 Adversary Corrupt Control Structures Stack Pointer to system Pointer to $SHELL Return Pointer Address to XYZ SFP PATTERN & Other Regs. 2 Local Buffer PATTERN 1 Buffer[80] sp Program Code Library Code <main>: BLX echo() <echo>: Function Prologue BLX gets(buffer), Function Epilogue <system>: Function Prologue Function Epilogue <XYZ_function>: POP {R0} POP {PC} Environment Variables $SHELL = "/bin/sh" Program Memory 43

44 Adversary Stack Pointer to system Pointer to $SHELL Return Pointer Address to XYZ SFP PATTERN & Other Regs. 2 Local Buffer PATTERN 1 Buffer[80] sp echo() now returns! Program Code <main>: BLX echo() <echo>: Function Prologue BLX gets(buffer), Function Epilogue Library Code <system>: Function Prologue Function Epilogue <XYZ_function>: POP {R0} POP {PC} Environment Variables $SHELL = "/bin/sh" Program Memory 44

45 Adversary Stack Pointer to system Pointer to $SHELL Return Pointer Address to XYZ SFP PATTERN & Other Regs. 2 Local Buffer PATTERN 1 Buffer[80] sp Load argument in R0, i.e., address to /bin/sh string is loaded into R0 Program Code <main>: BLX echo() <echo>: Function Prologue BLX gets(buffer), Function Epilogue Library Code <system>: Function Prologue Function Epilogue <XYZ_function>: POP {R0} POP {PC} Environment Variables $SHELL = "/bin/sh" Program Memory 45

46 Adversary Stack Pointer to system Pointer to $SHELL Return Pointer Address to XYZ SFP PATTERN & Other Regs. 2 Local Buffer PATTERN 1 Buffer[80] sp Execution is now redirected to system Program Code <main>: BLX echo() <echo>: Function Prologue BLX gets(buffer), Function Epilogue Library Code <system>: Function Prologue Function Epilogue <XYZ_function>: POP {R0} POP {PC} Environment Variables $SHELL = "/bin/sh" Program Memory 46

47 Adversary Stack Pointer to system Pointer to $SHELL Return Pointer Address to XYZ Saved PATTERN Base Pointer 2 Local Buffer PATTERN 1 Buffer[80] sp system ( /bin/sh ) executed The stackisalso changedby system, but thisisnot shown here Program Code <main>: BLX echo() <echo>: Function Prologue BLX gets(buffer), Function Epilogue Library Code <system>: Function Prologue Function Epilogue <XYZ>: POP {R0} POP {PC} Environment Variables $SHELL = "/bin/sh" Program Memory 47

48 Return into libc attacks bypass security mechanisms such as the W ^ X model, but suffer from the following restrictions The adversary relies on functions available in libc. Hence, the designers of libc could eliminate critical functions such as system(). The adversary can only invoke one function after the other. Hence, no branching is possible 48

49 Inject malicious code Call any library functions Modify the original code 49 49

50 Re t u r n o r ien ted Pro g ra mm ing 50 50

51 Return oriented Programming Are there any attacks using this techique? 51 51

52 2007 Intel x SPARC Atmel AVR 2009 Z80 PowerPc ARM 2010 Internet Explorer Apple Jailbreak Adobe Reader Quicktime Player 52 52

53 Video:

54 Request /iphone3,1_4.0.pdf 1) Exploit PDF Viewer Vulnerability by means of Return Oriented Programming 2) Start Jailbreak 3) Download required system files 4) Jailbreak Done 54 54

55 User visits adversary web page Malicious webpage with embedded ROP payload SMS Database leaked to adversary 55 55

56 Attack Technique How does Return oriented Programming work? 56 56

57 Perform arbitrary computation with return into libc techniques Approach Use small instruction sequences (e.g., of libc) instead of using whole functions Instruction sequences range from 2 to 5 instructions All sequences end with a return instruction Instruction sequences are chained together to a gadget A gadget performs a particular task (e.g., load, store, xor, or branch) Afterwards, the adversary enforces his desired actions by combining the gadgets 57

58 Adversary 1 Corrupt Control Structures Data Stack Return Address 3 Return Address Return Address 1 Libraries Instruction sequence Return Instruction sequence Return Instruction sequence Return sp Code Program Memory 58 58

59 Instruction sequences never intended by the programmer Get new code out of existing code Possible due to Unaligned Memory Access Variable Length Instructions B Start interpretation of Byte Stream two Bytes later E9 C3 E9 C3 F8 FF FF Intended Code mov $0x13,%eax jmp 3aae9 Unintended Code add %al,(%eax) add %ch,%cl ret 59 59

60 Gadget Example Loading a word to memory 60 60

61 Goal: Load the word 0xDEADBEEF (pointed to by 0x8010ABCD) into the register r1 Note that return stands for POP {PC} in this example 61

62 Goal: Load the word 0xDEADBEEF (pointed to by 0x8010ABCD) into the register r1 Note that return stands for POP {PC} in this example 62

63 Goal: Load the word 0xDEADBEEF (pointed to by 0x8010ABCD) into the register r1 Note that return stands for POP {PC} in this example 63

64 Goal: Load the word 0xDEADBEEF (pointed to by 0x8010ABCD) into the register r1 pop {r1} Note that return stands for POP {PC} in this example 64

Runtime attacks are major threats to today's applications Control-flow of an application is compromised at runtime Typically, runtime attacks include

Runtime attacks are major threats to today's applications Control-flow of an application is compromised at runtime Typically, runtime attacks include 2 Runtime attacks are major threats to today's applications Control-flow of an application is compromised at runtime Typically, runtime attacks include injection of malicious code Reasons for runtime attacks

More information

Selected background on ARM registers, stack layout, and calling convention

Selected background on ARM registers, stack layout, and calling convention Selected background on ARM registers, stack layout, and calling convention ARM Overview ARM stands for Advanced RISC Machine Main application area: Mobile phones, smartphones (Apple iphone, Google Android),

More information

2 Sadeghi, Davi TU Darmstadt 2012 Secure, Trusted, and Trustworthy Computing Chapter 6: Runtime Attacks

2 Sadeghi, Davi TU Darmstadt 2012 Secure, Trusted, and Trustworthy Computing Chapter 6: Runtime Attacks Runtime attacks are major threats to today's applications Control-flow of an application is compromised at runtime Typically, runtime attacks include injection of malicious code Reasons for runtime attacks

More information

Inject malicious code Call any library functions Modify the original code

Inject malicious code Call any library functions Modify the original code Inject malicious code Call any library functions Modify the original code 2 Sadeghi, Davi TU Darmstadt 2012 Secure, Trusted, and Trustworthy Computing Chapter 6: Runtime Attacks 2 3 Sadeghi, Davi TU Darmstadt

More information

Stephen Checkoway, Lucas Davi, Alexandra Dmitrienko, Ahmad-Reza Sadeghi, Hovav Shacham, Marcel Winandy. ACM CCS 2010, Chicago, USA

Stephen Checkoway, Lucas Davi, Alexandra Dmitrienko, Ahmad-Reza Sadeghi, Hovav Shacham, Marcel Winandy. ACM CCS 2010, Chicago, USA Stephen Checkoway, Lucas Davi, Alexandra Dmitrienko, Ahmad-Reza Sadeghi, Hovav Shacham, Marcel Winandy ACM CCS 2010, Chicago, USA Ad hoc defense against code injection: W X DEP Code injection unnecessary

More information

CMPSC 497 Buffer Overflow Vulnerabilities

CMPSC 497 Buffer Overflow Vulnerabilities Systems and Internet Infrastructure Security Network and Security Research Center Department of Computer Science and Engineering Pennsylvania State University, University Park PA CMPSC 497 Buffer Overflow

More information

Exercise 6: Buffer Overflow and return-into-libc Attacks

Exercise 6: Buffer Overflow and return-into-libc Attacks Technische Universität Darmstadt Fachbereich Informatik System Security Lab Prof. Dr.-Ing. Ahmad-Reza Sadeghi M.Sc. David Gens Exercise 6: Buffer Overflow and return-into-libc Attacks Course Secure, Trusted

More information

CSE 509: Computer Security

CSE 509: Computer Security CSE 509: Computer Security Date: 2.16.2009 BUFFER OVERFLOWS: input data Server running a daemon Attacker Code The attacker sends data to the daemon process running at the server side and could thus trigger

More information

Basic Buffer Overflows

Basic Buffer Overflows Operating Systems Security Basic Buffer Overflows (Stack Smashing) Computer Security & OS lab. Cho, Seong-je ( 조성제 ) Fall, 2018 sjcho at dankook.ac.kr Chapter 10 Buffer Overflow 2 Contents Virtual Memory

More information

Robust Shell Code Return Oriented Programming and HeapSpray. Zhiqiang Lin

Robust Shell Code Return Oriented Programming and HeapSpray. Zhiqiang Lin CS 6V81-05: System Security and Malicious Code Analysis Robust Shell Code Return Oriented Programming and HeapSpray Zhiqiang Lin Department of Computer Science University of Texas at Dallas April 16 th,

More information

Return-orientated Programming

Return-orientated Programming Return-orientated Programming or The Geometry of Innocent Flesh on the Bone: Return-into-libc without Function Calls (on the x86) Hovav Shacham, CCS '07 Return-Oriented oriented Programming programming

More information

CSC 591 Systems Attacks and Defenses Return-into-libc & ROP

CSC 591 Systems Attacks and Defenses Return-into-libc & ROP CSC 591 Systems Attacks and Defenses Return-into-libc & ROP Alexandros Kapravelos akaprav@ncsu.edu NOEXEC (W^X) 0xFFFFFF Stack Heap BSS Data 0x000000 Code RW RX Deployment Linux (via PaX patches) OpenBSD

More information

Outline. Memory Exploit

Outline. Memory Exploit Outline CS 6V81-05: System Security and Malicious Code Analysis Robust Shell Code Return Oriented Programming and HeapSpray Zhiqiang Lin Department of Computer Science University of Texas at Dallas April

More information

The Geometry of Innocent Flesh on the Bone

The Geometry of Innocent Flesh on the Bone The Geometry of Innocent Flesh on the Bone Return-into-libc without Function Calls (on the x86) Hovav Shacham hovav@cs.ucsd.edu CCS 07 Technical Background Gadget: a short instructions sequence (e.x. pop

More information

CS 161 Computer Security

CS 161 Computer Security Paxson Spring 2017 CS 161 Computer Security Discussion 2 Question 1 Software Vulnerabilities (15 min) For the following code, assume an attacker can control the value of basket passed into eval basket.

More information

Module: Return-oriented Programming. Professor Trent Jaeger. CSE543 - Introduction to Computer and Network Security

Module: Return-oriented Programming. Professor Trent Jaeger. CSE543 - Introduction to Computer and Network Security CSE543 - Introduction to Computer and Network Security Module: Return-oriented Programming Professor Trent Jaeger 1 Anatomy of Control-Flow Exploits 2 Anatomy of Control-Flow Exploits Two steps in control-flow

More information

CSE 127 Computer Security

CSE 127 Computer Security CSE 127 Computer Security Alex Gantman, Spring 2018, Lecture 4 Low Level Software Security II: Format Strings, Shellcode, & Stack Protection Review Function arguments and local variables are stored on

More information

Advanced Buffer Overflow

Advanced Buffer Overflow Pattern Recognition and Applications Lab Advanced Buffer Overflow Ing. Davide Maiorca, Ph.D. davide.maiorca@diee.unica.it Computer Security A.Y. 2016/2017 Department of Electrical and Electronic Engineering

More information

CSE 127: Computer Security. Memory Integrity. Kirill Levchenko

CSE 127: Computer Security. Memory Integrity. Kirill Levchenko CSE 127: Computer Security Memory Integrity Kirill Levchenko November 18, 2014 Stack Buffer Overflow Stack buffer overflow: writing past end of a stackallocated buffer Also called stack smashing One of

More information

Beyond Stack Smashing: Recent Advances in Exploiting. Jonathan Pincus(MSR) and Brandon Baker (MS)

Beyond Stack Smashing: Recent Advances in Exploiting. Jonathan Pincus(MSR) and Brandon Baker (MS) Beyond Stack Smashing: Recent Advances in Exploiting Buffer Overruns Jonathan Pincus(MSR) and Brandon Baker (MS) Buffer Overflows and How they Occur Buffer is a contiguous segment of memory of a fixed

More information

Practical Malware Analysis

Practical Malware Analysis Practical Malware Analysis Ch 4: A Crash Course in x86 Disassembly Revised 1-16-7 Basic Techniques Basic static analysis Looks at malware from the outside Basic dynamic analysis Only shows you how the

More information

CS 161 Computer Security

CS 161 Computer Security Paxson Spring 2011 CS 161 Computer Security Discussion 1 January 26, 2011 Question 1 Buffer Overflow Mitigations Buffer overflow mitigations generally fall into two categories: (i) eliminating the cause

More information

Course Administration

Course Administration Fall 2018 EE 3613: Computer Organization Chapter 2: Instruction Set Architecture Introduction 4/4 Avinash Karanth Department of Electrical Engineering & Computer Science Ohio University, Athens, Ohio 45701

More information

Stack Vulnerabilities. CS4379/5375 System Security Assurance Dr. Jaime C. Acosta

Stack Vulnerabilities. CS4379/5375 System Security Assurance Dr. Jaime C. Acosta 1 Stack Vulnerabilities CS4379/5375 System Security Assurance Dr. Jaime C. Acosta Part 1 2 3 An Old, yet Still Valid Vulnerability Buffer/Stack Overflow ESP Unknown Data (unused) Unknown Data (unused)

More information

Lecture 08 Control-flow Hijacking Defenses

Lecture 08 Control-flow Hijacking Defenses Lecture 08 Control-flow Hijacking Defenses Stephen Checkoway University of Illinois at Chicago CS 487 Fall 2017 Slides adapted from Miller, Bailey, and Brumley Control Flow Hijack: Always control + computation

More information

SoK: Eternal War in Memory

SoK: Eternal War in Memory SoK: Eternal War in Memory László Szekeres, Mathias Payer, Tao Wei, Dawn Song Presenter: Wajih 11/7/2017 Some slides are taken from original S&P presentation 1 What is SoK paper? Systematization of Knowledge

More information

Buffer overflow background

Buffer overflow background and heap buffer background Comp Sci 3600 Security Heap Outline and heap buffer Heap 1 and heap 2 3 buffer 4 5 Heap Outline and heap buffer Heap 1 and heap 2 3 buffer 4 5 Heap Address Space and heap buffer

More information

CNIT 127: Exploit Development. Ch 1: Before you begin. Updated

CNIT 127: Exploit Development. Ch 1: Before you begin. Updated CNIT 127: Exploit Development Ch 1: Before you begin Updated 1-14-16 Basic Concepts Vulnerability A flaw in a system that allows an attacker to do something the designer did not intend, such as Denial

More information

Security and Privacy in Computer Systems. Lecture 5: Application Program Security

Security and Privacy in Computer Systems. Lecture 5: Application Program Security CS 645 Security and Privacy in Computer Systems Lecture 5: Application Program Security Buffer overflow exploits More effective buffer overflow attacks Preventing buffer overflow attacks Announcement Project

More information

Security Workshop HTS. LSE Team. February 3rd, 2016 EPITA / 40

Security Workshop HTS. LSE Team. February 3rd, 2016 EPITA / 40 Security Workshop HTS LSE Team EPITA 2018 February 3rd, 2016 1 / 40 Introduction What is this talk about? Presentation of some basic memory corruption bugs Presentation of some simple protections Writing

More information

CSE 127 Computer Security

CSE 127 Computer Security CSE 127 Computer Security Stefan Savage, Fall 2018, Lecture 4 Low Level Software Security II: Format Strings, Shellcode, & Stack Protection Review Function arguments and local variables are stored on the

More information

CSE 127 Computer Security

CSE 127 Computer Security CSE 127 Computer Security Stefan Savage, Spring 2018, Lecture 4 Low Level Software Security II: Format Strings, Shellcode, & Stack Protection Review Function arguments and local variables are stored on

More information

MoCFI: A Framework to Mitigate Control-Flow Attacks on Smartphones

MoCFI: A Framework to Mitigate Control-Flow Attacks on Smartphones MoCFI: A Framework to Mitigate Control-Flow Attacks on Smartphones Lucas Davi 1, Alexandra Dmitrienko 2, Manuel Egele 3, Thomas Fischer 4, Thorsten Holz 4, Ralf Hund 4, Stefan Nürnberger 1, Ahmad-Reza

More information

Software Security II: Memory Errors - Attacks & Defenses

Software Security II: Memory Errors - Attacks & Defenses 1 Software Security II: Memory Errors - Attacks & Defenses Chengyu Song Slides modified from Dawn Song 2 Administrivia Lab1 Writeup 3 Buffer overflow Out-of-bound memory writes (mostly sequential) Allow

More information

Buffer Overflow Attack (AskCypert CLaaS)

Buffer Overflow Attack (AskCypert CLaaS) Buffer Overflow Attack (AskCypert CLaaS) ---------------------- BufferOverflow.c code 1. int main(int arg c, char** argv) 2. { 3. char name[64]; 4. printf( Addr;%p\n, name); 5. strcpy(name, argv[1]); 6.

More information

Advanced Buffer Overflow

Advanced Buffer Overflow Pattern Recognition and Applications Lab Advanced Buffer Overflow Ing. Davide Maiorca, Ph.D. davide.maiorca@diee.unica.it Computer Security A.Y. 2017/2018 Department of Electrical and Electronic Engineering

More information

Runtime Attacks: Buffer Overflow and Return-Oriented Programming

Runtime Attacks: Buffer Overflow and Return-Oriented Programming Runtime Attacks: Buffer Overflow and Prof. Dr.-Ing. Ahmad-Reza Sadeghi M.Sc. Lucas Davi Course Secure, Trusted and Trustworthy Computing, Part 1 System Security Lab http://trust.cased.de Technische Universität

More information

Runtime Integrity Checking for Exploit Mitigation on Embedded Devices

Runtime Integrity Checking for Exploit Mitigation on Embedded Devices Runtime Integrity Checking for Exploit Mitigation on Embedded Devices Matthias Neugschwandtner IBM Research, Zurich eug@zurich.ibm.com Collin Mulliner Northeastern University, Boston collin@mulliner.org

More information

Inline Reference Monitoring Techniques

Inline Reference Monitoring Techniques Inline Reference Monitoring Techniques In the last lecture, we started talking about Inline Reference Monitors. The idea is that the policy enforcement code runs with the same address space as the code

More information

String Oriented Programming Exploring Format String Attacks. Mathias Payer

String Oriented Programming Exploring Format String Attacks. Mathias Payer String Oriented Programming Exploring Format String Attacks Mathias Payer Motivation Additional protection mechanisms prevent many existing attack vectors Format string exploits are often overlooked Drawback:

More information

Control-Flow Attacks and Defenses

Control-Flow Attacks and Defenses Lecture Embedded System Security Summer Term 2016 Control-Flow Attacks and Defenses Prof. Dr.-Ing. Ahmad-Reza Sadeghi Dr.-Ing. Lucas Davi CRISP, Technische Universität Darmstadt Intel Collaborative Research

More information

CS356: Discussion #6 Assembly Procedures and Arrays. Marco Paolieri

CS356: Discussion #6 Assembly Procedures and Arrays. Marco Paolieri CS356: Discussion #6 Assembly Procedures and Arrays Marco Paolieri (paolieri@usc.edu) Procedures Functions are a key abstraction in software They break down a problem into subproblems. Reusable functionality:

More information

Lecture 4 September Required reading materials for this class

Lecture 4 September Required reading materials for this class EECS 261: Computer Security Fall 2007 Lecture 4 September 6 Lecturer: David Wagner Scribe: DK Moon 4.1 Required reading materials for this class Beyond Stack Smashing: Recent Advances in Exploiting Buffer

More information

Buffer Overflows Defending against arbitrary code insertion and execution

Buffer Overflows Defending against arbitrary code insertion and execution www.harmonysecurity.com info@harmonysecurity.com Buffer Overflows Defending against arbitrary code insertion and execution By Stephen Fewer Contents 1 Introduction 2 1.1 Where does the problem lie? 2 1.1.1

More information

20: Exploits and Containment

20: Exploits and Containment 20: Exploits and Containment Mark Handley Andrea Bittau What is an exploit? Programs contain bugs. These bugs could have security implications (vulnerabilities) An exploit is a tool which exploits a vulnerability

More information

Code with red border means vulnerable code. Code with green border means corrected code. This program asks the user for a password with the function

Code with red border means vulnerable code. Code with green border means corrected code. This program asks the user for a password with the function 1 Code with red border means vulnerable code. Code with green border means corrected code. This program asks the user for a password with the function IsPasswordOK(), and compares it with the correct password.

More information

CNIT 127: Exploit Development. Ch 14: Protection Mechanisms. Updated

CNIT 127: Exploit Development. Ch 14: Protection Mechanisms. Updated CNIT 127: Exploit Development Ch 14: Protection Mechanisms Updated 3-25-17 Topics Non-Executable Stack W^X (Either Writable or Executable Memory) Stack Data Protection Canaries Ideal Stack Layout AAAS:

More information

CS24: INTRODUCTION TO COMPUTING SYSTEMS. Spring 2018 Lecture 4

CS24: INTRODUCTION TO COMPUTING SYSTEMS. Spring 2018 Lecture 4 CS24: INTRODUCTION TO COMPUTING SYSTEMS Spring 2018 Lecture 4 LAST TIME Enhanced our processor design in several ways Added branching support Allows programs where work is proportional to the input values

More information

Exploits and gdb. Tutorial 5

Exploits and gdb. Tutorial 5 Exploits and gdb Tutorial 5 Exploits and gdb 1. Buffer Vulnerabilities 2. Code Injection 3. Integer Attacks 4. Advanced Exploitation 5. GNU Debugger (gdb) Buffer Vulnerabilities Basic Idea Overflow or

More information

Part 7. Stacks. Stack. Stack. Examples of Stacks. Stack Operation: Push. Piles of Data. The Stack

Part 7. Stacks. Stack. Stack. Examples of Stacks. Stack Operation: Push. Piles of Data. The Stack Part 7 Stacks The Stack Piles of Data Stack Stack A stack is an abstract data structure that stores objects Based on the concept of a stack of items like a stack of dishes Data can only be added to or

More information

Module: Return-oriented Programming. Professor Trent Jaeger. CSE543 - Introduction to Computer and Network Security

Module: Return-oriented Programming. Professor Trent Jaeger. CSE543 - Introduction to Computer and Network Security CSE543 - Introduction to Computer and Network Security Module: Return-oriented Programming Professor Trent Jaeger 1 1 Anatomy of Control-Flow Exploits Two steps in control-flow exploitation First -- attacker

More information

CSE 565 Computer Security Fall 2018

CSE 565 Computer Security Fall 2018 CSE 565 Computer Security Fall 2018 Lecture 14: Software Security Department of Computer Science and Engineering University at Buffalo 1 Software Security Exploiting software vulnerabilities is paramount

More information

Defense against Code-injection, and Code-reuse Attack

Defense against Code-injection, and Code-reuse Attack Operating Systems Security Defense against Code-injection, and Code-reuse Attack Computer Security & OS lab. Cho, Seong-je ( 조성제 ) sjcho at dankook.ac.kr Fall, 2018 Contents Buffer Overflows: Stack Smashing,

More information

Stack Frames. September 2, Indiana University. Geoffrey Brown, Bryce Himebaugh 2015 September 2, / 15

Stack Frames. September 2, Indiana University. Geoffrey Brown, Bryce Himebaugh 2015 September 2, / 15 Stack Frames Geoffrey Brown Bryce Himebaugh Indiana University September 2, 2016 Geoffrey Brown, Bryce Himebaugh 2015 September 2, 2016 1 / 15 Outline Preserving Registers Saving and Restoring Registers

More information

Introduction to Operating Systems Prof. Chester Rebeiro Department of Computer Science and Engineering Indian Institute of Technology, Madras

Introduction to Operating Systems Prof. Chester Rebeiro Department of Computer Science and Engineering Indian Institute of Technology, Madras Introduction to Operating Systems Prof. Chester Rebeiro Department of Computer Science and Engineering Indian Institute of Technology, Madras Week 08 Lecture 38 Preventing Buffer Overflow Attacks Hello.

More information

Buffer overflows. Specific topics:

Buffer overflows. Specific topics: Buffer overflows Buffer overflows are possible because C does not check array boundaries Buffer overflows are dangerous because buffers for user input are often stored on the stack Specific topics: Address

More information

Buffer overflow prevention, and other attacks

Buffer overflow prevention, and other attacks Buffer prevention, and other attacks Comp Sci 3600 Security Outline 1 2 Two approaches to buffer defense Aim to harden programs to resist attacks in new programs Run time Aim to detect and abort attacks

More information

Software Vulnerabilities August 31, 2011 / CS261 Computer Security

Software Vulnerabilities August 31, 2011 / CS261 Computer Security Software Vulnerabilities August 31, 2011 / CS261 Computer Security Software Vulnerabilities...1 Review paper discussion...2 Trampolining...2 Heap smashing...2 malloc/free...2 Double freeing...4 Defenses...5

More information

Exploiting Stack Buffer Overflows Learning how blackhats smash the stack for fun and profit so we can prevent it

Exploiting Stack Buffer Overflows Learning how blackhats smash the stack for fun and profit so we can prevent it Exploiting Stack Buffer Overflows Learning how blackhats smash the stack for fun and profit so we can prevent it 29.11.2012 Secure Software Engineering Andreas Follner 1 Andreas Follner Graduated earlier

More information

CSE 127: Computer Security Control Flow Hijacking. Kirill Levchenko

CSE 127: Computer Security Control Flow Hijacking. Kirill Levchenko CSE 127: Computer Security Control Flow Hijacking Kirill Levchenko October 17, 2017 Control Flow Hijacking Defenses Avoid unsafe functions Stack canary Separate control stack Address Space Layout Randomization

More information

Program Security and Vulnerabilities Class 2

Program Security and Vulnerabilities Class 2 Program Security and Vulnerabilities Class 2 CEN-5079: 28.August.2017 1 Secure Programs Programs Operating System Device Drivers Network Software (TCP stack, web servers ) Database Management Systems Integrity

More information

Buffer Overflow Attacks

Buffer Overflow Attacks Buffer Overflow Attacks 1. Smashing the Stack 2. Other Buffer Overflow Attacks 3. Work on Preventing Buffer Overflow Attacks Smashing the Stack An Evil Function void func(char* inp){ } char buffer[16];

More information

Play with FILE Structure Yet Another Binary Exploitation Technique. Abstract

Play with FILE Structure Yet Another Binary Exploitation Technique. Abstract Play with FILE Structure Yet Another Binary Exploitation Technique An-Jie Yang (Angelboy) angelboy@chroot.org Abstract To fight against prevalent cyber threat, more mechanisms to protect operating systems

More information

This time. Defenses and other memory safety vulnerabilities. Everything you ve always wanted to know about gdb but were too afraid to ask

This time. Defenses and other memory safety vulnerabilities. Everything you ve always wanted to know about gdb but were too afraid to ask This time We will continue Buffer overflows By looking at Overflow Defenses and other memory safety vulnerabilities Everything you ve always wanted to know about gdb but were too afraid to ask Overflow

More information

EE4144: ARM Cortex-M Processor

EE4144: ARM Cortex-M Processor EE4144: ARM Cortex-M Processor EE4144 Fall 2014 EE4144 EE4144: ARM Cortex-M Processor Fall 2014 1 / 10 ARM Cortex-M 32-bit RISC processor Cortex-M4F Cortex-M3 + DSP instructions + floating point unit (FPU)

More information

Lecture 10 Code Reuse

Lecture 10 Code Reuse Lecture 10 Code Reuse Computer and Network Security 4th of December 2017 Computer Science and Engineering Department CSE Dep, ACS, UPB Lecture 10, Code Reuse 1/23 Defense Mechanisms static & dynamic analysis

More information

Module: Advanced Program Vulnerabilities and Defenses. Professor Trent Jaeger. CSE543 - Introduction to Computer and Network Security

Module: Advanced Program Vulnerabilities and Defenses. Professor Trent Jaeger. CSE543 - Introduction to Computer and Network Security CSE543 - Introduction to Computer and Network Security Module: Advanced Program Vulnerabilities and Defenses Professor Trent Jaeger 29 Anatomy of Control-Flow Exploits Two steps in control-flow exploitation

More information

Software Security: Buffer Overflow Defenses

Software Security: Buffer Overflow Defenses CSE 484 / CSE M 584: Computer Security and Privacy Software Security: Buffer Overflow Defenses Fall 2017 Franziska (Franzi) Roesner franzi@cs.washington.edu Thanks to Dan Boneh, Dieter Gollmann, Dan Halperin,

More information

CNIT 127: Exploit Development. Ch 3: Shellcode. Updated

CNIT 127: Exploit Development. Ch 3: Shellcode. Updated CNIT 127: Exploit Development Ch 3: Shellcode Updated 1-30-17 Topics Protection rings Syscalls Shellcode nasm Assembler ld GNU Linker objdump to see contents of object files strace System Call Tracer Removing

More information

Shellcode Analysis. Chapter 19

Shellcode Analysis. Chapter 19 Shellcode Analysis Chapter 19 What is Shellcode Shellcode a payload of raw executable code, attackers use this code to obtain interactive shell access. A binary chunk of data Can be generally referred

More information

Betriebssysteme und Sicherheit Sicherheit. Buffer Overflows

Betriebssysteme und Sicherheit Sicherheit. Buffer Overflows Betriebssysteme und Sicherheit Sicherheit Buffer Overflows Software Vulnerabilities Implementation error Input validation Attacker-supplied input can lead to Corruption Code execution... Even remote exploitation

More information

ROPdefender: A Detection Tool to Defend Against Return-Oriented Programming Attacks

ROPdefender: A Detection Tool to Defend Against Return-Oriented Programming Attacks ROPdefender: A Detection Tool to Defend Against Return-Oriented Programming Attacks Lucas Davi, Ahmad-Reza Sadeghi, Marcel Winandy ABSTRACT System Security Lab Technische Universität Darmstadt Darmstadt,

More information

INTRODUCTION TO EXPLOIT DEVELOPMENT

INTRODUCTION TO EXPLOIT DEVELOPMENT INTRODUCTION TO EXPLOIT DEVELOPMENT Nathan Ritchey and Michael Tucker Who Am I (Nathan Ritchey) Have Bachelors in Computer Science Member of CSG Working on Masters with focus on Information Assurance Some

More information

Module 8: Atmega32 Stack & Subroutine. Stack Pointer Subroutine Call function

Module 8: Atmega32 Stack & Subroutine. Stack Pointer Subroutine Call function Module 8: Atmega32 Stack & Subroutine Stack Pointer Subroutine Call function Stack Stack o Stack is a section of RAM used by the CPU to store information temporarily (i.e. data or address). o The CPU needs

More information

CSCE 548 Building Secure Software Buffer Overflow. Professor Lisa Luo Spring 2018

CSCE 548 Building Secure Software Buffer Overflow. Professor Lisa Luo Spring 2018 CSCE 548 Building Secure Software Buffer Overflow Professor Lisa Luo Spring 2018 Previous Class Virus vs. Worm vs. Trojan & Drive-by download Botnet & Rootkit Malware detection Scanner Polymorphic malware

More information

CS 645: Lecture 3 Software Vulnerabilities. Rachel Greenstadt July 3, 2013

CS 645: Lecture 3 Software Vulnerabilities. Rachel Greenstadt July 3, 2013 CS 645: Lecture 3 Software Vulnerabilities Rachel Greenstadt July 3, 2013 Project 1: Software exploits Individual project - done in virtual machine environment This assignment is hard. Don t leave it until

More information

MIPS Functions and Instruction Formats

MIPS Functions and Instruction Formats MIPS Functions and Instruction Formats 1 The Contract: The MIPS Calling Convention You write functions, your compiler writes functions, other compilers write functions And all your functions call other

More information

CSIS1120A. 10. Instruction Set & Addressing Mode. CSIS1120A 10. Instruction Set & Addressing Mode 1

CSIS1120A. 10. Instruction Set & Addressing Mode. CSIS1120A 10. Instruction Set & Addressing Mode 1 CSIS1120A 10. Instruction Set & Addressing Mode CSIS1120A 10. Instruction Set & Addressing Mode 1 Elements of a Machine Instruction Operation Code specifies the operation to be performed, e.g. ADD, SUB

More information

Buffer Overflow. Jin-Soo Kim Computer Systems Laboratory Sungkyunkwan University

Buffer Overflow. Jin-Soo Kim Computer Systems Laboratory Sungkyunkwan University Buffer Overflow Jin-Soo Kim (jinsookim@skku.edu) Computer Systems Laboratory Sungkyunkwan University http://csl.skku.edu x86-64/linux Memory Layout Stack Runtime stack (8MB limit) Heap Dynamically allocated

More information

CS 161 Computer Security. Week of January 22, 2018: GDB and x86 assembly

CS 161 Computer Security. Week of January 22, 2018: GDB and x86 assembly Raluca Popa Spring 2018 CS 161 Computer Security Discussion 1 Week of January 22, 2018: GDB and x86 assembly Objective: Studying memory vulnerabilities requires being able to read assembly and step through

More information

Secure Systems Engineering

Secure Systems Engineering Secure Systems Engineering Chester Rebeiro Indian Institute of Technology Madras Flaws that would allow an attacker access the OS flaw Bugs in the OS The Human factor Chester Rebeiro, IITM 2 Program Bugs

More information

SOEN228, Winter Revision 1.2 Date: October 25,

SOEN228, Winter Revision 1.2 Date: October 25, SOEN228, Winter 2003 Revision 1.2 Date: October 25, 2003 1 Contents Flags Mnemonics Basic I/O Exercises Overview of sample programs 2 Flag Register The flag register stores the condition flags that retain

More information

18-600: Recitation #4 Exploits

18-600: Recitation #4 Exploits 18-600: Recitation #4 Exploits 20th September 2016 Agenda More x86-64 assembly Buffer Overflow Attack Return Oriented Programming Attack 3 Recap: x86-64: Register Conventions Arguments passed in registers:

More information

Buffer Overflow. Jinkyu Jeong Computer Systems Laboratory Sungkyunkwan University

Buffer Overflow. Jinkyu Jeong Computer Systems Laboratory Sungkyunkwan University Buffer Overflow Jinkyu Jeong (jinkyu@skku.edu) Computer Systems Laboratory Sungkyunkwan University http://csl.skku.edu SSE2030: Introduction to Computer Systems, Spring 2018, Jinkyu Jeong (jinkyu@skku.edu)

More information

Outline. Format string attack layout. Null pointer dereference

Outline. Format string attack layout. Null pointer dereference CSci 5271 Introduction to Computer Security Day 5: Low-level defenses and counterattacks Stephen McCamant University of Minnesota, Computer Science & Engineering Null pointer dereference Format string

More information

Other array problems. Integer overflow. Outline. Integer overflow example. Signed and unsigned

Other array problems. Integer overflow. Outline. Integer overflow example. Signed and unsigned Other array problems CSci 5271 Introduction to Computer Security Day 4: Low-level attacks Stephen McCamant University of Minnesota, Computer Science & Engineering Missing/wrong bounds check One unsigned

More information

Control Hijacking Attacks

Control Hijacking Attacks Control Hijacking Attacks Alexandros Kapravelos kapravelos@ncsu.edu (Derived from slides from Chris Kruegel) Attacker s mindset Take control of the victim s machine Hijack the execution flow of a running

More information

Advanced Security for Systems Engineering VO 05: Advanced Attacks on Applications 2

Advanced Security for Systems Engineering VO 05: Advanced Attacks on Applications 2 Advanced Security for Systems Engineering VO 05: Advanced Attacks on Applications 2 Clemens Hlauschek, Christian Schanes INSO Industrial Software Institute of Information Systems Engineering Faculty of

More information

CMPSC 497: Midterm Review

CMPSC 497: Midterm Review CMPSC 497: Midterm Review Trent Jaeger Systems and Internet Infrastructure Security (SIIS) Lab Computer Science and Engineering Department Pennsylvania State University Page 1 Midterm Format True/False

More information

PRESENTED BY: SANTOSH SANGUMANI & SHARAN NARANG

PRESENTED BY: SANTOSH SANGUMANI & SHARAN NARANG PRESENTED BY: SANTOSH SANGUMANI & SHARAN NARANG Table of contents Introduction Binary Disassembly Return Address Defense Prototype Implementation Experimental Results Conclusion Buffer Over2low Attacks

More information

CSc 466/566. Computer Security. 20 : Operating Systems Application Security

CSc 466/566. Computer Security. 20 : Operating Systems Application Security 1/68 CSc 466/566 Computer Security 20 : Operating Systems Application Security Version: 2014/11/20 13:07:28 Department of Computer Science University of Arizona collberg@gmail.com Copyright c 2014 Christian

More information

BUFFER OVERFLOW. Jo, Heeseung

BUFFER OVERFLOW. Jo, Heeseung BUFFER OVERFLOW Jo, Heeseung IA-32/LINUX MEMORY LAYOUT Heap Runtime stack (8MB limit) Dynamically allocated storage When call malloc(), calloc(), new() DLLs (shared libraries) Data Text Dynamically linked

More information

Buffer Overflow. Jo, Heeseung

Buffer Overflow. Jo, Heeseung Buffer Overflow Jo, Heeseung IA-32/Linux Memory Layout Heap Runtime stack (8MB limit) Dynamically allocated storage When call malloc(), calloc(), new() DLLs (shared libraries) Data Text Dynamically linked

More information

IA-32 Architecture. CS 4440/7440 Malware Analysis and Defense

IA-32 Architecture. CS 4440/7440 Malware Analysis and Defense IA-32 Architecture CS 4440/7440 Malware Analysis and Defense Intel x86 Architecture } Security professionals constantly analyze assembly language code } Many exploits are written in assembly } Source code

More information

Systems Architecture The Stack and Subroutines

Systems Architecture The Stack and Subroutines Systems Architecture The Stack and Subroutines The Stack p. 1/9 The Subroutine Allow re-use of code Write (and debug) code once, use it many times A subroutine is called Subroutine will return on completion

More information

Università Ca Foscari Venezia

Università Ca Foscari Venezia Stack Overflow Security 1 2018-19 Università Ca Foscari Venezia www.dais.unive.it/~focardi secgroup.dais.unive.it Introduction Buffer overflow is due to careless programming in unsafe languages like C

More information

Sandboxing Untrusted Code: Software-Based Fault Isolation (SFI)

Sandboxing Untrusted Code: Software-Based Fault Isolation (SFI) Sandboxing Untrusted Code: Software-Based Fault Isolation (SFI) Brad Karp UCL Computer Science CS GZ03 / M030 9 th December 2011 Motivation: Vulnerabilities in C Seen dangers of vulnerabilities: injection

More information

Buffer overflows (a security interlude) Address space layout the stack discipline + C's lack of bounds-checking HUGE PROBLEM

Buffer overflows (a security interlude) Address space layout the stack discipline + C's lack of bounds-checking HUGE PROBLEM Buffer overflows (a security interlude) Address space layout the stack discipline + C's lack of bounds-checking HUGE PROBLEM x86-64 Linux Memory Layout 0x00007fffffffffff not drawn to scale Stack... Caller

More information

Lecture 7: Procedures and Program Execution Preview

Lecture 7: Procedures and Program Execution Preview Lecture 7: Procedures and Program Execution Preview CSE 30: Computer Organization and Systems Programming Winter 2010 Rajesh Gupta / Ryan Kastner Dept. of Computer Science and Engineering University of

More information

CSC 2400: Computing Systems. X86 Assembly: Function Calls

CSC 2400: Computing Systems. X86 Assembly: Function Calls CSC 24: Computing Systems X86 Assembly: Function Calls 1 Lecture Goals Challenges of supporting functions Providing information for the called function Function arguments and local variables Allowing the

More information