38
jason ross android malware analysis

Android malware analysis

Embed Size (px)

Citation preview

Page 1: Android malware analysis

jason ross

android malware analysis

Page 2: Android malware analysis

about me

• senior consultant @intrepidusgroup

• member of @dragonresearch

• contribute to OWASP mobile project

• point-of-contact for defcon group 585

Page 3: Android malware analysis

agenda

• why mobile / android / malware

• tools

• analysis

Page 4: Android malware analysis

why mobile?

• eBay announced that it expects over$7 billion USD via mobile in 2011

• 41% of smartphone users have made a purchase using their mobile devices

Page 5: Android malware analysis

why android?

Page 6: Android malware analysis

why malware analysis?

a) ‘bring your own device’ policies

b) lack of effective/enforceable security

c) mobile devices access corp. resources

a + b + c = ZOMG!

Page 7: Android malware analysis

current state

• android malware increasing

• payloads getting more interesting

• infection routines becoming complex

• infected apps in official & 3rd party markets

Page 8: Android malware analysis

what is malware doing?

Page 9: Android malware analysis

How can I get samples?

• open mobile malware repositories• official android market place• third party markets

Page 10: Android malware analysis

challenges

• it’s not a PC

• antivirus won’t protect you

Page 11: Android malware analysis

it’s not a PC

• got root?

• less control over the environment

• not necessarily able to intercept traffic

Page 12: Android malware analysis

antivirus won’t protect you

Page 13: Android malware analysis

process

• network• runtime• static

Page 14: Android malware analysis

tools

• generally fall into 3 categories:– “i can show you the network traffic”– “i can unpack your APK for you”– “i can turn dex back into java classes”

• fourth category starting to emerge:– “i can tell you what’s happening on the device”

Page 15: Android malware analysis

network based

• pptpd• native sdk tools• mallory

Page 16: Android malware analysis

pptpd

• setting up pptpd for VPN– pptp config– ppp config– chap-secrets

Page 17: Android malware analysis

mallory

• what is mallory?• how is it helpful?

Page 18: Android malware analysis

setting up mallory

• grab ubuntu

• run the installer script

• start intercepting traffic

Page 19: Android malware analysis

mallory configuration

• new and improved

Page 20: Android malware analysis

runtime

• emulator– installing malicious APK– using a proxy to monitor application traffic– reverting to clean image state

Page 21: Android malware analysis

static

• SDK– DDMS

• andbug• androguard• apktool• ded• dexid• dex2jar

Page 22: Android malware analysis

packages

• APKs are stored in several places:– /data/app– /data/app-private– /system/app

• You may need to have a rooted device toaccess some of these locations.

• APK =~ /ZIP/

Page 23: Android malware analysis

directories

• assets:images and stuff

• META-INF:various items (MANIFEST.MF, certs, etc.)

• res:layout and screen information

• classes.dex:the compiled smali classes

• AndroidManifest.xml:android manifest (application perms, etc.)

Page 24: Android malware analysis

droidbox

Page 25: Android malware analysis

taintdroid

Page 26: Android malware analysis

android live CD

• there really is one

• i’ve run it in virtualbox

• it’s exactly as clumsy to use as it sounds

Page 27: Android malware analysis

android livecd (screenshot)

Super Mario Brosincluded for great

justice?

Page 28: Android malware analysis

malware analysis live CDs

• REMnux, by Lenny Zeltser(http://zeltser.com/remnux/)– Ubuntu based live CD, preloaded with many

malware analysis tools

• A.R.E (http://www.honeynet.org/node/783)– Virtualbox image preloaded with Android

analysis tools. One of the best ways to get Androguard working.

Page 29: Android malware analysis

devices

• installing malicious APK• using mitm to monitor application traffic• reverting to clean image state?

Page 30: Android malware analysis

static

• overview of Android application layout– Manifest.xml– res directory– assets directory– strings.xml– other data

Page 31: Android malware analysis

this isn’t the xml you’re looking for

AndroidManifest.xml is stored as “binary” data

use apktool to get it back into a readable format:

> apktool d file.apk outputdir

Page 32: Android malware analysis

apktool

• “decompiles” the classes

• classes.dex file becomes the smali directory

follow the com.foo.trail to get to the .smali files

Page 33: Android malware analysis

smali: java + assembly (whee)

• variables get assigned sequential numeric names

• this can make the code tough to follow

Page 34: Android malware analysis

dex2jar

• why?• usage

Page 35: Android malware analysis

others

• ded• dexid• andbug• androguard

Page 36: Android malware analysis

OK, i have .class, now what?

• jd-gui• apkinspector

Page 37: Android malware analysis

automation

• scripts to manipulate the emulator environment

• scripts to manipulate 'bare metal' devices

Page 38: Android malware analysis

End

• contact info:

@rossja

jason.ross [at] intrepidusgroup [dot] com