37
Android Malware Analysis Attack & Defense Author: JongWon Kim [email protected]

Android Malware Analysis

Embed Size (px)

Citation preview

Page 1: Android Malware Analysis

Android Malware Analysis

Attack & Defense

Author: JongWon Kim

[email protected]

Page 2: Android Malware Analysis

Motivation

•  Someone posted it on the Facebook. I am also curious about the “machine.apk” file.

Page 3: Android Malware Analysis

Static Analysis - Tools

•  apktool – can decode resources to nearly original form

and rebuild them after making some modifications

•  dex2jar – used by translator dex to jar

•  jd-gui – a standalone graphical utility that displays

Java source codes of “.class” file

Page 4: Android Malware Analysis

Dynamic Analysis - Tools

•  Anubis – can decode resources to nearly original form

and rebuild them after making some modifications

•  CopperDroid – used by dex-translator

•  VirusTotal – used to check out Anti-Virus results

Page 5: Android Malware Analysis

AndroidManifest.xml

•  Convert “AndroidManifest.xml” from binary format to xml format (by apktool)

•  First, check out “Permission”

•  Second, check out interesting “Activity, Service, Receiver”

Page 6: Android Malware Analysis

Permission

•  Guess that it will track your location, steal sms and contracts, and do tapping. Let’s go details.

Page 7: Android Malware Analysis

Permission - 1

•  Allows an application to create network sockets.

Page 8: Android Malware Analysis

Permission - 2

•  ACCESS_FINE_LOCATION –  based on GPS

•  ACCESS_COARSE_LOCATION –  based on WIFI

Page 9: Android Malware Analysis

Permission - 3

•  CALL_PHONE –  Allows an application to initiate a phone call without going

through the Dialer user interface for the user to confirm the call being placed.

•  READ_PHONE_STATE –  Allows read only access to phone state.(ex. phone number)

Page 10: Android Malware Analysis

Permission - 4

•  RECEIVE_BOOT_COMPLETED – Allows an application to receive the

ACTION_BOOT_COMPLETED that is broadcast after the system finishes booting.

Page 11: Android Malware Analysis

Interesting Things

•  Figure out interesting service name such as “TappingService” and “GPSTracking”.

Page 12: Android Malware Analysis

Static Analysis

•  Decompile – Convert classes.dex to .jar by dex2jar and take a

look at it by jd-gui.

•  Strategy is very Simple 1.  Examine the “.MainActivity”. 2.  Follow the piece of the code.

Page 13: Android Malware Analysis

Static Analysis

•  Set preference to 0(READ/WRITE)

Page 14: Android Malware Analysis

Static Analysis

•  Save “AllowTapping” variable to “0”.

Page 15: Android Malware Analysis

Static Analysis

•  Let’s check out to “doRegisterUser()”.

Page 16: Android Malware Analysis

Static Analysis

•  “doRegisterUser()” extract phone number and Network operators.

Page 17: Android Malware Analysis

Static Analysis

•  Send them to Thailand.

Page 18: Android Malware Analysis

Static Analysis

•  Let’s check out “PreodicService”. Maybe it originally is from Periodic Service.

Page 19: Android Malware Analysis

Static Analysis

•  Service Life Cycle.

Page 20: Android Malware Analysis

Static Analysis

•  Let’s Analysis “PreodicService”. –  schedule(myTask, start-time, repeat cycle);

Page 21: Android Malware Analysis

Static Analysis

•  Let’s Analysis “AutoCallPhone”. – Request 2 times.

Page 22: Android Malware Analysis

Static Analysis

•  Let’s check out “TappingService”.

Page 23: Android Malware Analysis

Static Analysis

•  Let’s check out MediaRecorder Flow.

Page 24: Android Malware Analysis

Static Analysis

•  Let’s check out “startTapping()”.

Page 25: Android Malware Analysis

Static Analysis

•  Let’s check out “startTapping()”.

Page 26: Android Malware Analysis

Static Analysis

•  Let’s check out “stopTapping()”.

Page 27: Android Malware Analysis

Static Analysis

•  Let’s check out “GPSTracking”.

Page 28: Android Malware Analysis

Static Analysis

•  Let’s check out “GPSTracking”.

Page 29: Android Malware Analysis

Static Analysis

•  Let’s check out “GPSTracking”.

Page 30: Android Malware Analysis

Static Analysis

•  Let’s check out “RegDPMActivity”. – Device Policy Manager

Page 31: Android Malware Analysis

Static Analysis

•  Let’s check out on create of “RegDPMActivity”.

Page 32: Android Malware Analysis

Static Analysis

•  Let’s check out “CallBroadcastReceiver”.

Page 33: Android Malware Analysis

Static Analysis

•  Let’s check out “SMSBroadcastReceiver”.

Page 34: Android Malware Analysis

Dynamic Analysis

•  CopperDroid and Anubis. – As experienced, CopperDroid works good on

network traffic analysis and Anubis works good on timeline analysis.

Page 35: Android Malware Analysis

Reference - 1

•  A collection of mobile security resources – http://wiki.secmobi.com/

•  Abunis – http://anubis.iseclab.org

•  CopperDorid – http://copperdroid.isg.rhul.ac.uk/copperdroid/

•  VirusTotal – https://www.virustotal.com

•  My location – http://blog.naver.com/PostView.nhn?blogId=new

efgold777&logNo=90104291392

Page 36: Android Malware Analysis

Reference - 2

•  Preference – http://blog.daum.net/agapeuni/77

•  TelephonyManager – http://arabiannight.tistory.com/73

•  Service LifeCycle – http://gongdoo.tistory.com/235 – http://www.androes.com/137

•  Timer – http://infodev.tistory.com/126

•  Flags – http://surprisen.egloos.com/

Page 37: Android Malware Analysis

Reference - 3

•  RequestLocationUpdates – http://blog.naver.com/PostView.nhn?blogId=har

a9&logNo=10155762477 •  getSystemService

– http://promobile.tistory.com/169 •  onCallStateChanged

– http://daddycat.blogspot.kr/2011/05/android-broadcastreceiver-event-catch.html

•  URL Decoder/Encoder – http://meyerweb.com/eric/tools/dencoder/

•  Google Maps lat/long finder – http://www.doogal.co.uk/LatLong.php