Adaptive Android Kernel Live Patching

Slides:



Advertisements
Similar presentations
Presented by Vaibhav Rastogi. Current browsers try to separate host system from Web Websites evolved into web applications Lot of private data on the.
Advertisements

Improving Integer Security for Systems with KINT Xi Wang, Haogang Chen, Zhihao Jia, Nickolai Zeldovich, Frans Kaashoek MIT CSAIL Tsinghua IIIS.
CS457 – Introduction to Information Systems Security Software 4 Elias Athanasopoulos
Lecture 16 Buffer Overflow modified from slides of Lawrie Brown.
Moving Target Defense in Cyber Security
Java.  Java is an object-oriented programming language.  Java is important to us because Android programming uses Java.  However, Java is much more.
RUGRAT: Runtime Test Case Generation using Dynamic Compilers Ben Breech NASA Goddard Space Flight Center Lori Pollock John Cavazos University of Delaware.
1 Achieving Trusted Systems by Providing Security and Reliability (Research Project #22) Project Members: Ravishankar K. Iyer, Zbigniew Kalbarczyk, Jun.
Achieving Trusted Systems by Providing Security and Reliability Ravishankar K. Iyer, Zbigniew Kalbarczyk, Jun Xu, Shuo Chen, Nithin Nakka and Karthik Pattabiraman.
@ NCSU Zhi NCSU Xuxian Microsoft Research Weidong Microsoft NCSU Peng NCSU ACM CCS’09.
Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition Chapter 2: Operating-System Structures Modified from the text book.
1 RAKSHA: A FLEXIBLE ARCHITECTURE FOR SOFTWARE SECURITY Computer Systems Laboratory Stanford University Hari Kannan, Michael Dalton, Christos Kozyrakis.
RFC6520 defines SSL Heartbeats - What are they? 1. SSL Heartbeats are used to keep a connection alive without the need to constantly renegotiate the SSL.
JAVA v.s. C++ Programming Language Comparison By LI LU SAMMY CHU By LI LU SAMMY CHU.
The Impact of Programming Language Theory on Computer Security Drew Dean Computer Science Laboratory SRI International.
A Portable Virtual Machine for Program Debugging and Directing Camil Demetrescu University of Rome “La Sapienza” Irene Finocchi University of Rome “Tor.
Michael Ernst, page 1 Collaborative Learning for Security and Repair in Application Communities Performers: MIT and Determina Michael Ernst MIT Computer.
Carnegie Mellon Selected Topics in Automated Diversity Stephanie Forrest University of New Mexico Mike Reiter Dawn Song Carnegie Mellon University.
Ether: Malware Analysis via Hardware Virtualization Extensions Author: Artem Dinaburg, Paul Royal, Monirul Sharif, Wenke Lee Presenter: Yi Yang Presenter:
Buffer Overflow Detection Stuart Pickard CSCI 297 June 14, 2005.
Vasileios P. Kemerlis, Georgios Portokalidis, Angelos D. Keromytis Network Security Lab, Department of Computer Science, Columbia University, USA 21 st.
Computer Science Detecting Memory Access Errors via Illegal Write Monitoring Ongoing Research by Emre Can Sezer.
University of Virginia Department of Computer Science1 Applications of Software Dynamic Translation Jack Davidson University of Virginia February 27, 2002.
VMM Based Rootkit Detection on Android Class Presentation Pete Bohman, Adam Kunk, Erik Shaw.
Environment Selection Application  Firefox 1.0 or 2.0  Apache Operating System  Linux  Windows XP Instrumentation Package  JIT (DynamoRio,
Highly Scalable Distributed Dataflow Analysis Joseph L. Greathouse Advanced Computer Architecture Laboratory University of Michigan Chelsea LeBlancTodd.
M. Alexander Helen J. Wang Yunxin Liu Microsoft Research 1 Presented by Zhaoliang Duan.
Operating Systems Security
Wireless and Mobile Security
Efficient software-based fault isolation Robert Wahbe, Steven Lucco, Thomas Anderson & Susan Graham Presented by: Stelian Coros.
Sampling Dynamic Dataflow Analyses Joseph L. Greathouse Advanced Computer Architecture Laboratory University of Michigan University of British Columbia.
Exploiting Instruction Streams To Prevent Intrusion Milena Milenkovic.
SAFE KERNEL EXTENSIONS WITHOUT RUN-TIME CHECKING George C. Necula Peter Lee Carnegie Mellon U.
Buffer Overflows Taught by Scott Coté.-. _ _.-. / \.-. ((___)).-. / \ /.ooM \ / \.-. [ x x ].-. / \ /.ooM \ -/ \ /-----\-----/---\--\ /--/---\-----/-----\ / \-
A Binary Agent Technology for COTS Software Integrity Anant Agarwal Richard Schooler InCert Software.
Slides by Kent Seamons and Tim van der Horst Last Updated: Nov 11, 2011.
MIT/Determina Application Communities, page 1 Approved for Public Release, Distribution Unlimited - Case 9649 Collaborative learning for security and repair.
VM: Chapter 7 Buffer Overflows. csci5233 computer security & integrity (VM: Ch. 7) 2 Outline Impact of buffer overflows What is a buffer overflow? Types.
1 ROGUE Dynamic Optimization Framework Using Pin Vijay Janapa Reddi PhD. Candidate - Electrical And Computer Engineering University of Colorado at Boulder.
Enabling Control over Adaptive Program Transformation for Dynamically Evolving Mobile Software Validation Mike Jochen, Anteneh Anteneh, Lori Pollock University.
Analyzing Input Validation vulnerabilities in Android System Services NAMJUN PARK (NPAR350)
Memory Protection through Dynamic Access Control Kun Zhang, Tao Zhang and Santosh Pande College of Computing Georgia Institute of Technology.
Constraint Framework, page 1 Collaborative learning for security and repair in application communities MIT site visit April 10, 2007 Constraints approach.
The Basics of Android App Development Sankarshan Mridha Satadal Sengupta.
Introduction to Operating Systems Concepts
Remix: On-demand Live Randomization
Security and Programming Language Work on SmartPhones
TriggerScope: Towards Detecting Logic Bombs in Android Applications
Interpreted languages Jakub Yaghob
Yaoqi Jia, Zheng Leong Chua, Hong Hu,
Pinpointing Vulnerabilities
CASE STUDY 1: Linux and Android
TaintART: A Practical Multi-level Information-Flow Tracking System for Android RunTime Sadiq Basha.
Jump Over ASLR: Attacking Branch Predictors to Bypass ASLR
Secure Software Development: Theory and Practice
MobiSys 2017 Symbolic Execution of Android Framework with Applications to Vulnerability Discovery and Exploit Generation Qiang Zeng joint work with Lannan.
TriggerScope Towards Detecting Logic Bombs in Android Applications
Hardware Support for Embedded Operating System Security
CMPE419 Mobile Application Development
CS 465 Buffer Overflow Slides by Kent Seamons and Tim van der Horst
Suwen Zhu, Long Lu, Kapil Singh
CSc 453 Interpreters & Interpretation
All You Ever Wanted to Know About Dynamic Taint Analysis & Forward Symbolic Execution (but might have been afraid to ask) Edward J. Schwartz, Thanassis.
The Design & Implementation of Hyperupcalls
CSC-682 Advanced Computer Security
Introduction to Virtual Machines
Introduction to Virtual Machines
CMPE419 Mobile Application Development
CSc 453 Interpreters & Interpretation
Outcome of the Lecture Upon completion of this lecture you will be able to understand Fundamentals and Characteristics of Java Language Basic Terminology.
Presentation transcript:

Adaptive Android Kernel Live Patching USENIX Security Symposium 2017 Adaptive Android Kernel Live Patching Yue Chen1, Yulong Zhang2, Zhi Wang1, Liangzhao Xia2, Chenfu Bao2, Tao Wei2 Florida State University1 Baidu X-Lab2

Android Kernel Vulnerabilities Apps Java API Framework Native C/C++ Libraries Linux Kernel Android Runtime Hardware Abstraction Layer TrustZone

Android Kernel Vulnerabilities Apps Java API Framework Native C/C++ Libraries Linux Kernel Android Runtime Hardware Abstraction Layer TrustZone

Android Kernel Vulnerabilities Apps Java API Framework Native C/C++ Libraries Linux Kernel Android Runtime Hardware Abstraction Layer TrustZone

Number of Disclosed Android Kernel Vulnerabilities

Problem: Old Exploits Remain Effective Number of devices vulnerable to two root exploits as of Nov. 2016 Android 5.0 released in November 2014 46.3% of devices run an older version in September 2016

Challenges Officially patching an Android device is a long process  Third-party Delayed/non-existing kernel source code  Binary-based

Challenges Severely fragmented Android ecosystem  Adaptive http://d.ibtimes.co.uk/en/full/1395443/android-fragmentation-2014.png

Third-party Binary-based Adaptive Kernel Live Patching Solution Third-party Binary-based Adaptive Kernel Live Patching Key requirements: Adaptiveness It should be adaptive to various device kernels Safety Patches should be easy to audit Their behaviors must be technically confined Timeliness Response time should be short, after disclosed vulnerability or exploit Performance The solution should not incur non-trivial performance overhead

Feasibility Study: Dataset Studied 1139 Android kernels

Feasibility Study: Observations Most kernel functions are stable across devices and Android releases Most vulnerabilities triggered by malicious inputs Many functions return error codes Return a pointer  ERR_PTR

Feasibility Study: Observations Most kernel functions are stable across devices and Android releases Most vulnerabilities triggered by malicious inputs Many functions return error codes Return a pointer  ERR_PTR Filter them Gracefully return

Overall Approach: Input Validation

KARMA KARMA: Kernel Adaptive Repair for Many Androids Adaptive – Automatically adapt to various device kernels Memory-safe – Protect kernel from malicious (misused) patches Multi-level – Flexible for different vulnerabilities

KARMA Design: Safety Patches are written in Lua, confined by Lua VM at runtime A patch can only be placed at designated locations Patched functions must return error codes or void Use existing error handling to recover from attacks A patch can read but not write the kernel memory Confined by KARMA APIs Prevent malicious (misused) patches from changing the kernel Prevent information leakage

KARMA Design: Multi-level Patching A patch can only be placed at designated locations Level 1: Entry or return point of a (vulnerable) function Level 2: Before or after the call site to a callee e.g., copy_from_user Level 3: Binary-based patch 76 critical Android kernel vulnerabilities Level 1: 49/76 (64.5%) Level 2: 22/76 (28.9%) Level 3: 5/76 (6.6%)

Part of the official patch of CVE-2014-3153 (Towelroot) KARMA Patch Example Part of the official patch of CVE-2014-3153 (Towelroot)

More complex examples in the paper KARMA Patch Example -EINVAL More complex examples in the paper

KARMA API

KARMA API Available to patches

KARMA Architecture Offline Patch Generation and Verification Online Live Patching by KARMA Client

Offline Patch Adaptation

Offline Patch Adaptation Three steps: Identify the vulnerable functions in the target kernel Same function but different names Inlined Check if the reference patch works for the target kernel Same function but different semantics Adapt the reference patch for the target kernel

Call graph based similarity comparison Vulnerable Function Identification Example CVE-2015-3636 (PingPong Root) Device A: ping_unhash Device B: ping_v4_unhash Func_A Func_B Func_C Func_D Func_E ping_unhash Func_A Func_B Func_C Func_D Func_E ping_v4_unhash Call graph based similarity comparison

Semantic Matching Check if two functions are semantically equivalent If so, adapt the reference patch to the target kernel Syntactic matching is too strict Different compilers can generate different code with same semantics Instruction order, register allocation, instruction selection, code layout

Same semantics with different syntax Semantic Matching Same semantics with different syntax

Same semantics with different syntax Semantic Matching Same semantics with different syntax

Same semantics with different syntax Semantic Matching Same semantics with different syntax

Same semantics with different syntax Semantic Matching Same semantics with different syntax

Same semantics with different syntax Semantic Matching Same semantics with different syntax

Semantic Matching Check if two functions are semantically equivalent If so, adapt the reference patch to the target kernel Syntactic matching is too strict Different compilers can generate different code with same semantics Instruction order, register allocation, instruction selection, code layout Use symbolic execution to abstract these differences and adapt patches Use approximation to improve scalability (details in the paper)

Online Patch Application Function entry point hooking

Prototype Implementation Lua engine in kernel (11K SLOC) Simple Memory-safe Easy to embed and extend 24 years of development Semantic matching – angr

Evaluation: Applicability Evaluated 76 critical vulnerabilities in the last three years Patch level: Level-1: 49 Level-2: 22 Level-3: 5

Evaluation: Adaptability

Evaluation: Adaptability Types and frequencies of instruction opcodes

Evaluation: Adaptability Number of function calls and conditional branches (to abstract CFG)

Evaluation: Adaptability KARMA’s semantic matching

Evaluation: Performance CF-Bench results with different patches

Evaluation: Performance Execution time of chmod with different patches

Future Work User-space vulnerability protection Project Treble  only partially solve the problem Lua engine in the kernel (11K SLOC) Alternative execution engines, like BPF or sandboxed binary patches Error handling code could be vulnerable Error injection to detect vulnerable error-handling code Improve semantic matching

Adaptive Android Kernel Live Patching Q & A Adaptive Android Kernel Live Patching www.YueChen.me

Backup Slides

Attack TrustZone from Kernel Example: Downgrade Attack on TrustZone (see its references)

Number of syntax clusters for each function Observations Most kernel functions are stable across devices and Android releases. Cluster Number Kernel Function Number Number of syntax clusters for each function About 40% of the shared functions have only one cluster, and about 80% of them have 4 clusters or less.

Percentage of kernels in the largest cluster for each function Observations Most kernel functions are stable across devices and Android releases. Kernel Function Number Percentage of kernels in the largest cluster for each function For about 60% of shared functions, the largest cluster contains more than 80% of all the kernels that have this function.

Symbolic Execution Challenges Practical Solution Avoid path explosion Impact to the environment Practical Solution Non-local memory writes Function calls (and their arguments) Function return values Adaptation (e.g., mutate constants or offsets) foo(symbol_A + 4, 36) foo(symbol_A + 8, 36)

Evaluation: Overall Performance Complex patch for most frequent syscall (gettimeofday) during web browsing Overall system performance overhead in this extreme situation: 0.9%

Example: CVE-2013-6123

Example: CVE-2013-6123

Example: CVE-2013-6123

Example: CVE-2013-6123

Example: CVE-2013-6123

Example: CVE-2013-6123

You May Also Like A time machine to locate vulnerabilities: Pinpointing Vulnerabilities Protect your computer by encrypting memory all the time: Secure In-Cache Execution Fine-grained dynamic ASLR during runtime: Remix: On-demand Live Randomization