Creating User-Friendly Exploits

Similar documents
Multithreading and Interactive Programs

Exploiting the MSRPC Heap Overflow Part I

COMP 3430 Robert Guderian

Boot Camp. Dave Eckhardt Bruce Maggs

MSRPC Heap Overflow Part II

Reversed Buffer Overflow Cross Stack Attacks. Kris Kaspersky Endeavor Security, Inc.

CSE 153 Design of Operating Systems

Multithreading and Interactive Programs

Linked Lists. What is a Linked List?

Concurrency Control. Synchronization. Brief Preview of Scheduling. Motivating Example. Motivating Example (Cont d) Interleaved Schedules

UNIT:2. Process Management

CS 31: Introduction to Computer Systems : Threads & Synchronization April 16-18, 2019

Bypassing DEP with WPM & ROP Case Study : Audio Converter by D.R Software Exploit and Document by Sud0 sud0.x90 [ at ] gmail.com sud0 [at] corelan.

INFORMATION SECURITY - PRACTICAL ASSESSMENT - BASICS IN BUFFER EXPLOITATION

CSE 153 Design of Operating Systems Fall 2018

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

EECS 482 Introduction to Operating Systems

Last Class: Monitors. Real-world Examples

Chapter 6 - Deadlocks

Synchronization I. Jo, Heeseung

Debugging. CSE 2231 Supplement A Annatala Wolf

Overview. Rationale Division of labour between script and C++ Choice of language(s) Interfacing to C++ Performance, memory

Introduction to Concurrent Software Systems. CSCI 5828: Foundations of Software Engineering Lecture 08 09/17/2015

Chapter 1 Getting Started

David DeFlyer Class notes CS162 January 26 th, 2009

Threading Support for Byebug

Introduction to Concurrent Software Systems. CSCI 5828: Foundations of Software Engineering Lecture 12 09/29/2016

Stream States. Formatted I/O

1. With respect to space, linked lists are and arrays are.

So far, we know: Wednesday, October 4, Thread_Programming Page 1

The cow and Zaphod... Virtual Memory #2 Feb. 21, 2007

Processes. 4: Threads. Problem needs > 1 independent sequential process? Example: Web Server. Last Modified: 9/17/2002 2:27:59 PM

Deadlock. Concurrency: Deadlock and Starvation. Reusable Resources

Software Engineering at VMware Dan Scales May 2008

10 Strategies for Effective Marketing Campaigns

Debugging Applications in Pervasive Computing

Digital Forensics Lecture 02 PDF Structure

Overview. Rationale Division of labour between script and C++ Choice of language(s) Interfacing to C++

Here to take you beyond. ECEP Course syllabus. Emertxe Information Technologies ECEP course syllabus

Deviations are things that modify a thread s normal flow of control. Unix has long had signals, and these must be dealt with in multithreaded

1 Getting used to Python

CS 571 Operating Systems. Midterm Review. Angelos Stavrou, George Mason University

Deadlock CS 241. March 19, University of Illinois

Week 5, continued. This is CS50. Harvard University. Fall Cheng Gong

Operating Systems. Synchronization

1.1 For Fun and Profit. 1.2 Common Techniques. My Preferred Techniques

CS 153 Design of Operating Systems Winter 2016

CSE 374 Programming Concepts & Tools

Deadlocks. Copyright : University of Illinois CS 241 Staff 1

Learning Objectives. A Meta Comment. Exercise 1. Contents. From CS61Wiki

Debugging Page 1. Current context. Monday, October 15, :38 PM

Last week, David Terei lectured about the compilation pipeline which is responsible for producing the executable binaries of the Haskell code you

CS 31: Intro to Systems Threading & Parallel Applications. Kevin Webb Swarthmore College November 27, 2018

Getting to places from my house...

Virtual Memory #2 Feb. 21, 2018

Book keeping. Will post HW5 tonight. OK to work in pairs. Midterm review next Wednesday

Concurrency. Glossary

Capturing Network Traffic With Wireshark 2

Linked lists (6.5, 16)

Deadlocks. Copyright : University of Illinois CS 241 Staff 1

Lecture 9 Dynamic Compilation

Disciplina Sistemas de Computação

Introduction to the ThreadX Debugger Plugin for the IAR Embedded Workbench C-SPYDebugger

CMSC 330: Organization of Programming Languages

Is Exploitation Over? Bypassing Memory Protections in Windows 7

e-pg Pathshala Subject : Computer Science Paper: Embedded System Module: Embedded Software Development Tools Module No: CS/ES/36 Quadrant 1 e-text

CA31-1K DIS. Pointers. TA: You Lu

CSE 4/521 Introduction to Operating Systems. Lecture 29 Windows 7 (History, Design Principles, System Components, Programmer Interface) Summer 2018

Distributed Systems Operation System Support

Introduction to software exploitation ISSISP 2017

CS266 Software Reverse Engineering (SRE) Reversing and Patching Wintel Machine Code

MITOCW watch?v=9h6muyzjms0

Process Context & Interrupts. New process can mess up information in old process. (i.e. what if they both use the same register?)

DEBUGGING ON FERMI PREPARING A DEBUGGABLE APPLICATION GDB. GDB on front-end nodes

CS 241 Honors Memory

VEOS high level design. Revision 2.1 NEC

Erlang. Joe Armstrong.

PROCESSES AND THREADS THREADING MODELS. CS124 Operating Systems Winter , Lecture 8

The Stack, Free Store, and Global Namespace

18-642: Global Variables Are Evil!

University of Waterloo Midterm Examination Model Solution CS350 Operating Systems

Types II. Hwansoo Han

CS5460: Operating Systems

10/17/ Gribble, Lazowska, Levy, Zahorjan 2. 10/17/ Gribble, Lazowska, Levy, Zahorjan 4

CS 392/681 Lab 6 Experiencing Buffer Overflows and Format String Vulnerabilities

Synchronization. CS61, Lecture 18. Prof. Stephen Chong November 3, 2011

Operating Systems. Lecture3.2 - Deadlock Management. Golestan University. Hossein Momeni

Memory & Thread Debugger

High Reliability Systems. Lloyd Moore, President

MASSACHUSETTS INSTITUTE OF TECHNOLOGY Computer Systems Engineering: Spring Quiz I Solutions

Token Kidnapping. Cesar Cerrudo Argeniss

Tutorial: GNU Radio Companion

CS2351 Data Structures. Lecture 7: A Brief Review of Pointers in C

Welcome to Lab! Feel free to get started until we start talking! The lab document is located on the course website:

Heapple Pie. The macos/ios default heap. Date 14/09/2018. At Sthack 2018 By Eloi Benoist-Vanderbeken

Parallel Programming Languages COMP360

Jackson Marusarz Software Technical Consulting Engineer

CS 326: Operating Systems. Process Execution. Lecture 5

CS2141 Software Development using C/C++ Debugging


Transcription:

1 Creating User-Friendly Exploits Skylar Rampersaud skylar@immunityinc.com Security Research

2 What is a User-Friendly Exploit? An exploit that causes no distress to the user of the exploited program i.e., signs or symptoms

Why Should You Care? 3

4 Problem Statement Given an exploitable bug in a Windows application How can you execute arbitrary code such that: The application continues to run The application appears to run normally?

5 Some General Things Do as little as possible before returning control to the program Prevent the exploit from running again Logging Visual Cues

6 The Big Deal: Recovery Recovery is the shellcode we write to make the exploited process continue as if nothing unusual happened It's more than calling ExitThread()

7 Single-Threaded Processes Main thread Dead thread == Dead process

8 Multithreaded Process Main thread Input-handling thread Input-handling thread Input-handling thread

9 Multi-threaded, take 2 Multiple threads, but each one has specific functions Killing a thread won't kill the process But it will be severely disabled

10 Restarting/Replacing the Thread May not be feasible Thread creates windows Other threads holding handle to current thread

11 The Plan Identify a place to return control Release shared resources Find/fix data structures

12 Observe and Emulate Get cozy with your debugger

13 Example: Complete Stack Overwrite Upon gaining execution, the thread's stack is in bad shape Having the thread continue execution seems impossible

14 Challenges A (possibly large) number of functions have not completed due to exploitation What were those functions supposed to do? What resources are held that haven't been released? Where can we return control to the program?

15 Automating Cleanup We're looking at a labour-intensive, manual process Some elements can be automated

16 Immunity Debugger Since we'll be spending a lot of time with the debugger, an extensible framework is ideal Immunity Debugger allows you to create custom scripts and is freely available It uses the Python scripting language since it's flexible and easy to use

17 Finding the Message Pump There will be a place where the thread loops, waiting for indications that it has some work to do May be its own function May be in the thread's initial function

18 Automating Message Pump Finding We can do this manually Read the code in the thread's call stack Test hypotheses by setting breakpoints We can write an ID script Hook calls to PeekMessage or other communication functions

19 Finding C++ objects What objects does the message pump use? Where are they located (heap, stack,.data?) How does the message pump reference them?

20 Make It or Fake It A C++ object pointer was on the stack Can't locate it Allocate some memory Use a pointer to the actual function Or make your own

21 OS vs. Application Synchronization Windows provides a variety of objects: Mutexes, Semaphores Processes, Threads Input, Events, Notifications Waitable timers Applications can implement their own synchronization mechanisms

22 Recognizing Synchronization The process doesn't crash But it doesn't exactly work, either Variable checking at the beginning of functions Especially end if non-zero checks

23 Finding Synchronization Issues We can do this manually Read code that is executed by all other threads We can write an ID script Keep track of any objects being waited on Demo later!

24 Versioning Techniques described makes exploit more brittle Easier to break if something changes Remember, at this point we have code execution. Easy to check for exact versions of DLLs, etc.

Demo! 25

26 Conclusions Code execution is not the end of the story! ExitThread() and ExitProcess() aren't your only options Cleanup requires in-depth process knowledge Immunity Debugger offers tools to improve your shellcode-writing experience

27 Thank you for your time! Questions? Get Immunity Debugger at: http://www.immunityinc.com/products-immdbg.shtml Security Research Team