Wangjun Hong, Zhengyang Qu, Northwestern University, IL, US,

Slides:



Advertisements
Similar presentations
Cracking the Code of Mobile Application OWASP APPSEC USA 2012
Advertisements

Aurasium: Practical Policy Enforcement for Android Applications By Yaoqi USENIX Security Symposium 2012.
Northwestern University, IL, US,
Operating System Security : David Phillips A Study of Windows Rootkits.
Build your Android App with Gradle Android new build system.
Aurasium: Practical Policy Enforcement for Android Applications R. Xu, H. Saidi and R. Anderson Presented By: Rajat Khandelwal – 2009CS10209 Parikshit.
.NET IL Obfuscation Presented by: Sarath Chandra Dorbala.
DECOMPILING ANDROID Godfrey Nolan 1DevDay 11/5/11.
PROJECT IN DISTRIBUTED SYSTEMS IPERF FOR ANDROID Developers: Shir Degani, Yuval Degani Supervisors: Prof. Roy Friedman, Alex Kogan.
George Blank University Lecturer. CS 602 Java and the Web Object Oriented Software Development Using Java Chapter 4.
Obfuscation and Hardening tool for Android Apps Instrumenting Android apps for runtime/dynamic analysis. Raman Goyal B.Tech - IT (Undergraduate) IIIT Allahabad,
Page 1 Sandboxing & Signed Software Paul Krzyzanowski Distributed Systems Except as otherwise noted, the content of this presentation.
Java Security Updated May Topics Intro to the Java Sandbox Language Level Security Run Time Security Evolution of Security Sandbox Models The Security.
Presentation By Deepak Katta
Reverse Engineering Obfuscated Android Applications
Introduction to Mobile Malware
VMM Based Rootkit Detection on Android Class Presentation Pete Bohman, Adam Kunk, Erik Shaw.
DroidKungFu and AnserverBot
Java Security. Topics Intro to the Java Sandbox Language Level Security Run Time Security Evolution of Security Sandbox Models The Security Manager.
Introduction to Android Swapnil Pathak Advanced Malware Analysis Training Series.
Authors: William Enck The Pennsylvania State University Peter Gilbert Duke University Byung-Gon Chun Intel Labs Landon P. Cox Duke University Jaeyeon Jung.
Presented by: Kushal Mehta University of Central Florida Michael Spreitzenbarth, Felix Freiling Friedrich-Alexander- University Erlangen, Germany michael.spreitzenbart,
APKInspector -Static Analysis of Android Applications Student: Yuan Tian Mentor: Cong Zheng Backup Mentor: Anthony Kara Jianwei 08/22/2012.
Is Your Mobile App Secure. DEF CON 23 Wall of Sheep Sat
Security.  is one of the most widely used and regarded network services  currently message contents are not secure may be inspected either.
The Terminator to Android Hardening Services
University of Central Florida TaintDroid: An Information-Flow Tracking System for Realtime Privacy Monitoring on Smartphones Written by Enck, Gilbert,
Basic Security: Java vs.NET Master Seminar Advanced Software Engineering Topics Prof. Jacques Pasquier-Rocha Software Engineering Group Department of Informatics.
EECS 354 Network Security Reverse Engineering. Introduction Preventing Reverse Engineering Reversing High Level Languages Reversing an ELF Executable.
AppShield: A Virtual File System in Enterprise Mobility Management Zhengyang Qu 1 Northwestern University, IL, US,
Android Malware Ananto Dharmo Aji & RnD Team
Android Security Auditing Slides and projects at samsclass.info.
Christopher Kruegel University of California Engin Kirda Institute Eurecom Clemens Kolbitsch Thorsten Holz Secure Systems Lab Vienna University of Technology.
VMM Based Rootkit Detection on Android Class Presentation Pete Bohman, Adam Kunk, Erik Shaw.
Finding Diversity in Remote Code Injection Exploits Justin Ma, John Dunagan, Helen J. Wang, Stefan Savage, Geoffrey M. Voelker *University of California,
1 Java applications reverse engineering Antoni Bertel AUGUST 4, 2015.
Core Java Introduction Byju Veedu Ness Technologies httpdownload.oracle.com/javase/tutorial/getStarted/intro/definition.html.
Slides and projects at samsclass.info. Adding Trojans to Apps Slides and projects at samsclass.info.
Title of Presentation DD/MM/YYYY © 2015 Skycure Why Are Hackers Winning the Mobile Malware Battle.
Getting Started with the Open Services Gateway Initiative (OSGi) CNT 5517 Dr. Sumi Helal, Ph.D. Professor Computer & Information Science & Engineering.
Dilip Dwarakanath.  The topic I’m about to present was taken from a paper titled “Apple iOS 4 Security Evaluation” written by Dino A Dai Zovi.  Dino.
1 Session 4 Module 6: Digital signatures. Digital Signatures / Session4 / 2 of 18 Module 4, 5 - Review (1)  Java 2 security model provides a consistent.
Canh Le My  Motivation  Android app packing  How android execute your application  Available tools  Demonstration 2.
Chapter 11: Advanced Inheritance Concepts. Objectives Create and use abstract classes Use dynamic method binding Create arrays of subclass objects Use.
VMM Based Rootkit Detection on Android
Reference Types CSE301 University of Sunderland Harry R Erwin, PhD.
Java & The Android Stack: A Security Analysis Pragati Ogal Rai Mobile Technology Evangelist PayPal, eBay Java.
 Group 6 Project Presentation. Application Overview  The idea of the Android application is to use the Gale–Shapley algorithm that will match Medical.
G2 - Keit Team members: ●Siyang Piao ●Peter Huang ●Bojun Jin ●Ivy Wang ●Jing Wang.
CopperDroid Logan Horton. Android - Background Android is complicated to analyse due to having 2 places to check for code execution Normally, code is.
Sung-Dong Kim, Dept. of Computer Engineering, Hansung University Java - Introduction.
1. Presentation Agenda  Identify Java Card Technology  Identify Elements of Java Card applications  Communicating with a Java Card Applet  Java Card.
Joshua Garcia Institute for Software Research
Android Mobile Application Development
Swords and shields: A study of mobile game hacks and existing defences
Application of Obfuscation Techniques on Android Applications
Cash Me Presented By Group 8 Kartik Patel, Aaron Zhong, Wen-Kai Chen,
AUDACIOUS: USER DRIVEN ACCESS CONTROL WITH UNMODIFIED OPERATING SYSTEM
Zhengyang Qu, Shahid Alam. , Yan Chen, Xiaoyong Zhou
Harvesting Runtime Values in Android Applications That Feature Anti-Analysis Techniques Presented by Vikraman Mohan.
TaintART: A Practical Multi-level Information-Flow Tracking System for Android RunTime Sadiq Basha.
Presented by Xiaohui (Amy) Lin
UoABuddyApp.
Introduction Enosis Learning.
Un</br>able’s MySecretSecrets
.NET Framework: Backdoors
Introduction Enosis Learning.
Anatomy of a Java Program
Android Platform, Android App Basic Components
M S COLLEGE ART’S, COMM., SCI. & BMS
Presentation transcript:

Wangjun Hong, Zhengyang Qu, Northwestern University, IL, US, Android Obfuscation Wangjun Hong, Zhengyang Qu, Northwestern University, IL, US, She worked on this project mainly during her summer internship at northwestern university.

Outline Introduction Reverse Engineering Techniques Design & Implementation Results Comparison

Android App compilation

Reverse engineering Android Apps Reverse Engineering Talk

What to benefit from reverse engineering? Inject ad-lib, repackage Steal the intelligence property Manipulate the execution of application User privacy collection, Financial loss… Cheat the game

What to benefit from reverse engineering? Inject ad-lib, repackage

Usage of Anti-reverse engineering techniques Developers: Protect their private property Harden the security of users Malware authors: Prevent the malware from being detected and analyzed

Lots of Products ProGuard: free Java class obfuscator DexGuard: the professional version of ProGuard Ijiami, bangcle: two Chinese business that focus on obfuscation Add more: logos, features

Outline Introduction Reverse Engineering Techniques Design & Implementation Results Comparison

List of Obfuscation Techniques Lexical Obfuscation Anti-debug Tamper Detection Anti-decompiling Bytecode Encryption Dynamic Loading Reflection

Lexical Obfuscation Package, class, method, variable, parameter names kept in the bytecode Extracting lexical information helps human understand algorithm and recover the java code

=> Example package com.helloworld public class OperationUtil { …… } package a.a public class A{ …… } => Using the same identifier over and over again in all classes and for all parameters at least once makes differentiation very demanding for any human analyst. To increase the complexity, overloading is used to make the differentiation of the methods even harder.

Random/Non-alpha Identifier name public final class CcoCIcI{ private static final byte[] COcocOlo; private static boolean CcoCIcI; private static BluetoothAdapter IoOoOIOI; … } package 你{ public class 音{ public void 你() {} public void 你(int ){} Trojan mentioned earlier makes use of a different approach that names classes and static variables by only using permutations of the characters o, c, i and l.Hard to memorize and differentiate. The illegibility of non-alphabetical characters enhancing this technique. But not only analysts are affected. Any software unable to deal with foreign characters will most likely produce errors or crash.

Anti-debug Stop execution when find debugger connected if (android.os.Debug.isDebuggerConnected()){ android.os.Process.killProcess(android.os.Process.myPid()); } Stop execution when running in emulator Validate device identifer IMEI, Phone number, voice mail numer, SIM serial number, subscriber ID, brand, device, model… The application stops its execution if the presence of a debugger is detected. This can be checked at the start of the application or regularly for instance at the beginning of each important method. They explore their runtime environment before they start their actual application routines.

Tamper Detection Validate the size of certain files or the file modification time stamps Hash values/checksums of code blocks, classes or the whole program Verify the signature of the apk file It will detect in runtime to see the integrity of Android app, and if it has been modified, developer can take some corresponding actions like terminate the app. In order to detect any manipulation of the application a mechanism that verifies the integrity of the application can be implemented. The check can be executed at the start of the application or before certain methods are called.

Background on Anti-decompiling Java decompiling: dex2jar + JAD Dex2jar: using this can convert the .dex files to jar (.class) JAD(Java Decompiler): convert .class to .java De-compilation flow chart To prevent the decompilation of Java/Dalvik bytecode to Java source code, language constructs only valid in bytecode can be used This gap between the different languages can be exploited by injecing different goto statements into the bytecode. In order for microprocessors to be able to execute statements of higher level programming languages, they need to be translated by using the unconditional jump instruction goto. Figure 4.1 shows a series of instructions that should never be executed. Because of the nested calls it is hard to detect the loop created with the goto statements. If the analyzer is not aware of such constructs it could either get stuck in the loop itself, crash or produce defective code. Dex2Jar JAD Dex Files jar Java

Anti-decompiling Java decompiling: dex2jar + JAD Damage the dex.class Goto not available in Java :label_1 goto :label_3 :label_2 goto :label_4 :label_3 goto :label_2 :label_4 To prevent the decompilation of Java/Dalvik bytecode to Java source code, language constructs only valid in bytecode can be used This gap between the different languages can be exploited by injecing different goto statements into the bytecode. In order for microprocessors to be able to execute statements of higher level programming languages, they need to be translated by using the unconditional jump instruction goto. Figure 4.1 shows a series of instructions that should never be executed. Because of the nested calls it is hard to detect the loop created with the goto statements. If the analyzer is not aware of such constructs it could either get stuck in the loop itself, crash or produce defective code.

Crack the apktool What is apktool? A reverse engineering tool, which can convert Android apps to .smali files, and can recompile .smali files to apk after some modification. Android primary framework of APK Packaged with dirs: lib, res, assets Rename res -> R Change the structure of APK that could not be captured by apktool APKTool is a commonly used APK decompile tool, it can be said that 99% of the market can decompile APK out with it. XML style, configuration, page file will be fully decompiled out. How to prevent apktool? We should start with the APKTool origin, APKTool is provided by the GOOGLE APK compiler tools, so completely based on the construction of Android primary framework of APK are easily crack, anti compiled catalogues are including lib, res, assets. By changing the contents frame like this, can let the failure of APKTool, the latest QQ decompile fail. See through decompression, QQ software including lib, R, assets directory, META-INF and so on, the main difference is the directory name res became R, concrete is operated by what way.

Smali Sample

Bytecode Encryption Data represented only in encrypted version within the code Have a paired function for the purpose decryption Very diverse, hard to find a general, automatic detection method Obfuscators achieve encryption by introducing new methods to decrypt data represented only in encrypted form within the code. This data can represent everything from an integer to a full-blown file archive 1 containing one or more class files. Also dictionaries are possible that contain most of the strings used in the application. We locate some fixed patterns for some commerial bytocode encryptions tools.

Dynamic Loading Dynamically load dex.class in the runtime Dex file stored as Additional file within the apk file Download from a remote source (not able to be handled by static analysis) Within the class, using a byte array See example at bangcle soon APK Wrapper Find target dex file Dynamic Loading A method can be used in Android by using a custom class loader. It needs to make use of the ”DexFile” [11] class that is part of the Android API. For the class loader to be able to load code, it needs to be in the form of a dex file.

Native Code Android Linux Kernel Native Development Kit (NDK), package parts of application written by C/C++ Invoked with Java Native Interface (JNI) Packaged in .so lib, hard to reverse engineering Might have purposes other than just obfuscation, such as performance With the Native Development Kit (NDK) parts of an application can be written in the programming languages C and C++. This is possible because of Androids architecture that is based on a Linux kernel. Using the Java Native Interface (JNI), native code can be called from within the JVM.

Reflection Inspection of classes, interfaces, fields, and methods at runtime Modify private members at runtime Hard for static analysis Crypto cryptModule = new Crypto(); privateKey = cryptModule.getPrivateKey(); Object reflectedClassInstance = Class.forName(“de.tum.secureApp.Crypto”).newInstance(); Method methodToReflect = reflectedClassInstance.getClass().getMethod(“getPrivateKey”); Object invokeResult = methodToReflect.invoke(reflectedClassINstance); Reflection is an obfuscation techniqe of the data obfuscation. It is a powerful feature, typically used to extend applications with external features, to browse classes, for debugging and in test tools. But it can also be used to obfuscate applications. https://www.youtube.com/watch?v=ciDjI5EXew0

To Summarize Lexical Obfuscation Anti-debug Tamper Detection Anti-decompiling Bytecode Encryption Dynamic Loading Reflection

Outline Introduction Reverse Engineering Techniques Obfuscation Detection: Design & Implementation Results Comparison

Framework

Lexical Obfuscation Detection Parse the class name, super class name, field name, method name, source name from smali files Construct a dictionary by db from wikiperdia Check if a identifier contains meaning words length larger than 1

Anti-debug Detection Run the application automatically on real device and emulator Check if the app only crashes on emulator

Detection of Tamper Detection Repackage and sign the application with our signature Run the resigned version and original version in parallel Check if only the resigned version crash

Anti Decompilation Detection Check if the application could be decompiled to smali by using apktool Check if the application could be decompiled to java by using dex2jar + jdcore

Other Detection Methods Native code Packaged .so file Dynamic Loading “DexClassLoader” “DexFile” Java Reflection Ljava/lang/reflect/Method Bytecode encryption Check if dex.class is packaged Check the existence of Activities in AndroidManifest,xml

Real examples Real instance of using bangcle as the obfuscation tool

ProGuard

Comparison Techniques Intention Ease of use Popularity Ease of reverse engineering Prevent injection Commerical/developer Lexical Pure Easy High Middle No Proguard Native Various developer Dynamic Loading Reflection Anti-decom Low Difficult Yes Dexguard Anti-debug Low, rarely Tamper detection Bytecode-encryption Ijiami, bangcle

In Summary What obfuscation methods are generally used in the Android Reverse Engineering?

Exercise Write an Android application which use the anti-debug technique. Hint: Try to find debugger connection or the IMEI, phone number etc. of the device.

Thank you! Questions? http://list.cs.northwestern.edu/mobile/