Bypassing Memory Protections: The Future of Exploitation



Similar documents
Bypassing Browser Memory Protections in Windows Vista

Custom Penetration Testing

風 水. Heap Feng Shui in JavaScript. Alexander Sotirov.

ASL IT SECURITY XTREME XPLOIT DEVELOPMENT

Bypassing Windows Hardware-enforced Data Execution Prevention

Defense in Depth: Protecting Against Zero-Day Attacks

Exploiting nginx chunked overflow bug, the undisclosed attack vector

Turn the Page: Why now is the time to migrate off Windows Server 2003

Software Vulnerability Exploitation Trends. Exploring the impact of software mitigations on patterns of vulnerability exploitation

Hotpatching and the Rise of Third-Party Patches

Reverse Engineering and Computer Security

Modern Binary Exploitation Course Syllabus

SECURITY B-SIDES: ATLANTA STRATEGIC PENETRATION TESTING. Presented by: Dave Kennedy Eric Smith

Attacking Host Intrusion Prevention Systems. Eugene Tsyrklevich

Windows Phone 7 Internals and Exploitability

MWR InfoSecurity Advisory. Interwoven Worksite ActiveX Control Remote Code Execution. 10 th March Contents

Sandy. The Malicious Exploit Analysis. Static Analysis and Dynamic exploit analysis. Garage4Hackers

I Control Your Code Attack Vectors Through the Eyes of Software-based Fault Isolation. Mathias Payer, ETH Zurich

Ivan Medvedev Principal Security Development Lead Microsoft Corporation

Adobe Flash Player and Adobe AIR security

Software security. Buffer overflow attacks SQL injections. Lecture 11 EIT060 Computer Security

OWASP Spain Barcelona 2014

Hacking your perimeter. Social-Engineering. Not everyone needs to use zero. David Kennedy (ReL1K) Twitter: Dave_ReL1K

Software Vulnerabilities

Format string exploitation on windows Using Immunity Debugger / Python. By Abysssec Inc

Buffer Overflows. Code Security: Buffer Overflows. Buffer Overflows are everywhere. 13 Buffer Overflow 12 Nov 2015

telnetd exploit FreeBSD Telnetd Remote Exploit Für Compass Security AG Öffentliche Version 1.0 Januar 2012

Enhanced Mitigation Experience Toolkit 5.1

MSc Computer Science Dissertation

Linux exploit development part 2 (rev 2) - Real app demo (part 2)

ERNW Newsletter 51 / September 2015

SoK: Eternal War in Memory

Why should I care about PDF application security?

CHAPTER 4 System Exploitation

An Analysis of Address Space Layout Randomization on Windows Vista

Payment Card Industry (PCI) Terminal Software Security. Best Practices

Introduction to Information Security

Application-Specific Attacks: Leveraging the ActionScript Virtual Machine

============================================================= =============================================================

EMET 4.0 PKI MITIGATION. Neil Sikka DefCon 21

3. Broken Account and Session Management. 4. Cross-Site Scripting (XSS) Flaws. Web browsers execute code sent from websites. Account Management

Background. How much does EMET cost? What is the license fee? EMET is freely available from Microsoft without material cost.

90% of data breaches are caused by software vulnerabilities.

Eugene Tsyrklevich. Ozone HIPS: Unbreakable Windows

C# and Other Languages

The Advantages of Block-Based Protocol Analysis for Security Testing

Advanced Endpoint Protection Overview

The Beast is Resting in Your Memory On Return-Oriented Programming Attacks and Mitigation Techniques To appear at USENIX Security & BlackHat USA, 2014

Last update: February 23, 2004

The SDL Progress Report. Progress reducing software vulnerabilities and developing threat mitigations at Microsoft

Security & Exploitation

Attacking x86 Windows Binaries by Jump Oriented Programming

Computer Security: Principles and Practice

Windows XP SP3 Registry Handling Buffer Overflow

How to Sandbox IIS Automatically without 0 False Positive and Negative

WHITEPAPER. Nessus Exploit Integration

Parasitics: The Next Generation. Vitaly Zaytsev Abhishek Karnik Joshua Phillips

CVE Adobe Flash Player Integer Overflow Vulnerability Analysis

CS412/CS413. Introduction to Compilers Tim Teitelbaum. Lecture 20: Stack Frames 7 March 08

United States Department of Agriculture

SYMANTEC ADVANCED THREAT RESEARCH. An Analysis of Address Space Layout Randomization on Windows Vista

Stitching the Gadgets On the Ineffectiveness of Coarse-Grained Control-Flow Integrity Protection

CSC 405 Introduction to Computer Security

Return-oriented programming without returns

CPA SECURITY CHARACTERISTIC ENTERPRISE MANAGEMENT OF DATA AT REST ENCRYPTION

Heap-based Buffer Overflow Vulnerability in Adobe Flash Player

esrever gnireenigne tfosorcim seiranib

Penetration Testing with Kali Linux

Internals of Windows Memory Management (not only) for Malware Analysis

CPA SECURITY CHARACTERISTIC SECURE VOIP CLIENT

API Monitoring System for Defeating Worms and Exploits in MS-Windows System

An Easier Way for Cross-Platform Data Acquisition Application Development

Chapter 1 Web Application (In)security 1

Criteria for web application security check. Version

To ensure you have the appropriate equipment and settings please review the following: Software and Hardware Recommendations.

Exploiting Trustzone on Android

Off-by-One exploitation tutorial

Creating a More Secure Device with Windows Embedded Compact 7. Douglas Boling Boling Consulting Inc.

UNCLASSIFIED CPA SECURITY CHARACTERISTIC WEB APPLICATION FIREWALLS. Version 1.3. Crown Copyright 2011 All Rights Reserved

CS Computer Security Thirteenth topic: System attacks. defenses

Using a Patched Vulnerability to Bypass Windows 8 x64 Driver Signature Enforcement. MJ0011 th_decoder@126.com

Coverity White Paper. Reduce Your Costs: Eliminate Critical Security Vulnerabilities with Development Testing

Unix Security Technologies. Pete Markowsky <peterm[at] ccs.neu.edu>

SkyRecon Cryptographic Module (SCM)

Secure Web Application Coding Team Introductory Meeting December 1, :00 2:00PM Bits & Pieces Room, Sansom West Room 306 Agenda

Client System Requirements for Brainloop Secure Dataroom as of Version 8.30

Abysssec Research. 1) Advisory information. 2) Vulnerable version

The Security Development Lifecycle. OWASP 24 June The OWASP Foundation

Anti-exploit tools: The next wave of enterprise security

Will Dormann: Sure. Fuzz testing is a way of testing an application in a way that you want to actually break the program.

White Paper. Java Security. What You Need to Know, and How to Protect Yourself

Practical taint analysis for protecting buggy binaries

Transcription:

Bypassing Memory Protections: The Future of Exploitation Alexander Sotirov alex@sotirov.net

About me Exploit development since 1999 Research into reliable exploitation techniques: Heap Feng Shui in JavaScript Bypassing browser memory protections on Windows Vista (with Mark Dowd) Part of the team that created a rogue CA using an MD5 collision last year

Definitions Exploit: a program that generates data to trigger a vulnerability and achieve reliable arbitrary code execution or subversion of the application logic This talk covers only exploits for memory corruption vulnerabilities.

difficulty Exploitation is getting harder reliable exploita.on finding vulnerabili.es 2004 200? year

Spending several man-months to turn a crash into an exploit is not unusual.

Overview of this talk Exploitation back in the summer of 2004 The evolution of exploit mitigations GS DEP ASLR SafeSEH State of the art in exploitation The future of exploitation

Part I The summer of 2004

State of exploitation in 2004 All major C vulnerability classes were already well known: stack overflows format string bugs heap overflows integer overflows, signedness issues Fuzzing made vulnerability discovery easy From the mid 1990s until 2004 we could exploit anything!

Stack overflows on Linux Linux single-threaded application with a static stack base address: NOP NOP NOP NOP NOP NOP NOP shellcode retaddr buffer overflow

Stack overflows on Windows Windows multi-threaded application, ntdll.dll loaded at a static base address: ntdll.dll jmp esp buffer retaddr shellcode buffer overflow

Stack overflows on Windows Windows SEH pointer overwrite followed by access violation before the function returns: ntdll.dll pop/pop/ret buffer SEH pointer shellcode buffer overflow

Format string bugs %n allows us to write an arbitrary 32-bit value to an arbitrary address: kernel32.dll func.on pointer shellcode Linux binary GOT shellcode

Heap overflows Heap unlink exploitation: BK = P->bk FD = P->fd kernel32.dll FD->bk = BK BK->fd = FD func.on pointer shellcode buffer heap block header fd bk buffer overflow

OS features we could rely on Fixed addresses of stack and executables we can place shellcode on the stack or jump through a jmp reg trampoline in a binary Function pointers at well-known locations great targets for arbitrary memory writes Heap allocator that trusts heap metadata generic way to turn heap overflows into arbitrary memory writes Executable data on the stack and heap easy to execute shellcode

The beginning of the end Windows XP SP2 (Aug 2004) Non-executable heap and stack Stack cookies Safe unlinking PEB randomization RHEL 3 Update 3 (Sept 2004) Non-executable heap and stack Randomization of libraries

Part II The Evolution of Exploit Mitigations

OS evolution

Exploit mitigations Detect memory corruption: GS stack cookies SEH chain validation (SEHOP) Heap corruption detection Stop common exploitation patterns: GS variable reordering SafeSEH DEP ASLR

GS stack cookies saved cookie buffer cookie retaddr buffer overflow

Breaking GS saved cookie buffer pointer var cookie retaddr pointer arg buffer overflow shellcode

GS variable reordering saved cookie copes of arguments non-buffer variables buffer cookie retaddr arguments (unused) buffer overflow pointer arguments are copied before the other variables

Breaking GS, round 2 Some function still use overwritten stack data before the cookie is checked: callee saved registers copy of pointer and string buffer arguments local variables string buffers gs cookie exception handler record saved frame pointer return address arguments stack frame of the caller o v e r f l o w

SafeSEH Validates that each SEH handler is found in the SafeSEH table of the DLL Prevents the exploitation of overwritten SEH records

Breaking SafeSEH Requires that all DLLs in the process are compiled with the new /SafeSEH option A single non-compatible DLL is enough to bypass the protection Control flow modification is still possible

SEH chain validation (SEHOP) Puts a cookie at the end of the SEH chain The exception dispatcher walks the chain and verifies that it ends with a cookie If an SEH record is overwritten, the SEH chain will break and will not end with the cookie No known bypass techniques

Data Execution Prevention Executing data allocated without the PAGE_EXECUTABLE flag now raises an access violation Stack and heap protected by default Prevents us from jumping to shellcode

Breaking DEP Off by default for compatibility reasons Compatibility problems with plugins: Internet Explorer 8 finally turned on DEP Sun JVM allocated its heap memory RWX, allowing us to write shellcode there Return oriented shellcode (ret2libc) DEP without ASLR is completely useless

ASLR Executables and DLLs loaded at random addresses Randomization of the heap and stack base addresses Prevents us from jumping to existing code

Breaking ASLR Enabled only for binaries compiled with a special flag (for compatibility reasons) Many browser plugins still don t have it Heap spraying still works ASLR without DEP is completely useless

Breaking ASLR Heap spraying defeats ASLR 64KB-aligned allocations allow us to put arbitrary data at an arbitrary address Allocate multiple 1MB strings, repeat a 64KB pattern 64KB 64KB

Part III State of the art in exploitation

Windows pre-xp SP2 Exploitation is trivial Multiple tools automate the process of analyzing a stack overflow crash and generating an exploit Nobody cares about these old systems

Windows XP SP2 The most widely targeted system in mass exploitation for botnets and keyloggers Attack surface reduction has reduced the number of vulnerabilities in services, but client software is almost completely unprotected Reliable exploitation techniques exist for almost all types of vulnerabilities

Windows Vista Limited deployment, not a target for mass exploitation yet More attack surface reduction in services, but client software still an easy target ASLR and DEP are very effective in theory, but backwards compatibility limitations severely weaken them

Windows 7 Minor exploit mitigation changes since Vista (as far as I know) Potential for a wide deployment Improved support for DEP and ASLR from Microsoft and third party vendors:.net framework 3.5 SP1 Internet Explorer 8 Adobe Reader 9 Flash 10 QuickTime 7.6

Part III The future of exploitation

Is exploitation over? What if all software used these protections to the fullest extent possible? Assume a Windows 7 system with the latest versions of all common browser plugins.

Partial overwrites Windows binaries are 64KB aligned ASLR only affects the top 16 bits Overwriting the low 16 bits of a pointer will shift it by up to 64KB to a known location inside the same DLL Exploitation is vulnerability specific

Memory disclosure If we can read memory from the process, we can bypass ASLR Even a single return address from the stack is enough to get the base of a DLL DEP can be bypassed with return oriented shellcode

ASLR entropy attacks ASLR on Windows provides only 8 bits of entropy If we can try an exploit 256 times, we can bypass ASLR by guessing the base address of a DLL DEP can be bypassed with return oriented shellcode

Virtual shellcode We can write our shellcode as a Java applet and use memory corruption to disable the Java bytecode verification No need to worry about DEP at all! Can be achieved by overwriting a single byte in the JVM ASLR makes it harder to find the JVM, but other attacks of this kind might be possible

Corrupting application data We can change the behavior of a program by corrupting its data without modifying the control flow Stack and heap overflows can corrupt data How do we find the right data to overwrite?

Directions for future research 1. Are there new classes of C or C++ vulnerabilities that lead to memory disclosure? Are there more general ways to get memory disclosure from the currently known vulnerability classes?

Directions for future research 2. Can we automate any of the manual analysis work required to exploit partial overwrites or data corruption vulnerabilities?

Directions for future research 3. Can we use static or dynamic binary analysis to improve our control over the memory layout of a process? How do we find all data in memory that is used by an authentication function? How do we ensure a heap block containing such data is allocated next to a heap block I can overflow? How do we get control over the value of an stack or heap variable that is used before initialization?

Part IV Conclusion

Conclusion Will the exploit mitigations really stop exploitation? We need a more research in this area Exploitation problems are hard If all else fails, web vulnerabilities will always be there!

Questions? alex@sotirov.net