Soft-Timer Driven Transient Kernel Control Flow Attacks and Defense



Similar documents
Tamper-Resistant, Application-Aware Blocking of Malicious Network Connections

A Hypervisor IPS based on Hardware assisted Virtualization Technology

Visualizing Information Flow through C Programs

Abstract. 1. Introduction. 2. Threat Model

Secure In-VM Monitoring Using Hardware Virtualization

Run-Time Deep Virtual Machine Introspection & Its Applications

Lares: An Architecture for Secure Active Monitoring Using Virtualization

How To Stop A Malicious Process From Running On A Hypervisor

Gyrus: A Framework for User- Intent Monitoring of Text- Based Networked ApplicaAons

Automating Linux Malware Analysis Using Limon Sandbox Monnappa K A monnappa22@gmail.com

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

Gyrus: A Framework for User- Intent Monitoring of Text- Based Networked ApplicaAons

Virtual Machine Security

Redline Users Guide. Version 1.12

Kernel Data Integrity Protection via Memory Access Control

Microkernels, virtualization, exokernels. Tutorial 1 CSC469

Full and Para Virtualization

Patterns for Secure Boot and Secure Storage in Computer Systems

The Value of Physical Memory for Incident Response

Low-rate TCP-targeted Denial of Service Attack Defense

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

International Journal of Enterprise Computing and Business Systems ISSN (Online) :

Linux Kernel Rootkit : Virtual Terminal Key Logger

Trusted Virtual Datacenter Radically simplified security management

Chapter 5 Cloud Resource Virtualization

Survey on virtual machine security

Guardian: Hypervisor as Security Foothold for Personal Computers

Threat Events: Software Attacks (cont.)

Intel s Virtualization Extensions (VT-x) So you want to build a hypervisor?

How to Sandbox IIS Automatically without 0 False Positive and Negative

An Analysis of the Capabilities Of Cybersecurity Defense

Virtual Private Systems for FreeBSD

Virtual Servers. Virtual machines. Virtualization. Design of IBM s VM. Virtual machine systems can give everyone the OS (and hardware) that they want.

CMPS223 Final Project Virtual Machine Introspection Techniques

KVM Security Comparison

SubVirt: Implementing malware with virtual machines

Honeypot-Architectures using VMI Techniques

Securely Isolating Malicious OS Kernel Modules Using Hardware Virtualization Support

AgencyPortal v5.1 Performance Test Summary Table of Contents

Computer Security DD2395

IT Best Practices Audit TCS offers a wide range of IT Best Practices Audit content covering 15 subjects and over 2200 topics, including:

Implementation and Implications of a Stealth Hard-Drive Backdoor

Practical Protection of Kernel Integrity for Commodity OS from Untrusted Extensions

Eugene Tsyrklevich. Ozone HIPS: Unbreakable Windows

Operating Systems 4 th Class

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

CSE543 Computer and Network Security Module: Cloud Computing

Hypervisor-based Intrusion Detection. Lionel Litty

McAfee Deep Safe. Security beyond the OS. Kai-Ping Seidenschnur Senior Security Engineer. October 16, 2012

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

Host-based Intrusion Prevention System (HIPS)

Virtual Switching Without a Hypervisor for a More Secure Cloud

Firewall Testing Methodology W H I T E P A P E R

How To Secure Cloud Computing

CS 356 Lecture 25 and 26 Operating System Security. Spring 2013

Lab 6: Building Your Own Firewall

Windows Server Virtualization & The Windows Hypervisor

Comprehensive Security for Internet-of-Things Devices With ARM TrustZone

Transparent Monitoring of a Process Self in a Virtual Environment

Dynamic VM Monitoring using Hypervisor Probes

THE SMARTEST WAY TO PROTECT WEBSITES AND WEB APPS FROM ATTACKS

Redline User Guide. Release 1.14

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

Certified Ethical Hacker Exam Version Comparison. Version Comparison

Attacking Hypervisors via Firmware and Hardware

LASTLINE WHITEPAPER. In-Depth Analysis of Malware

Container-based operating system virtualization: a scalable, high-performance alternative to hypervisors

Ensuring Operating System Kernel Integrity with OSck

Endpoint Security: Moving Beyond AV

FORBIDDEN - Ethical Hacking Workshop Duration

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

Cyber/IT Risk: Threat Intelligence Countering Advanced Adversaries Jeff Lunglhofer, Principal, Booz Allen. 14th Annual Risk Management Convention

Intel DPDK Boosts Server Appliance Performance White Paper

Center of Academic Excellence Cyber Operations Program 2013 Application

Survey On Hypervisors

Intrusion Detection System

CS423 Spring 2015 MP4: Dynamic Load Balancer Due April 27 th at 9:00 am 2015

GPU File System Encryption Kartik Kulkarni and Eugene Linkov

Web Application Security

Transcription:

Soft-Timer Driven Transient Kernel Control Flow Attacks and Defense Jinpeng Wei, Bryan D. Payne, Jonathon Giffin, Calton Pu Georgia Institute of Technology Annual Computer Security Applications Conference (ACSAC 2008) Anaheim, CA. December 10, 2008.

The Botnet Threat Botnet: a collection of compromised computers under the control of a malicious server or master. Malware (e.g., rootkits) on each bot has become increasingly sophisticated and stealthy to evade detection and removal. We are mainly interested in the stealthy hiding of malware in the kernel space 2

Outline Soft timers and soft-timer-driven attacks Design of the STIR defense Implementation and evaluation Related work Conclusion 3

Outline Soft timers and soft-timer-driven attacks Design of the STIR defense Implementation and evaluation Related work Conclusion 4

Classification of Stealthy Control Flow Attacks in the Kernel Detour attacks Persistent control flow attacks (hooks) Transient control flow attacks Soft-timer-driven attacks 5

The Soft-timer Queue A dynamic schedulable queue in the kernel Can be used to inject transient control flows tvec_bases add_timer STIR: Soft-Timer Interrupt Request next function data next function data next function data expires expires expires foo_tmout 6

Soft-timer-driven Control Flow Attacks 2. wait Soft Timer Queue Engine function data expires function data expires function data expires 3. callback 1. schedule 4. run timer->function (timer->data) {... } Legitimate Driver Legitimate Driver Legitimate Driver 7

Soft-timer-driven Control Flow Attacks 2. wait Soft Timer Queue Engine function data expires function data expires function data expires 3. callback 1. schedule 4. run timer->function (timer->data) {... } Malware Module Legitimate Driver Legitimate Driver 8

Proof of Concept Malware How do they work? Request the first STIR to interpose on the kernel control flow at break-in Execute when the first STIR expires (a callback) Before giving up control, request the next STIR Wait for the next callback to happen What can they do? Collect confidential information (stealthy key logger) Mount a DoS attack (stealthy cycle stealer) Schedule a hidden process (alter-scheduler) STIR: Soft-Timer Interrupt Request 9

The Stealthy Key Logger keyboard TTY flip buffer line discipline buffer user app. kernel space user space Runs in Linux kernel 2.6.16 Periodically reads the TTY line discipline buffer in the kernel, which can keep a history of up to 2,048 keystrokes Timer period is 1 second 10

Outline Soft timers and soft-timer-driven attacks Design of the STIR defense Implementation and evaluation Related work Conclusion 11

Defending Soft-timer-driven Attacks Main idea: a soft-timer callback function and its callees (functions it calls) should always target the trusted code of the kernel during the execution of the callback function. By preserving such invariants, we can defeat soft-timer-driven attacks. Trusted kernel code Untrusted kernel code Q: How can we draw the line between trusted and untrusted parts of the kernel? A: Validate the targets of indirect control transfers. E.g., what can timer >function legally point to? 12

Basic Defense Strategy tvec_bases next next function function data data expires dev_watchdog expires malicious_foo tx_timeout el000_tx_timeout Check the callback function against a white list of legitimate callback functions 13

More Comprehensive Defense Strategy tvec_bases next next function function data data expires dev_watchdog expires tx_timeout tx_timeout el000_tx_timeout malicious_foo Check the callback function as well as the data pointer Smarter malware may supply a legitimate callback function but a malicious data pointer (similar to the jump-to-libc style attacks). 14

High-Level View of the Defense Input: function, data Output: yes/no function =? ab_cleanup dev_watchdog tcp_delack_timer zf_ping data > tx_timeout =? ace_watchdog e1000_tx_timeout How do we build and use this whitelist tree? 15

STIR Summary Signatures summary_signature := <function, assertion> assertion := true dpred AND assertion Constraint on dpred := derefthe equals function (functionlist) pointer Constraint on the data attribute functionlist := function function OR functionlist Example summary signature: < dev_watchdog, data->tx_timeout equals (e1000_tx_timeout OR xircom_tx_timeout) > 16

Processing STIR Summary Signatures Linux Kernel Source Runtime symbol information STIR Symbol Mapper STIR Dispatcher STIR Analyzer Symbolic STIR Signatures STIR Symbol Resolver Guest VM Resolved STIR Signature Database STIR Checker Security VM Compile Time Initialization Time Evaluation Time 17

Static Analysis Overview Top-Level Analysis Transitive Closure Analysis < function, assertion > STIR summary signature 18

Top-Level Analysis /* Linux kernel 2.6.16/net/sched/sch_generic.c */ static void dev_watchdog_init(struct net_device *dev) { init_timer(&dev->watchdog_timer); dev->watchdog_timer.data = (unsigned long)dev; dev->watchdog_timer.function = dev_watchdog; } Traverse each assignment statement (lval = rval) in the kernel, if lval ends with a field named function within a structure of type timer_list, then rval is recognized as a soft timer callback function 19

Top-Level Analysis /* Linux kernel 2.6.16/net/sched/sch_generic.c */ static void dev_watchdog_init(struct net_device *dev) { init_timer(&dev->watchdog_timer); dev->watchdog_timer.data = (unsigned long)dev; dev->watchdog_timer.function = dev_watchdog; } Traverse each assignment statement (lval = rval) in the kernel, if lval ends with a field named function within a structure of type timer_list, then rval is recognized as a soft timer callback function 20

Top-Level Analysis /* Linux kernel 2.6.16/net/sched/sch_generic.c */ static void dev_watchdog_init(struct net_device *dev) { init_timer(&dev->watchdog_timer); dev->watchdog_timer.data = (unsigned long)dev; dev->watchdog_timer.function = dev_watchdog; } Traverse each assignment statement (lval = rval) in the kernel, if lval ends with a field named function within a structure of type timer_list, then rval is recognized as a soft timer callback function 21

Transitive Closure Analysis static void dev_watchdog(unsigned long arg) { struct net_device *dev = (struct net_device *)arg; if (dev->qdisc!= &noop_qdisc) { printk(kern_info %s\n", dev->name); } dev->tx_timeout(dev); Objective: To identify the constraints on the data attribute of a legitimate STIR 22

Transitive Closure Analysis tainted_vars: static void dev_watchdog(unsigned long arg) {arg} { struct net_device *dev = (struct net_device *)arg; if (dev->qdisc!= &noop_qdisc) { printk(kern_info %s\n", dev->name); dev->tx_timeout(dev); } 23

Transitive Closure Analysis tainted_vars: static void dev_watchdog(unsigned long arg) { struct net_device *dev = (struct net_device *)arg; if (dev->qdisc!= &noop_qdisc) { printk(kern_info %s\n", dev->name); } dev->tx_timeout(dev); {arg} {arg, dev} 24

Transitive Closure Analysis static void dev_watchdog(unsigned long arg) tainted_vars: { struct net_device *dev = (struct net_device *)arg; if (dev->qdisc!= &noop_qdisc) { printk(kern_info %s\n", dev->name); } dev->tx_timeout(dev); {arg, dev} 25

Transitive Closure Analysis static void dev_watchdog(unsigned long arg) tainted_vars: { struct net_device *dev = (struct net_device *)arg; if (dev->qdisc!= &noop_qdisc) { printk(kern_info %s\n", dev->name); } dev->tx_timeout(dev); {arg, dev} 26

Transitive Closure Analysis static void dev_watchdog(unsigned long arg) tainted_vars: { struct net_device *dev = (struct net_device *)arg; if (dev->qdisc!= &noop_qdisc) { printk(kern_info %s\n", dev->name); } dev->tx_timeout(dev); {arg, dev} Question 1: dev->tx_timeout =? Answer: Find all legitimate functions that can be assigned to the tx_timeout field of a structure of type net_device top-level analysis 27

Transitive Closure Analysis static void dev_watchdog(unsigned long arg) { struct net_device *dev = (struct net_device *)arg; if (dev->qdisc!= &noop_qdisc) { printk(kern_info %s\n", dev->name); } dev->tx_timeout(dev); Question 2: How is the control flow of dev->tx_timeout influenced by dev? Answer: Perform a transitive closure analysis on the target function. static void ariadne_tx_timeout(struct net_device *dev) { volatile struct Am79C960 *lance = (struct Am79C960*)dev->base_addr; } 28

Processing STIR Summary Signatures Linux Kernel Source STIR Analyzer Symbolic STIR Signatures Runtime symbol information STIR Symbol Mapper STIR Symbol Resolver dev_watchdog, c02ae890 neigh_table_clear, c02a4810 Guest VM Resolved STIR Signature Database Security VM STIR Dispatcher STIR Checker Compile Time Initialization Time Evaluation Time 29

Checking STIRs Linux Kernel Source Runtime symbol information STIR Symbol Mapper STIR Dispatcher STIR Analyzer Symbolic STIR Signatures STIR Symbol Resolver Guest VM Resolved STIR Signature Database STIR Checker Security VM Compile Time Initialization Time Evaluation Time 30

STIR Checking Architecture Guest VM STIR Dispatcher Security VM Resolved STIR Sig. DB yes / no (function, data) VMI STIR Checker Xen function =? ab_cleanup dev_watchdog tcp_delack_timer zf_ping data > tx_timeout =? ace_watchdog e1000_tx_timeout 31

Outline Soft timers and soft-timer-driven attacks Design of the STIR defense Implementation and evaluation Related work Conclusion 32

Implementation of the STIR Analyzer Based on CIL (C Intermediate Language) Comprised of several analysis modules A top-level analyzer A transitive closure analyzer A type analyzer Shell scripts to compose the modules 33

Implementation of the STIR Checking On top of Xen 3.0.4 Used the VT (virtualization technology) support of an Intel CPU Based on the Lares architecture 34

Evaluation: Security Assumptions The VMM and the Security VM are part of the TCB (Trusted Computing Base). The legitimate kernel code in the guest VM s memory can not be tampered with. The source code of the kernel and all kernel extensions are available for static analysis. The guest system can be booted into a known good state (e.g., secure boot). 35

Evaluation: Static Analysis Results We found 365 top-level callback functions in 3,688 kernel source files analyzed. The majority of these STIR callback functions do not derive function pointers from the input parameter. 32 of them need transitive closure analysis. 36

Evaluation: Effectiveness of Defense Attack experiments: can detect the sample malware. Can have no false negatives because it mediates every STIR execution and prevents the execution of all unknown, illegitimate STIRs. Can have no false positives because all potential legitimate STIRs are captured in the summary signature database. 37

Evaluation: Execution Time Overhead cat ccrypt gzip cp make Original (seconds) 20.85 3.30 5.92 43.95 217.95 STIR-aware (seconds) 20.96 3.30 6.01 46.61 218.58 Overhead 0.52% 0% 1.52% 6.05% 0.29% Callbacks/Sec 46.9 46.3 47.3 61.4 81.6 cat - read and display the content of 8,000 small files (with size ranging from 5K to 7.5K bytes). ccrypt - encrypt a text stream of 64M bytes. gzip - compress a text file of 64M bytes using the --best option. cp - recursively copy a Linux kernel source tree. make - perform a full build of the Apache HTTP server (version 2.2.2) from source. 38

Evaluation: Network Throughput Overhead 800 700 717.9 688.4 Throughput (MB/s) 600 500 400 300 200 100 0 Original STIR-Aware Performance drop: 4.1% Callback frequency: 287/second We used the Iperf-2.0.2 benchmark. The security VM ran the Iperf server and the guest VM ran the Iperf client. The experiment was run for 60 seconds, using 64KB buffers and 10 concurrent connections. 39

Outline Soft timers and soft-timer-driven attacks Design of the STIR defense Implementation and evaluation Related work Conclusion 40

Related Work Focused on code changes Tripwire (a file system integrity checker) IMA (TCG-based, load-time kernel and application integrity checker) Copilot (coprocessor-based, run-time kernel integrity checker) Pioneer (purely software-based run-time integrity checker) Focused on data changes SBCFI (state-based control flow integrity), a sampling-based checker targeting persistent kernel control flow attacks CFI (control flow integrity), checking the dynamic execution flow of a program against a statically computed control flow graph 41

Outline Soft timers and soft-timer-driven attacks Design of the STIR defense Implementation and evaluation Related work Conclusion 42

Conclusions The Soft-timer mechanism of a modern kernel provides a novel hiding technique for the malware. We develop a white list approach for defending against such malware. We use static analysis to derive the white list. We use virtualization to implement the defense. 43