Leave The App Alone! - Attack and Defense of Android App Hijack



Similar documents
AGENDA. Background. The Attack Surface. Case Studies. Binary Protections. Bypasses. Conclusions

Example of Standard API

This is DEEPerent: Tracking App behaviors with (Nothing changed) phone for Evasive android malware

APPLICATION SECURITY: FROM WEB TO MOBILE. DIFFERENT VECTORS AND NEW ATTACK

Messing with the Android Runtime

Paul Sabanal IBM X-Force Advanced Research. State Of The ART. Exploring The New Android KitKat Runtime IBM Corporation

Mobile Application Security Testing ASSESSMENT & CODE REVIEW

Advanced ANDROID & ios Hands-on Exploitation

Enterprise Application Security Workshop Series

Android Packer. facing the challenges, building solutions. Rowland YU. Senior Threat Researcher Virus Bulletin 2014

Tutorial on Basic Android Setup

Mobile Security Framework

BYOD AND NEXT- GENERATION MOBILE SECURITY

Lecture 17: Mobile Computing Platforms: Android. Mythili Vutukuru CS 653 Spring 2014 March 24, Monday

Code Injection From the Hypervisor: Removing the need for in-guest agents. Matt Conover & Tzi-cker Chiueh Core Research Group, Symantec Research Labs

Progressive Enhancement With GQuery and GWT. Ray Cromwell

Fourteenforty Research Institute, Inc.

Android Security Joshua Hodosh and Tim Leek

ITG Software Engineering

Enterprise Mobility Management

Put a Firewall in Your JVM Securing Java Applications!

Blackbox Android. Breaking Enterprise Class Applications and Secure Containers. Marc Blanchou Mathew Solnik 10/13/

Workday Mobile Security FAQ

Android Security - Common attack vectors

Introduction to Android

Publishing to TIZEN Using the Automated Conversion/Repackaging of Existing Android Apps. Hyeokgon Ryu, Infraware Technology, Ltd.

WebView addjavascriptinterface Remote Code Execution 23/09/2013

Crosswalk: build world class hybrid mobile apps

Overview. The Android operating system is like a cake consisting of various layers.

Defending Behind The Device Mobile Application Risks

Design and Implementation of an Android Host-based Intrusion Prevention System

Host-based Intrusion Prevention on Windows and UNIX. Dr. Rich Murphey White Oak Labs

Chapter 14 Virtual Machines

HybriDroid: Analysis Framework for Android Hybrid Applications

New Features in XE8. Marco Cantù RAD Studio Product Manager

SAFECode Security Development Lifecycle (SDL)

Securing your Mobile Applications. Karson Chan Security Consultant

When Security Gets in the Way. PenTesting Mobile Apps That Use Certificate Pinning

Mobile Application Hacking for Android and iphone. 4-Day Hands-On Course. Syllabus

Research and Design of Universal and Open Software Development Platform for Digital Home

ANDROID BASED MOBILE APPLICATION DEVELOPMENT and its SECURITY

All Your Code Belongs To Us Dismantling Android Secrets With CodeInspect. Steven Arzt Secure Software Engineering Group Steven Arzt 1

Mobile Devices - An Introduction to the Android Operating Environment. Design, Architecture, and Performance Implications

RoverPal - A Mobile Payment Application

Popular Android Exploits

Practical Mac OS X Insecurity. Security Concepts, Problems and Exploits on your Mac

Mocean Android SDK Developer Guide

Basic Android Setup Windows Version

Application-Level Debugging and Profiling: Gaps in the Tool Ecosystem. Dr Rosemary Francis, Ellexus

ANDROID SECURITY ATTACKS AND DEFENSES ABHISHEK DUBEY I ANMOL MISRA. ( r öc) CRC Press VV J Taylor & Francis Group ^ "^ Boca Raton London New York

Hey, We Catch You: Dynamic Analysis of Android Applications. Wenjun Hu(MindMac) PacSec, Tokyo

A monitoring method of sensitive calls based on the Android platform software behavior Cheng Sun, Sujuan Qin

Robotium Automated Testing for Android

Introduction to Android 5 Security

Android Basics. Xin Yang

Pentesting Android Apps. Sneha Rajguru

Loophole+ with Ethical Hacking and Penetration Testing

Tutorial on Basic Android Setup

Cloud Computing. Up until now

Smart home appliance security and malware

Android WebKit Development: A cautionary tale. Joe Bowser Nitobi joe.bowser@nitobi.com

Dongwoo Kim : Hyeon-jeong Lee s Husband

Compilers and Tools for Software Stack Optimisation

Developing Android Apps with the ArcGIS Runtime SDK for Android. Dan

Mobile Application Hacking for ios. 3-Day Hands-On Course. Syllabus

Symantec LiveUpdate Administrator. Getting Started Guide

Mobile Devices - An Introduction to the Android Operating Environment. Design, Architecture, and Performance Implications

SaaS-Based Employee Benefits Enrollment System

ios Testing Tools David Lindner Director of Mobile and IoT Security

Project Ideas. Semester long projects of medium scope. TAs presenting project ideas today. Students can submit their own ideas

The Value of Physical Memory for Incident Response

Practical Attacks against Mobile Device Management (MDM) Michael Shaulov, CEO Daniel Brodie, Security Researcher Lacoon Mobile Security

Hacking your Droid ADITYA GUPTA

Cleaning Encrypted Traffic

Penetration Testing for iphone Applications Part 1

Mobile Application Development Android

Pentesting Mobile Applications

Research on Situation and Key Issues of Smart Mobile Terminal Security

Hotpatching and the Rise of Third-Party Patches

LoadRunner and Performance Center v11.52 Technical Awareness Webinar Training

OWASP Mobile Top Ten 2014 Meet the New Addition

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

SYLLABUS MOBILE APPLICATION SECURITY AND PENETRATION TESTING. MASPT at a glance: v1.0 (28/01/2014) 10 highly practical modules

Testing Automation for Distributed Applications By Isabel Drost-Fromm, Software Engineer, Elastic

EMET 4.0 PKI MITIGATION. Neil Sikka DefCon 21

OPERATING SYSTEM - MEMORY MANAGEMENT

Secure Your Mobile Workplace

Android Developer Fundamental 1

Operating System Structures

A Look through the Android Stack

QUIRE: : Lightweight Provenance for Smart Phone Operating Systems

Restraining Execution Environments

Understanding class paths in Java EE projects with Rational Application Developer Version 8.0

ARM-BASED PERFORMANCE MONITORING FOR THE ECLIPSE PLATFORM

Cross-platform mobile development with Visual C

VOC Documentation. Release 0.1. Russell Keith-Magee

Transcription:

Leave The App Alone! - Attack and Defense of Android App Hijack SESSION ID:MBS-W05 Rongyu Zhou Senior Research Engineer Baidu Inc.

Outline Root or Not Root App Hijack Hook Insight Demo: App Hijack Detection & Fix for App Hijack Leave My App Alone Create A Trusted App Runtime 2

Root or Not Root

Root or Not Root It s not the main topic I d talk about today But it s indeed a simple question Root: pre-installed, auto startup, customization, etc. Not Root: unsafe! So, what we need is Safe Root 4

Root Risks Android keeps each App s security by creating a different user for each App to distinguish permissions Each App could apply for Root permission After Root, your App could be accessed by others Memory modifications File access 5

Process of Chrome after hijacked 6

App Hijack

What s App Hijack? App Hijack: App s workflow is redirected by others Usually achieved by Inject and Hook 8

App Hijack s Process Reverse App to get its main logic Inject evil module into App s process Ptrace Dlopen Hook Java Hook Native(so) Hook 9

Process of Inject and Hook 10

Hook Insight

App which has Hook actions Virus: few More costs to develop and maintain Root is required Security App: some Active Defense/Behavior Monitor 12

Hook: malware Wind Seeker 13

Hook: Security App Popular Security App: Those which have hook actions: 14

Hook Types Java Hook Static Field Hook Method Hook Native So Hook GOT Hook: Global Offset Table hook SYM Hook: Dynamic Symbol hook Inline Hook 15

Java Static Field Hook Change the value of Java Class s static field By reflecting Class<?> cls = Class.ForName( ) Field fld = cls.getdeclaredfield( ) Why static field? Reflection only gets a Class DEFINITION, not a Class OBJECT 16

Java static field hook sample 17

Java Method Hook Change a Java class s method pointing to a custom method Dalvik: Java Method -> Native Method ART: Method Inline Hook 18

Java Method Hook Dalvik Java method is Dex byte code:method->insns Q: Dex byte code inline hook? A: Too complicated! Change Java method into Native method Method->nativeFunc points to a custom native method 19

So GOT Hook Modify the a function s address stored in the GOT table of the so loaded by the App GOT Global Offset Table PLT Store the addresses of functions imported by the library/executable Procedure Linkage Table Will call GOT items to get the function s absolute address 20

So GOT Hook Normal workflow Workflow after hook 21

So SYM Hook Modify dependent library s exported symbol s value Weakness Hook the needed library before loading current library/executable 22

So SYM Hook Process 23

So Inline Hook Modify a function s inline instructions Jumping has a distance restriction Compatibility for Arm and Thumb Advantage: global coverage Disadvantage: difficult and unstable 24

So Inline Hook Process 25

Hook Zygote Global Hook Hook all processes already running, and monitor new processes Hook Zygote All App processes are forked by Zygote If Zygote is injected/hooked, all the forked App processes are injected/forked as well 26

Hook Zygote Before Hook After Hook 27

Popular Hook Frameworks Xposed http://repo.xposed.info/ Cydia Substrate http://www.cydiasubstrate.com/ ADBI/DDI https://github.com/crmulliner/adbi https://github.com/crmulliner/ddi 28

Pop Hook Frameworks: Xposed The most popular open source hook framework in Android platform Replace app_process Java Method -> Native Method Before original method is executed, call BeforeHook/AfterHook interfaces Zygote restart is required to update hooks 29

Pop Hook Frameworks: Cydia Substrate Compatible with ios and Android More popular in ios Zygote restart is required 30

Pop Hook Frameworks: Comparison XPosed Cydia Substrate 31

App Hijack Demo

Demo:Facebook Logon Hijack (Will replace with the correct snapshot in final version) 33

Demo:China Merchants Bank WebView Phishing Attack (Will replace with the correct snapshot in final version) 34

Fix for App Hijack

Hook Fix: Java Hook Static Field Hook Detection Check whether the field s class is defined in current DEX or framework Fix Failed: original value is unreachable 36

Hook Fix: Java Hook Method hook Dalvik: Java->Native Detection Check whether the method s instructions lie in current App Fix Failed: Java->Native is not invertible 37

Hook Fix: So Hook GOT hook Detection: check the library pointed by the GOT address Fix: reload the library on the disk to get the correct address SYM hook Detection: check the library pointed by the Symbol address Fix: reload the library on the disk to get the correct address Inline hook Detection: parse the instructions Fix: reload the library and restore the modified instructions 38

Inject Fix Why fix injection? Sometimes, inject only, no hook: remote monitor thread How to fix: munmap Hook Fix must be done first Unstable, Crash 39

Fix Zygote Q: How to protect Zygote from hijacking? Zygote is started by Init Protect Zygote in a very early stage Q: How to ensure the protector to start earlier than others? Learn from Xposed to replace app_process? System modifications are not first choice Compatibility issues Less configurability 40

Fix for App Hijack: Conclusion Three Basic Points: Hooks could not be fixed basically Injects could not be removed basically Zygote could not be protected basically 41

Leave My App Alone Create A Trusted App Runtime

Create A Trusted App Runtime Create a trusted Zygote Process Protect the trusted Zygote Make App fork from the trusted Zygote 43

Create Trusted Zygote Step1: Start a new Zygote process Compile a our own app_process No restart required 44

Protect Trusted Zygote Step2: Protect trusted Zygote process Anti Debug/Anti Inject Ptrace_me Double-Process protection Other protections 45

Control Trusted Zygote Fork App through trusted Zygote Redirect the socket communication from ActivityManagerService to Zygote Control White List: redirect the socket to trusted zygote Black List: redirect the socket to old zygote 46

Trusted App Runtime: the Whole Picture 47

Demo:Choose any App you want to run in a trusted runtime 48

Thanks / Q&A