libdft Practical Dynamic Data Flow Tracking for Commodity Systems - - PowerPoint PPT Presentation

libdft
SMART_READER_LITE
LIVE PREVIEW

libdft Practical Dynamic Data Flow Tracking for Commodity Systems - - PowerPoint PPT Presentation

Overview Design & Implementation Results & Discussion libdft Practical Dynamic Data Flow Tracking for Commodity Systems Vasileios P. Kemerlis Georgios Portokalidis Kangkook Jee Angelos D. Keromytis Network Security Lab Department of


slide-1
SLIDE 1

Overview Design & Implementation Results & Discussion

libdft

Practical Dynamic Data Flow Tracking for Commodity Systems Vasileios P. Kemerlis Georgios Portokalidis Kangkook Jee Angelos D. Keromytis

Network Security Lab Department of Computer Science Columbia University New York, NY, USA

Virtual Execution Environments (VEE), 03/04/2012

vpk@cs.columbia.edu Columbia University - Network Security Lab

slide-2
SLIDE 2

Overview Design & Implementation Results & Discussion

Outline

1

Overview Problem statement Contribution

2

Design & Implementation Definitions Design overview Implementation

3

Results & Discussion Performance Use cases Summary

vpk@cs.columbia.edu Columbia University - Network Security Lab

slide-3
SLIDE 3

Overview Design & Implementation Results & Discussion Problem statement Contribution

Dynamic data flow tracking (DFT)

What is it?

Tagging and tracking “interesting” data as they propagate during program execution Extremely popular research topic (also known as information flow tracking)

analyzing malware behavior [Portokalidis Eurosys’06] hardening software against zero-day attacks [Bosman RAID’11, Qin MICRO’06, Newsome NDSS’05] detecting and preventing information leaks [Zhu SIGOPS’11, Enck OSDI’10] debugging software misconfigurations [Attariyan OSDI’10]

vpk@cs.columbia.edu Columbia University - Network Security Lab

slide-4
SLIDE 4

Overview Design & Implementation Results & Discussion Problem statement Contribution

Related work

Architectural classification

Integrated into full system emulators and virtual machine monitors [Ho Eurosys’06, Portokalidis Eurosys’06, Myers POPL ’99] Retrofitted into unmodified binaries using dynamic binary instrumentation (DBI) [Qin MICRO’06] Added to source codebases using source-to-source code transformations [Xu USENIX Sec’06] Implemented in hardware [Venkataramani HPCA’08, Crandall MICRO’04, Suh ASPLOS’04]

vpk@cs.columbia.edu Columbia University - Network Security Lab

slide-5
SLIDE 5

Overview Design & Implementation Results & Discussion Problem statement Contribution

Related work (cont’d)

Issues & limitations

Ad hoc & problem-specific implementations high overhead, little reusability, limited applicability Attempts for flexible DFT systems Versatility comes at a high price TaintCheck [Newsome NDSS’05] → 20x overhead even for small utilities LIFT [Qin MICRO’06] → no multithreading support Minemu [Bosman RAID’11] → only 32-bit binaries Dytan [Clause ISSTA’07] → attempts to define a generic and reusable DFT framework, but incurs a slowdown of more than 30x

vpk@cs.columbia.edu Columbia University - Network Security Lab

slide-6
SLIDE 6

Overview Design & Implementation Results & Discussion Problem statement Contribution

libdft

Brief overview

DFT framework in the form of a shared library Features Fast → 1.14x – 10x slowdown Reusable → API for building custom DFT-powered tools Applicable to commodity hardware and software → supports multi-{process, threaded} x86 Linux applications, without requiring any modifications to the binaries or the underlying OS

vpk@cs.columbia.edu Columbia University - Network Security Lab

slide-7
SLIDE 7

Overview Design & Implementation Results & Discussion Definitions Design overview Implementation

DFT

Formalisms

Many aliases

Data flow tracking (DFT) Information flow tracking (IFT) Dynamic taint analysis (DTA) ...

Definition The process of accurately tracking the flow of selected data throughout the execution of a program or system

vpk@cs.columbia.edu Columbia University - Network Security Lab

slide-8
SLIDE 8

Overview Design & Implementation Results & Discussion Definitions Design overview Implementation

DFT (cont’d)

Basic aspects

DFT is characterized by 3 aspects

1

Data sources: program, or memory locations, where data

  • f interest enter the system and subsequently get tagged

2

Data tracking: process of propagating data tags according to program semantics

3

Data sinks: program, or memory locations, where checks for tagged data can be made

Note We strictly deal with explicit data flows

vpk@cs.columbia.edu Columbia University - Network Security Lab

slide-9
SLIDE 9

Overview Design & Implementation Results & Discussion Definitions Design overview Implementation

Design goal

Shared library for customized DFT Allow the creation of “meta-tools” that transparently employ DFT

PROCESS Pin libdft Pintool Process binary Other library Other library

...

MEMORY USER SPACE KERNEL SPACE Function calls Instructions System calls (I/O) mov ebx, 0x0a mov eax, [esp+0x10] call eax ... ... T agmap Code cache

Figure: Putting it altogether: Pin, libdft, process

vpk@cs.columbia.edu Columbia University - Network Security Lab

slide-10
SLIDE 10

Overview Design & Implementation Results & Discussion Definitions Design overview Implementation

Usage

libdft in a nutshell

1

Pin loads itself, libdft, and a libdft-enabled tool into the same address space with a process (Figure 1)

2

Before commencing or resuming execution, the libdft-tool defines the data sources and sinks by tapping arbitrary points of interest

3

User-defined callbacks drive the DFT process by tagging and untagging data, or checking and enforcing data use

vpk@cs.columbia.edu Columbia University - Network Security Lab

slide-11
SLIDE 11

Overview Design & Implementation Results & Discussion Definitions Design overview Implementation

Challenges

Achieving low overhead is hard

Size & structure of the analysis routines (i.e., DFT logic) matters Complex analysis code → excessive register spilling Certain types of instructions should be avoided altogether (e.g., test-and-branch, EFLAGS modifiers)

vpk@cs.columbia.edu Columbia University - Network Security Lab

slide-12
SLIDE 12

Overview Design & Implementation Results & Discussion Definitions Design overview Implementation

libdft

Prototype implementation

libdft has been implemented using Pin v2.9 Currently supports only x86 Linux binaries Consists of three main components (Figure 2)

1

Tagmap

2

Tracker

3

I/O interface

∼5000 LOC in C/C++

vpk@cs.columbia.edu Columbia University - Network Security Lab

slide-13
SLIDE 13

Overview Design & Implementation Results & Discussion Definitions Design overview Implementation

libdft

Architecture

R1: R2: Rn:

syscall_desc[]

pre_syscall post_syscall

libdft API

handle_sub handle_and handle_xor handle_cmov handle_lods handle_pop handle_push handle_cpuid ... ... handle_add r2m_xfer_opl() ...

Analysis routines

handle_or r2m_xfer_opw() r2r_alu_opl() r2r_alu_opw() r2r_alu_opb_l() m2r_alu_opb_h()

Pin API libdft backend

Instrumentation engine

vcpu mem_bitmap I/O Interface Tagmap Tracker STAB tseg tseg

Figure: The architecture of libdft

vpk@cs.columbia.edu Columbia University - Network Security Lab

slide-14
SLIDE 14

Overview Design & Implementation Results & Discussion Definitions Design overview Implementation

libdft

Tagmap

Stores the tags for every process Major impact on the overall performance → DFT logic constantly operates on data tags Tag format

Tagging granularity → byte Tag size → {1,8}-bit

Register tags

Per thread vcpu structure 8 general purpose registers (GPRs)

Memory tags

Per process mem bitmap, or STAB and tseg structures 1 bit/byte for every byte of addressable memory

vpk@cs.columbia.edu Columbia University - Network Security Lab

slide-15
SLIDE 15

Overview Design & Implementation Results & Discussion Definitions Design overview Implementation

libdft

Tracker

Instruments a program for retrofitting the DFT logic Instrumentation Engine

Invoked once for each sequence of instructions Handles the elaborate logic of discovering data dependencies → allows for compact and fast analysis code Inspects the instructions of a program Determines the analysis routines that should be injected before each instruction Allows for customization (libdft API)

Analysis Routines

Invoked every time a specific instruction is executed Contain code that implements the DFT logic Clear, assert, and propagate tags

vpk@cs.columbia.edu Columbia University - Network Security Lab

slide-16
SLIDE 16

Overview Design & Implementation Results & Discussion Definitions Design overview Implementation

libdft

I/O Interface

Handles the kernel ↔ process data pre syscall/post syscall → instrumentation stubs syscall desc[] → syscall meta-information table The stubs are invoked upon every system call entry/exit Allows the user to register callback functions (libdft API) The default behavior of the post syscall stub is to untag the data being written/returned by the system call Advantages Enables the customization of libdft by using I/O system calls as data sources and sinks arbitrarily Eliminates tag leaks by considering that some system calls write specific data to user-provided buffers

vpk@cs.columbia.edu Columbia University - Network Security Lab

slide-17
SLIDE 17

Overview Design & Implementation Results & Discussion Definitions Design overview Implementation

libdft

Optimizations

fast vcpu Uses a scratch-register to store a pointer to the vcpu structure of each thread fast rep Avoids recomputing the effective address (EA) on each repetition in REP-prefixed instructions huge tlb Uses huge pages for mem bitmap and STAB to minimize TLB poisoning tagmap col Collapses tseg structures that correspond to write-protected memory regions to a single constant segment

vpk@cs.columbia.edu Columbia University - Network Security Lab

slide-18
SLIDE 18

Overview Design & Implementation Results & Discussion Performance Use cases Summary

Performance evaluation

Testbed

2 identical hosts

2x 2.66GHz quad core Intel Xeon X5500 CPUs 24GB of RAM

4 Pintools

nullpin → runs a process over Pin libdft-unopt → Pin+libdft with no optimizations libdft-bit → Pin+libdft with optimizations and bit-sized tags libdft-byte → Pin+libdft with optimizations and byte-sized tags

Debian GNU/Linux v6 (squeeze), kernel version 2.6.32 Pin v2.9 (build 39586) GNU command-line utilities, Apache v2.2.16, MySQL v5.1.49, Firefox v3.6.18

vpk@cs.columbia.edu Columbia University - Network Security Lab

slide-19
SLIDE 19

Overview Design & Implementation Results & Discussion Performance Use cases Summary

Performance evaluation

Command-line utilities

1 2 3 4 5 6 7 8 9 10 11

tar archive gzip compress bzip2 compress tar extract gzip decompress bzip2 decompress scp 100Mbps scp 1Gbps

Slowdown (normalized runtime)

nullpin libdft-unopt libdft-bit libdft-byte

vpk@cs.columbia.edu Columbia University - Network Security Lab

slide-20
SLIDE 20

Overview Design & Implementation Results & Discussion Performance Use cases Summary

Performance evaluation

Apache web server

0.9 1 1.1 1.2 1.3 1.4 1.5 1.6 1.7 1.8 1.9 2 2.1 2.2 2.3 1KB 10KB 100KB 1MB Slowdown (normalized) File size 100 Mbps

nullpin libdft-unopt libdft-bit libdft-byte

0.9 1 1.1 1.2 1.3 1.4 1.5 1.6 1.7 1.8 1.9 2 2.1 2.2 2.3 1KB 10KB 100KB 1MB Slowdown (normalized) File size 1 Gbps

nullpin libdft-unopt libdft-bit libdft-byte

vpk@cs.columbia.edu Columbia University - Network Security Lab

slide-21
SLIDE 21

Overview Design & Implementation Results & Discussion Performance Use cases Summary

Performance evaluation

Apache web server (cont’d)

0.9 1 1.1 1.2 1.3 1.4 1.5 1.6 1.7 1.8 1.9 2 2.1 2.2 2.3

1KB 10KB 100KB 1MB Slowdown (normalized) File size 100 Mbps

nullpin libdft-unopt libdft-bit libdft-byte 0.9 1 1.1 1.2 1.3 1.4 1.5 1.6 1.7 1.8 1.9 2 2.1 2.2 2.3

1KB 10KB 100KB 1MB Slowdown (normalized) File size 1 Gbps

nullpin libdft-unopt libdft-bit libdft-byte

vpk@cs.columbia.edu Columbia University - Network Security Lab

slide-22
SLIDE 22

Overview Design & Implementation Results & Discussion Performance Use cases Summary

Performance evaluation

MySQL RDBMS & Firefox web browser

0.5 1 1.5 2 2.5 3 3.5 4 4.5 5 5.5 6 6.5 7 7.5 create alter insert ATIS Slowdown (normalized runtime) Test suite

(a) MySQL

nullpin libdft-unopt libdft-bit libdft-byte

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17

Facebook Gmail YouTube VEE

Slowdown (normalized rendering time) Web site

(b) Firefox

nullpin libdft-unopt libdft-bit libdft-byte

vpk@cs.columbia.edu Columbia University - Network Security Lab

slide-23
SLIDE 23

Overview Design & Implementation Results & Discussion Performance Use cases Summary

libdft-DTA

Taint analysis made easy

libdft offers a small and elegant API for transparently incorporating DFT into running applications → can we use it in order to enforce security policies? Built a full-fledged DTA tool in ∼ 450 LOC that protects against code injection attacks (e.g., stack smashing, heap corruption) memory overwrite attacks (e.g.,return-to-libc, format string) etc. +7% additional runtime overhead Tested with real exploits Dynamically retrofit DTA capabilities into running applications → Binary inline reference monitor

vpk@cs.columbia.edu Columbia University - Network Security Lab

slide-24
SLIDE 24

Overview Design & Implementation Results & Discussion Performance Use cases Summary

Recap

libdft Fast (highly optimized Tracker)

branch-less tag propagation single assignment tagmap updates inlined DFT logic

Reusable (API)

customizable propagation policy assignment of data sources and sinks at arbitrary points of interest

Applicable to commodity hardware and software

multiprocess and multithreading support no modifications to the binaries or the underlying OS

www.cs.columbia.edu/˜vpk/research/libdft/

vpk@cs.columbia.edu Columbia University - Network Security Lab

slide-25
SLIDE 25

Backup slides Bibliography Definitions Performance

Backup slides

vpk@cs.columbia.edu Columbia University - Network Security Lab

slide-26
SLIDE 26

Backup slides Bibliography Definitions Performance

DFT

Explicit vs. implicit data flows

Figure: Examples of code with explicit and implicit data dependencies

vpk@cs.columbia.edu Columbia University - Network Security Lab

slide-27
SLIDE 27

Backup slides Bibliography Definitions Performance

Pin DBI

libdft relies on Pin [Luk PLDI’05] for instrumenting and analyzing the target process Instrumentation → what analysis routines should be inserted where Analysis routines → code that is dynamically injected into the application and augments its execution Pin uses a JIT compiler for combining the original code, libdft, and the code of a libdft-tool “Jitted” code is placed into a code cache for avoiding re-translation

vpk@cs.columbia.edu Columbia University - Network Security Lab

slide-28
SLIDE 28

Backup slides Bibliography Definitions Performance

Performance evaluation

SPEC CPU2000 benchmark

1 2 3 4 5 6 7 8 9

libdft-bit libdft-byte

Slowdown (normalized runtime) CINT SPEC CPU2000

unopt O1 O2 O3 O4

vpk@cs.columbia.edu Columbia University - Network Security Lab

slide-29
SLIDE 29

Backup slides Bibliography

References I

  • M. Attariyan and J. Flinn.

Automating configuration troubleshooting with dynamic information flow analysis. In Proc. of the 9th OSDI, pages 237–250, 2010.

  • E. Bosman, A. Slowinska, and H. Bos.

Minemu: The World’s Fastest Taint Tracker. In Proc. of the 14th RAID, pages 1–20, 2011.

  • J. Chow, B. Pfaff, T. Garfinkel, K. Christopher, and
  • M. Rosenblum.

Understanding Data Lifetime via Whole System Simulation. In Proc. of the 13th USENIX Security, pages 321–336, 2004.

vpk@cs.columbia.edu Columbia University - Network Security Lab

slide-30
SLIDE 30

Backup slides Bibliography

References II

  • J. Clause, W. Li, and A. Orso.

Dytan: A Generic Dynamic Taint Analysis Framework. In Proc. of the 2007 ISSTA, pages 196–206.

  • J. R. Crandall and F

. T. Chong. Minos: Control Data Attack Prevention Orthogonal to Memory Model. In Proc. of the 37th MICRO, pages 221–232, 2004.

  • W. Enck, P

. Gilbert, B.-G. Chun, L. P . Cox, J. Jung, P . McDaniel, and A. N. Sheth. TaintDroid: An Information-Flow Tracking System for Realtime Privacy Monitoring on Smartphones. In Proc. of the 9th OSDI, pages 393–407, 2010.

vpk@cs.columbia.edu Columbia University - Network Security Lab

slide-31
SLIDE 31

Backup slides Bibliography

References III

  • A. Ho, M. Fetterman, C. Clark, A. Warfield, and S. Hand.

Practical Taint-based Protection using Demand Emulation. In Proc. of the 2006 EuroSys, pages 29–41.

  • K. Jee, G. Portokalidis, V. P

. Kemerlis, S. Ghosh, D. I. August, and A. D. Keromytis. A General Approach for Efficiently Accelerating Software-based Dynamic Data Flow Tracking on Commodity Hardware. In Proc. of the 19th NDSS, 2012.

vpk@cs.columbia.edu Columbia University - Network Security Lab

slide-32
SLIDE 32

Backup slides Bibliography

References IV

C.-K. Luk, R. Cohn, R. Muth, H. Patil, A. Klauser,

  • G. Lowney, S. Wallace, V. J. Reddi, and K. Hazelwood.

Pin: Building Customized Program Analysis Tools with Dynamic Instrumentation. In Proc. of the 2005 PLDI, pages 190–200.

  • A. C. Myers.

JFlow: Practical Mostly-Static Information Flow Control. In Proc. of the 26th POPL, pages 228–241, 1999.

  • J. Newsome and D. Song.

Dynamic Taint Analysis for Automatic Detection, Analysis, and Signature Generation of Exploits on Commodity Software. In Proc. of the 12th NDSS, 2005.

vpk@cs.columbia.edu Columbia University - Network Security Lab

slide-33
SLIDE 33

Backup slides Bibliography

References V

  • G. Portokalidis, A. Slowinska, and H. Bos.

Argos: an Emulator for Fingerprinting Zero-Day Attacks. In Proc. of the 2006 EuroSys, pages 15–27. F . Qin, C. Wang, Z. Li, H.-S. Kim, Y. Zhou, and Y. Wu. LIFT: A Low-Overhead Practical Information Flow Tracking System for Detecting Security Attacks. In Proc. of the 39th MICRO, pages 135–148, 2006.

  • G. E. Suh, J. W. Lee, D. Zhang, and S. Devadas.

Secure Program Execution via Dynamic Information Flow Tracking. In Proc. of the 11th ASPLOS, pages 85–96, 2004.

vpk@cs.columbia.edu Columbia University - Network Security Lab

slide-34
SLIDE 34

Backup slides Bibliography

References VI

  • G. Venkataramani, I. Doudalis, Y. Solihin, and M. Prvulovic.

Flexitaint: A Programmable Accelerator for Dynamic Taint Propagation. In Proc. of the 14th HPCA, pages 173–184, 2008.

  • W. Xu, S. Bhatkar, and R. Sekar.

Taint-Enhanced Policy Enforcement: A Practical Approach to Defeat a Wide Range of Attacks. In Proc. of the 15th USENIX Security, pages 121–136, 2006.

  • A. Zavou, G. Portokalidis, and A. D. Keromytis.

Taint-Exchange: A Generic System for Cross-process and Cross-host Taint Tracking. In Proc. of the 6th IWSEC, pages 113–128, 2011.

vpk@cs.columbia.edu Columbia University - Network Security Lab

slide-35
SLIDE 35

Backup slides Bibliography

References VII

  • D. Zhu, J. Jung, D. Song, T. Kohno, and D. Wetherall.

TaintEraser: Protecting Sensitive Data Leaks Using Application-Level Taint Tracking. SIGOPS Oper. Syst. Rev., 45(1):142–154, 2011.

vpk@cs.columbia.edu Columbia University - Network Security Lab