HOOKER A solution to analyze Android markets Dimitri Kirchner - - PowerPoint PPT Presentation

hooker
SMART_READER_LITE
LIVE PREVIEW

HOOKER A solution to analyze Android markets Dimitri Kirchner - - PowerPoint PPT Presentation

HOOKER A solution to analyze Android markets Dimitri Kirchner @Tibapbedoum Georges Bossert @Lapeluche AMOSSYS PhD candidate AMOSSYS / Supelec IT security engineer AMOSSYS Protocole Reverse Engineering Android Hooker: a solution to


slide-1
SLIDE 1

HOOKER

A solution to analyze Android markets

Dimitri Kirchner – @Tibapbedoum Georges Bossert – @Lapeluche AMOSSYS

slide-2
SLIDE 2

PhD candidate AMOSSYS / Supelec IT security engineer AMOSSYS Protocole Reverse Engineering Android

Hooker: a solution to analyze Android markets 2

slide-3
SLIDE 3

IT security engineer at AMOSSYS since 2010 Android Informatique de confiance

3 Hooker: a solution to analyze Android markets

slide-4
SLIDE 4

4 Hooker: a solution to analyze Android markets

slide-5
SLIDE 5

5 Hooker: a solution to analyze Android markets

slide-6
SLIDE 6

6 Hooker: a solution to analyze Android markets

slide-7
SLIDE 7

7 Hooker: a solution to analyze Android markets

slide-8
SLIDE 8

8

slide-9
SLIDE 9

Android security model

Ask the user for permissions in order to access phones ressources (texts, GPS, etc.)

Hooker : a solution to analyze your Android market 9

slide-10
SLIDE 10

10 Hooker: a solution to analyze Android markets

slide-11
SLIDE 11

11 Hooker: a solution to analyze Android markets

slide-12
SLIDE 12

12 Hooker: a solution to analyze Android markets

slide-13
SLIDE 13

13 Hooker: a solution to analyze Android markets

slide-14
SLIDE 14

Let’s say, I really need this app…

What the application does with its ressources ? Are resources really used by the application ? Are resources used in a legitimate way ?

14 Hooker: a solution to analyze Android markets

slide-15
SLIDE 15

You already have solutions for that

Static versus dynamic analysis tools

15 Hooker: a solution to analyze Android markets

slide-16
SLIDE 16

16 Hooker: a solution to analyze Android markets

Androguard JD-Core/GUI Etc.

slide-17
SLIDE 17

Dynamic analysis

Solution 1: Build a custom Android ROM (Droidbox) to instrument the kernel

17 Hooker: a solution to analyze Android markets

slide-18
SLIDE 18

Dynamic analysis

Solution 1: Build a custom Android ROM (Droidbox) to instrument the kernel Solution 2: Modify APK before install (APIMonitor / Fino) to instrument the APK

18 Hooker: a solution to analyze Android markets

slide-19
SLIDE 19

Dynamic analysis

Solution 1: Build a custom Android ROM (Droidbox) to instrument the kernel Solution 2: Modify APK before install (APIMonitor / Fino) to instrument the APK Solution 3: API hooking framework (Substrate / Xposed)

19 Hooker: a solution to analyze Android markets

slide-20
SLIDE 20

Online scanners

Mix of static and dynamic Fancy user interface and reports

20 Hooker: a solution to analyze Android markets

slide-21
SLIDE 21

21 Hooker: a solution to analyze Android markets

slide-22
SLIDE 22

Analysis are centered on one application

Is it possible to analyze more than one application ? Can you analyze an entire market ?

22 Hooker: a solution to analyze Android markets

slide-23
SLIDE 23

Introducing hooker

23 Hooker: a solution to analyze Android markets

slide-24
SLIDE 24

What is Hooker

A solution to analyze Android applications Centralize and aggregate analysis of thousands of differents applications

24 Hooker: a solution to analyze Android markets

slide-25
SLIDE 25
slide-26
SLIDE 26

How Hooker works

Microanalysis versus Macroanalysis

26 Hooker: a solution to analyze Android markets

slide-27
SLIDE 27

How Hooker works

Microanalysis versus Macroanalysis

27 Hooker: a solution to analyze Android markets

slide-28
SLIDE 28

How Hooker works

Microanalysis versus Macroanalysis

28

Analysis of several applications

Hooker: a solution to analyze Android markets

slide-29
SLIDE 29

29

Microanalysis overview

Hooker: a solution to analyze Android markets

slide-30
SLIDE 30

Rule n1: Gather all possible information about the application behavior

Hooker : a solution to analyze your Android market 30

slide-31
SLIDE 31

Step 1: Androguard

It just works great Framework in python Let us extract basic information about the application

Package name Permissions Services Etc.

31 Hooker: a solution to analyze Android markets

slide-32
SLIDE 32

Step 2: Substrate

An API hooking framework Changes behavior of one application, without patches, or specific ROM, or whatever What you need is:

Root access Compatible Android version

32 Hooker: a solution to analyze Android markets

slide-33
SLIDE 33

Substrate

Injects code into Zygote process (father of all processes) Therefore, injected in all spawned processes

(Similar to Xposed)

33 Hooker: a solution to analyze Android markets

slide-34
SLIDE 34

Use Substrate to:

Hook access to personal information (read contacts, etc.) Hook access to specific API (open socket) Modify return of specific methods (anti-anti-emulation)

34 Hooker: a solution to analyze Android markets

slide-35
SLIDE 35

Hook PowerManager methods

35 Hooker: a solution to analyze Android markets

slide-36
SLIDE 36

Hook PowerManager methods

36

Methods name

Hooker: a solution to analyze Android markets

slide-37
SLIDE 37

37

Build events in real time

Hooker: a solution to analyze Android markets

slide-38
SLIDE 38

38

Build events in real time

Hooker: a solution to analyze Android markets

slide-39
SLIDE 39

39

Build events in real time

Hooker: a solution to analyze Android markets

slide-40
SLIDE 40

Intrusive level indicator

Differentiates critical event from normal event Writing is considered more intrusive than reading Application doing lots of intrusive events is highlighted

40 Hooker: a solution to analyze Android markets

slide-41
SLIDE 41

41 Hooker: a solution to analyze Android markets

slide-42
SLIDE 42

42 Hooker: a solution to analyze Android markets

slide-43
SLIDE 43

43 Hooker: a solution to analyze Android markets

slide-44
SLIDE 44

44 Hooker: a solution to analyze Android markets

slide-45
SLIDE 45

Main limitation

White list enumeration We don’t intercept what we don’t declare

45 Hooker: a solution to analyze Android markets

slide-46
SLIDE 46

Main limitation

White list enumeration We don’t intercept what we don’t declare

46 Hooker: a solution to analyze Android markets

slide-47
SLIDE 47

47 Hooker: a solution to analyze Android markets

slide-48
SLIDE 48

48 Hooker: a solution to analyze Android markets

slide-49
SLIDE 49

Store events in a distributed database

Elastic search

Interact with database

Kibana (front-end)

49 Hooker: a solution to analyze Android markets

slide-50
SLIDE 50

Hooker : a solution to analyze your Android market 50

slide-51
SLIDE 51

You have to build your own Kibana interface Basic malware generates 2000 events in 60 seconds

51 Hooker: a solution to analyze Android markets

slide-52
SLIDE 52

Macroanalysis

52 Hooker: a solution to analyze Android markets

slide-53
SLIDE 53

Macroanalysis

Automation and parallelization of microanalysis

53 Hooker: a solution to analyze Android markets

slide-54
SLIDE 54

Macroanalysis

Automation and parallelization of microanalysis Look for specific patterns in thousands of applications

54 Hooker: a solution to analyze Android markets

slide-55
SLIDE 55

Macroanalysis

Automation and parallelization of microanalysis Look for specific patterns in thousands of applications

55 Hooker: a solution to analyze Android markets

Post analysis

slide-56
SLIDE 56

Macroanalysis

Automation and parallelization of microanalysis Look for specific patterns in thousands of applications

56 Hooker: a solution to analyze Android markets

Post analysis Data mining

slide-57
SLIDE 57

Automation

Step 1: Prepare an Android emulator Step 2: Configure a scenario

Install Execute Stimulate External stimulation Reboot

57 Hooker: a solution to analyze Android markets

slide-58
SLIDE 58

Automation

Step 1: Prepare an Android emulator Step 2: Configure a scenario

Install Execute Stimulate External stimulation Reboot

58 Hooker: a solution to analyze Android markets

slide-59
SLIDE 59

Automation

Step 1: Prepare an Android emulator Step 2: Configure a scenario

Install Execute Stimulate External stimulation Reboot

59 Hooker: a solution to analyze Android markets

slide-60
SLIDE 60

Automation

Step 1: Prepare an Android emulator Step 2: Configure a scenario

Install Execute Stimulate External stimulation Reboot

60 Hooker: a solution to analyze Android markets

Phone call SMS reception GPS stimulation, etc.

slide-61
SLIDE 61

Step 3: Run the experiment

$ python hooker_xp.py –c automaticAnalysis.conf Wait and see

61 Hooker: a solution to analyze Android markets

slide-62
SLIDE 62

Post-analysis

Python script to query Elasticseach database Query what you want to make:

  • Statistics
  • Hightlights

62 Hooker: a solution to analyze Android markets

slide-63
SLIDE 63

Get thousands of APKs Google store Unofficial markets APK in archives

63 Hooker: a solution to analyze Android markets

slide-64
SLIDE 64

Get thousands of APKs Google store Unofficial markets APK in archives What we have tried until now: 1000 apps from SlideMe market in the paper 1000 apps from Google store

64 Hooker: a solution to analyze Android markets

slide-65
SLIDE 65

Network statistics

Hooker : a solution to analyze your Android market 65

slide-66
SLIDE 66

Hooker : a solution to analyze your Android market 66

50 100 150 200 250 300

setCertificate getProtocol connect close getPort closeSocket getHost

  • penConnection

Socket URL getOutputStream getSettings IOException getInputStream getAuthority execute recvfrom sendto getFile

Number of applications

Most used Network methods

slide-67
SLIDE 67

Internet permissions 477 apps asking for internet permissions 404 have been found using it

67 Hooker: a solution to analyze Android markets

slide-68
SLIDE 68

Hooker : a solution to analyze your Android market 68

10 20 30 40 secure.gameloft.com ade.wooboo.com.cn www.google.com googleads.g.doubleclick.net mm.admob.com www.google-analytics.com Number of applications

Domains most accessed

slide-69
SLIDE 69

Hooker : a solution to analyze your Android market 69

10 20 30 40 secure.gameloft.com ade.wooboo.com.cn www.google.com googleads.g.doubleclick.net mm.admob.com www.google-analytics.com Number of applications

Domains most accessed

Advertisements

slide-70
SLIDE 70

Hooker : a solution to analyze your Android market 70

50 100 150 80 443 5220 1130 305 5122 Number of applications Port number

Port number accessed by applications

slide-71
SLIDE 71

Hooker : a solution to analyze your Android market 71

50 100 150 80 443 5220 1130 305 5122 Number of applications Port number

Port number accessed by applications

Noknok trojan?

slide-72
SLIDE 72

Wanna find some vulnerable apps?

Hooker : a solution to analyze your Android market 72

slide-73
SLIDE 73

Hooker : a solution to analyze your Android market 73

slide-74
SLIDE 74

Hooker : a solution to analyze your Android market 74

Interface to call Java from javascript

slide-75
SLIDE 75

Hooker : a solution to analyze your Android market 75

Interface to call Java from javascript

slide-76
SLIDE 76

On 1000 applications from Google store 23 apps using addJavascriptInterface method

76 Hooker: a solution to analyze Android markets

slide-77
SLIDE 77

Crypto statistics

Hooker : a solution to analyze your Android market 77

slide-78
SLIDE 78

Hooker : a solution to analyze your Android market 78

20 40 60 80 100 120 140 PBEWithSHA256And256BitAES-CBC-BC AES DES/CBC/PKCS5Padding AES/CBC/PKCS5Padding DES Blowfish AES/CBC/PKCS7Padding AES/CBC/NoPadding AES/ECB/PKCS5Padding AES/ECB/NoPadding PBEwithMD5andDES DESede Number of applications

Use of cypher functions

slide-79
SLIDE 79

Hooker : a solution to analyze your Android market 79

20 40 60 80 100 120 140 PBEWithSHA256And256BitAES-CBC-BC AES DES/CBC/PKCS5Padding AES/CBC/PKCS5Padding DES Blowfish AES/CBC/PKCS7Padding AES/CBC/NoPadding AES/ECB/PKCS5Padding AES/ECB/NoPadding PBEwithMD5andDES DESede Number of applications

Use of cypher functions

No padding

slide-80
SLIDE 80

Hooker : a solution to analyze your Android market 80

20 40 60 80 100 120 140 PBEWithSHA256And256BitAES-CBC-BC AES DES/CBC/PKCS5Padding AES/CBC/PKCS5Padding DES Blowfish AES/CBC/PKCS7Padding AES/CBC/NoPadding AES/ECB/PKCS5Padding AES/ECB/NoPadding PBEwithMD5andDES DESede Number of applications

Use of cypher functions

DES…

slide-81
SLIDE 81

Hooker : a solution to analyze your Android market 81

Bitcoin miners

slide-82
SLIDE 82

Hooker : a solution to analyze your Android market 82

Bitcoin miners « Several apps from the GPlay are infected by crypto miners »

slide-83
SLIDE 83

Hooker : a solution to analyze your Android market 83

50 100 150 200 250 Number of "digest" operations Applications

Crypto hashing abuses

Bitcoin miners « Several apps from the GPlay are infected by crypto miners »

slide-84
SLIDE 84

File statistics

Hooker : a solution to analyze your Android market 84

slide-85
SLIDE 85

Hooker : a solution to analyze your Android market 85

50 100 150 200 /proc/cpuinfo /system/lib/libmedia_jni.so / /proc/meminfo /system/lib/libsoundpool.so /sdcard /system/etc/security/cacerts /mnt/sdcard /vendor/lib/libsoundpool.so /data/misc/keychain/cacerts-removed /vendor/lib/libmedia_jni.so /data/misc/keychain/cacerts-added Number of applications

Files accessed by application other than their /data/

slide-86
SLIDE 86

Hooker : a solution to analyze your Android market 86

50 100 150 200 /proc/cpuinfo /system/lib/libmedia_jni.so / /proc/meminfo /system/lib/libsoundpool.so /sdcard /system/etc/security/cacerts /mnt/sdcard /vendor/lib/libsoundpool.so /data/misc/keychain/cacerts-removed /vendor/lib/libmedia_jni.so /data/misc/keychain/cacerts-added Number of applications

Files accessed by application other than their /data/

Shared libraries

slide-87
SLIDE 87

Hooker : a solution to analyze your Android market 87

50 100 150 200 /proc/cpuinfo /system/lib/libmedia_jni.so / /proc/meminfo /system/lib/libsoundpool.so /sdcard /system/etc/security/cacerts /mnt/sdcard /vendor/lib/libsoundpool.so /data/misc/keychain/cacerts-removed /vendor/lib/libmedia_jni.so /data/misc/keychain/cacerts-added Number of applications

Files accessed by application other than their /data/

Certificates

slide-88
SLIDE 88

Hooker : a solution to analyze your Android market 88

File accesses are illustrating application behavior…

slide-89
SLIDE 89

Hooker : a solution to analyze your Android market 89

Backup app

slide-90
SLIDE 90

Hooker : a solution to analyze your Android market 90

slide-91
SLIDE 91

Hooker : a solution to analyze your Android market 91

slide-92
SLIDE 92

Hooker : a solution to analyze your Android market 92

That’s weird right?

slide-93
SLIDE 93

Hooker : a solution to analyze your Android market 93

That’s weird right? Is this app legitimate?

slide-94
SLIDE 94

Hooker has a lot more capabilities You chose to extract what you want

Hooker : a solution to analyze your Android market 94

slide-95
SLIDE 95

Hightlight weaknesses in application Hightlight malwares within thousands of applications Hightlight WTF behavior on your system

Hooker : a solution to analyze your Android market 95

slide-96
SLIDE 96

Hightlight weaknesses in application Hightlight malwares within thousands of applications Hightlight WTF behavior on your system Give it a try, play hooker now: https://github.com/AndroidHooker

Hooker : a solution to analyze your Android market 96

slide-97
SLIDE 97

Questions

Play hooker now:

https://github.com/AndroidHooker

?