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



Similar documents
Fine-Grained User-Space Security Through Virtualization. Mathias Payer and Thomas R. Gross ETH Zurich

Eugene Tsyrklevich. Ozone HIPS: Unbreakable Windows

Software Vulnerabilities

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

Full and Para Virtualization

Bypassing Memory Protections: The Future of Exploitation

Return-oriented programming without returns

secubt : Hacking the Hackers with User-Space Virtualization

Exploiting nginx chunked overflow bug, the undisclosed attack vector

Securing software by enforcing data-flow integrity

How to Sandbox IIS Automatically without 0 False Positive and Negative

Bypassing Browser Memory Protections in Windows Vista

MSc Computer Science Dissertation

CORE SECURITY. Exploiting Adobe Flash Player in the era of Control Flow Guard. Francisco Falcon Black Hat Europe 2015 November 12-13, 2015

SoK: Eternal War in Memory

Modern Binary Exploitation Course Syllabus

90% of data breaches are caused by software vulnerabilities.

Between Mutual Trust and Mutual Distrust: Practical Fine-grained Privilege Separation in Multithreaded Applications

Compromise-as-a-Service

Virtualization. Dr. Yingwu Zhu

Betriebssysteme KU Security

Abstract. 1. Introduction. 2. Threat Model

Google Apps Engine. G-Jacking AppEngine-based applications. Presented 30/05/2014. For HITB 2014 By Nicolas Collignon and Samir Megueddem

Hypervisors and Virtual Machines

Virtualization for Cloud Computing

Example of Standard API

Secure Software Programming and Vulnerability Analysis

Outline. Outline. Why virtualization? Why not virtualize? Today s data center. Cloud computing. Virtual resource pool

Defense in Depth: Protecting Against Zero-Day Attacks

Application Intrusion Detection

X05. An Overview of Source Code Scanning Tools. Loulwa Salem. Las Vegas, NV. IBM Corporation IBM System p, AIX 5L & Linux Technical University

Adobe Flash Player and Adobe AIR security

How To Trace

Secure In-VM Monitoring Using Hardware Virtualization

Safety measures in Linux

Virtualization System Security

VMkit A lightweight hypervisor library for Barrelfish

Hypervisors. Introduction. Introduction. Introduction. Introduction. Introduction. Credits:

ILR: Where d My Gadgets Go?

CS 377: Operating Systems. Outline. A review of what you ve learned, and how it applies to a real operating system. Lecture 25 - Linux Case Study

FRONT FLYLEAF PAGE. This page has been intentionally left blank

Practical Protection of Kernel Integrity for Commodity OS from Untrusted Extensions

Why should I care about PDF application security?

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

COS 318: Operating Systems

Visualizing Information Flow through C Programs

Security Overview of the Integrity Virtual Machines Architecture

Last Class: OS and Computer Architecture. Last Class: OS and Computer Architecture

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

Survey On Hypervisors

ERNW Newsletter 51 / September 2015

Cloud Computing. Up until now

Isolating Commodity Hosted Hypervisors with HyperLock

x86 ISA Modifications to support Virtual Machines

Chapter 5 Cloud Resource Virtualization

Basics of Virtualisation

Sandbox Roulette: Are you ready for the gamble?

Transparent Monitoring of a Process Self in a Virtual Environment

Virtual Switching Without a Hypervisor for a More Secure Cloud

Clouds, Virtualization and Security or Look Out Below

The Case for SE Android. Stephen Smalley Trust Mechanisms (R2X) National Security Agency

Enterprise Application Security Workshop Series

KITES TECHNOLOGY COURSE MODULE (C, C++, DS)

Homeland Security Red Teaming

Securing your Virtual Datacenter. Part 1: Preventing, Mitigating Privilege Escalation

1 The Java Virtual Machine

Integrated Network Vulnerability Scanning & Penetration Testing SAINTcorporation.com

CS 161 Computer Security

How To Write Security Enhanced Linux On Embedded Systems (Es) On A Microsoft Linux (Amd64) (Amd32) (A Microsoft Microsoft 2.3.2) (For Microsoft) (Or

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

QUIRE: : Lightweight Provenance for Smart Phone Operating Systems

Advanced Endpoint Protection Overview

Frontiers in Cyber Security: Beyond the OS

Hypervisor-Based, Hardware-Assisted System Monitoring

General Introduction

Data Structure Reverse Engineering

Hardware-Assisted Fine-Grained Control-Flow Integrity: Towards Efficient Protection of Embedded Systems Against Software Exploitation

CS5460: Operating Systems. Lecture: Virtualization 2. Anton Burtsev March, 2013

Automating Mimicry Attacks Using Static Binary Analysis

Lecture Overview. INF3510 Information Security Spring Lecture 4 Computer Security. Meaningless transport defences when endpoints are insecure

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

The Sandbox Roulette: are you ready to gamble? Rafal Wojtczuk Rahul Kashyap

Scaling in a Hypervisor Environment

Transcription:

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

Motivation Applications often vulnerable to security exploits Solution: restrict application access to the minimum amount of data needed Least privilege principle SCS3: 2011-05-12 Mathias Payer / ETH Zurich 2

In a nutshell Fine-grained virtualization layer confines security threats All executed code is verified Additional security guards are added to the runtime image All system calls are verified according to a tight policy SCS3: 2011-05-12 Mathias Payer / ETH Zurich 3

Outline Introduction Security architecture Evaluation Attack Vectors Related work Conclusion SCS3: 2011-05-12 Mathias Payer / ETH Zurich 4

Introduction Software security is a challenging problem Many different forms of attacks exist Low-level bugs are omni-present Current security practice is reactive We present a pro-active approach to security Catch exploits before they can cause any harm Application code Kernel SCS3: 2011-05-12 Mathias Payer / ETH Zurich 5

Protection through virtualization Use virtualization to confine and secure applications Use a user-space virtualization system Secure all code and authorize all system calls Application code Application code User-space SFI and Guards Kernel Kernel SCS3: 2011-05-12 Mathias Payer / ETH Zurich 6

Outline Introduction Security architecture Software-based fault isolation (SFI) System call interposition Evaluation Attack Vectors Related work Conclusion SCS3: 2011-05-12 Mathias Payer / ETH Zurich 7

Security Architecture libdetox < Application User-space process virtualization and fault isolation System call interposition framework < Handler functions & redirected system calls Configurable runtime policy Kernel space / OS Layered security concept User-space software-based fault isolation System call interposition framework System call authorization SCS3: 2011-05-12 Mathias Payer / ETH Zurich 8

Software-based fault isolation SFI implemented as a user-space library All code is translated before it is executed Code is checked and verified on the fly All unsafe instructions are encapsulated or rewritten Check targets and origins of control flow transfers Illegal instructions halt the program SCS3: 2011-05-12 Mathias Payer / ETH Zurich 9

SFI in a nutshell Translator Translates individual basic blocks Verifies code source / destination Checks branch targets and origins Original code 1 2 3 4 R Mapping table 1 1' 2 2' 3 3'... Indirect control flow transfers use a dynamic check to verify target and origin Code cache 1' 2' 3' RX SCS3: 2011-05-12 Mathias Payer / ETH Zurich 10

SFI: Additional guards Translator adds guards protect from malicious attacks against the SFI platform and enhances security guarantees Secure control flow transfers Signal handling Executable bit removal Address space layout randomization Protecting internal data structures SCS3: 2011-05-12 Mathias Payer / ETH Zurich 11

SFI: Control transfers Verify return addresses on stack Use a shadow stack to store original/translated addresses Protects from Return Oriented Programming Secure control flow transfers Check target and source locations for valid transfer points Protects from code injection through heapbased/stack-based overflows SCS3: 2011-05-12 Mathias Payer / ETH Zurich 12

SFI: Signal handling Catch signals and exceptions Redirect to installed handlers if signal is valid Protects from break-outs out of the sandbox SCS3: 2011-05-12 Mathias Payer / ETH Zurich 13

SFI: Executable bit removal Executable bit removed for libraries and application Only libdetox and code-cache contains executable code Part of the protection against code-injection SCS3: 2011-05-12 Mathias Payer / ETH Zurich 14

SFI: ASLR Address space layout randomization randomizes the runtime memory image Probabilistic measure that makes attack harder SCS3: 2011-05-12 Mathias Payer / ETH Zurich 15

SFI: Internal data structures All internal data structures are protected Context transfer to (translated) application code protects all internal data structures Write permissions to all internal memory is removed Protects from code-injection and attacks against the virtualization platform SCS3: 2011-05-12 Mathias Payer / ETH Zurich 16

SFI: Added protection These additional guards protect from Code injection (stack-based / heap-based) Return-oriented programming Execution of illegal code Attacks against the virtualization platform SCS3: 2011-05-12 Mathias Payer / ETH Zurich 17

Outline Introduction Security architecture Software-based fault isolation (SFI) System call interposition Evaluation Attack Vectors Related work Conclusion SCS3: 2011-05-12 Mathias Payer / ETH Zurich 18

System call interposition Implemented on top of SFI platform All system calls & parameters are checked Dangerous system calls are redirected to a special implementation inside the virtualization library System call authorization System calls are authorized based on a userdefinable per-process policy Protects from data attacks and privilege escalation SCS3: 2011-05-12 Mathias Payer / ETH Zurich 19

Policy System call definition:... 5: open(string, int) 6: close(int)... open: ("/etc/apache2/*", *): allow ("/var/www/*", *): allow ("*", *): deny close: (*): allow SCS3: 2011-05-12 Mathias Payer / ETH Zurich 20

Outline Introduction Security architecture Evaluation Attack Vectors Related work Conclusion SCS3: 2011-05-12 Mathias Payer / ETH Zurich 21

libdetox Approach implemented as a prototype Built on top of fastbt binary translation system Additional security hardening Guards implemented in the translation process Dynamic guards extend the dynamic control flow transfer logic SCS3: 2011-05-12 Mathias Payer / ETH Zurich 22

Apache2 Fully protected Apache 2.2.11 is evaluated using the ab benchmark Each file is received 1'000'000 times test.html (static, 1.7kB) phpinfo.php (small, dynamic PHP file) picture.png (static, 242 kb) All benchmarks were executed on Ubuntu 9.04 on an E6850 Intel Core2Duo CPU @ 3.00GHz, 2GB RAM and GCC version 4.3.3 SCS3: 2011-05-12 Mathias Payer / ETH Zurich 23

Apache2 25% Overhead 20% 15% 10% 5% 0% phpinfo.php Average test.html picture.png BT libdetox Throughput [mb/s] native BT libdetox test.html 22.5 19.6 18.8 phpinfo.php 3.28 2.80 2.73 picture.png 945 902 885 Average overhead - 9.3% 12% Low overhead for real-world server application Throughput highly depends on payload Both for virtualized and native executions SCS3: 2011-05-12 Mathias Payer / ETH Zurich 24

Outline Introduction Security architecture Evaluation Attack Vectors Code injection Return-oriented programming Format string attacks Related work Conclusion SCS3: 2011-05-12 Mathias Payer / ETH Zurich 25

Attack vectors Attacks redirect control flow New or alternate locations are reached Execution is different from unaltered run An attack exploits the fact that the programmer or the runtime system is unable to check the bounds of a buffer or to detect a type overflow or to detect an out-of-bounds access SCS3: 2011-05-12 Mathias Payer / ETH Zurich 26

Code injection Injects new executable code into the process image of a running process Into buffer on the stack Into heap-based data structures Redirects control flow to the injected code Overwriting the RIP (return instruction pointer) Overwriting function pointers, destructors, or data structures of the memory allocator SCS3: 2011-05-12 Mathias Payer / ETH Zurich 27

Code injection: libdetox perspective The BT would stop the program when the control flow transfer is detected Before the shellcode is even translated Two exceptions would be triggered Code is (about to be) executed in a non-executable area and Function call to an unexported/unknown symbol (heap-based exploit) or RIP mismatch (stack-based exploit) Use BT to analyze exploits/shellcode Catch new exploits and security holes Use debugging info in application to fix bugs Use BT to audit your own software / test your exploits SCS3: 2011-05-12 Mathias Payer / ETH Zurich 28

Return-oriented programming Exploit already existing code sequences Prepare the stack so that tails of library functions are executed one after another Stack-based overflow is used to prepare multiple stack invocation frames Control flow redirected to tails of library functions Tails can be used to execute arbitrary code Constraints Missing bound check for the initial stack-based overflow RIP must not be checked See: Return-Oriented Programming (Shacham, Black Hat'08) SCS3: 2011-05-12 Mathias Payer / ETH Zurich 29

ROP: libdetox perspective The BT would stop the program when the control flow transfer is detected Before the function tail or libc function is translated Shadow stack guard detects mismatch Real attacks chain multiple libc calls Can be used to inject code into the address space in a legal manner (use mprotect to update permissions) SCS3: 2011-05-12 Mathias Payer / ETH Zurich 30

Format string attack Exploit the parsing possibilities of the printf-family If a user-controlled string is passed to a printf function A combination of %x and %n in strings that are passed to printf unfiltered result in random memory reads and random memory writes Careful preparation of the input is needed The format string must be allowed to contain %n and, e.g., %x to write to memory Random writes can be used to redirect the control flow by overwriting, e.g., the RIP, destructors, or the vtable SCS3: 2011-05-12 Mathias Payer / ETH Zurich 31

Format string: libdetox perspective BT stops the program when the control flow is redirected Illegal control flow transfer Shadow stack guard or control flow guard System call guard checks system calls arguments Policy violations are detected and the program is stopped Random writes to memory only detectable with full memory tracking SCS3: 2011-05-12 Mathias Payer / ETH Zurich 32

Outline Introduction Security architecture Evaluation Attack Vectors Related work Conclusion SCS3: 2011-05-12 Mathias Payer / ETH Zurich 33

Related Work Full system translation (VMWare, QEMU, Xen) Virtualizes a complete system, management overhead, data sharing problem System call interposition (Janus, AppArmor) Only system calls checked, code is unchecked Software-based fault isolation (Vx32, Strata) Only a sandbox is not enough, additional guards and system call authorization needed Static binary translation (Google's NaCL) Limits the ISA, special compilers needed SCS3: 2011-05-12 Mathias Payer / ETH Zurich 34

Conclusions Combining SFI and policy-based system call authorization builds low overhead virtualization platform Virtualization based on programs, not systems System image is shared with a single configuration Fine-grained access control to data / properties Opens door to new approaches of security Highly customizable and dynamic SCS3: 2011-05-12 Mathias Payer / ETH Zurich 35

Questions? Libdetox as an implementation prototype supports full IA-32 ISA without kernel module Source: http://nebelwelt.net/projects/libdetox/ SCS3: 2011-05-12 Mathias Payer / ETH Zurich 36