Top Banner
Morpheus: Automatically Generating Heuristics to Detect Android Emulators Yiming Jing , Ziming Zhao , Gail-Joon Ahn , and Hongxin Hu
26

Morpheus: Automatically Generating Heuristics to Detect … · 2019-07-16 · Morpheus: Automatically Generating Heuristics to Detect Android Emulators Yiming Jing†, Ziming Zhao†,

Jun 17, 2020

Download

Documents

dariahiddleston
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Morpheus: Automatically Generating Heuristics to Detect … · 2019-07-16 · Morpheus: Automatically Generating Heuristics to Detect Android Emulators Yiming Jing†, Ziming Zhao†,

Morpheus: Automatically Generating Heuristics to Detect Android Emulators

Yiming Jing†, Ziming Zhao†, Gail-Joon Ahn†, and Hongxin Hu‡

† ‡

Page 2: Morpheus: Automatically Generating Heuristics to Detect … · 2019-07-16 · Morpheus: Automatically Generating Heuristics to Detect Android Emulators Yiming Jing†, Ziming Zhao†,

“You take the blue pill – the story ends, you wake up in your bed and believe whatever you want to believe.

You take the red pill – you stay in the Wonderland, and I show you how deep the rabbit hole goes.

Remember: all I’m offering is truth. Nothing more”.

Morpheus to Neo, The Matrix

2

Photo by W.carter, CC: BY-SA

Page 3: Morpheus: Automatically Generating Heuristics to Detect … · 2019-07-16 · Morpheus: Automatically Generating Heuristics to Detect Android Emulators Yiming Jing†, Ziming Zhao†,

Outline

3

• Android malware, emulators, and red pills

• Design & Implementation: Morpheus

• Discovered red pills

• Evaluation

• Conclusion

Page 4: Morpheus: Automatically Generating Heuristics to Detect … · 2019-07-16 · Morpheus: Automatically Generating Heuristics to Detect Android Emulators Yiming Jing†, Ziming Zhao†,

BackgroundApplication Stores and Android Malware

4

1,300,000 apps100,000,000 users

Page 5: Morpheus: Automatically Generating Heuristics to Detect … · 2019-07-16 · Morpheus: Automatically Generating Heuristics to Detect Android Emulators Yiming Jing†, Ziming Zhao†,

BackgroundEmulator-based Dynamic Analysis Systems

5

• Emulator-based dynamic analysis

– Google Bouncer

– Andrubis, SandDroid, TraceDroid …

Photo from The Matrix, © 1999 Warner Bros. Entertainment Inc.

Page 6: Morpheus: Automatically Generating Heuristics to Detect … · 2019-07-16 · Morpheus: Automatically Generating Heuristics to Detect Android Emulators Yiming Jing†, Ziming Zhao†,

BackgroundRed Pills

6

• What if malware takes red pills

– Split personalities [Balzarotti et al., NDSS’10]

– Dynamic external code loading [Poeplau et al., NDSS’14]

Photo from The Matrix, © 1999 Warner Bros. Entertainment Inc.

Page 7: Morpheus: Automatically Generating Heuristics to Detect … · 2019-07-16 · Morpheus: Automatically Generating Heuristics to Detect Android Emulators Yiming Jing†, Ziming Zhao†,

BackgroundRed Pills

7

• Example

– getDeviceID() returns “0000…0000”

– True emulators; False real devices

– IMEI hardcoded in the emulated baseband

Page 8: Morpheus: Automatically Generating Heuristics to Detect … · 2019-07-16 · Morpheus: Automatically Generating Heuristics to Detect Android Emulators Yiming Jing†, Ziming Zhao†,

Problem Statement

8

• Existing approaches to discover red pills

– Ad-hoc

– Manual

• To comprehensively discover red pills, it is imperative to develop systematic and automated approaches.

Page 9: Morpheus: Automatically Generating Heuristics to Detect … · 2019-07-16 · Morpheus: Automatically Generating Heuristics to Detect Android Emulators Yiming Jing†, Ziming Zhao†,

Our Expected Red Pills

9

• No native code, no root exploit

• Zero or few popular permissions

• Few lines of Java code

final TelephonyManager tm = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);

if tm.getDeviceID().contains("000000000")stay_dormant();

elsedo_evil();

Page 10: Morpheus: Automatically Generating Heuristics to Detect … · 2019-07-16 · Morpheus: Automatically Generating Heuristics to Detect Android Emulators Yiming Jing†, Ziming Zhao†,

10

Morpheus Work Flow

Heuristic Extractor

Sandbox Analyzer

Heuristic Selector

Artifact Retriever

• Analyze DAC and MAC policies

• Identify observable artifacts

• Retrieve artifacts in emulators and real Android devices

• Extract artifacts whose presence or contents indicate discrepancies

• Rank candidate red pills

Page 11: Morpheus: Automatically Generating Heuristics to Detect … · 2019-07-16 · Morpheus: Automatically Generating Heuristics to Detect Android Emulators Yiming Jing†, Ziming Zhao†,

11

Sandbox Analyzer for identifying sources of observable artifacts

• Analyze the DAC and MAC policies to find artifacts that can be observed by apps

• Observe = stat or read

• Rules to identify observable artifacts1. DAC rule: objects that are world-readable or under

world-listable directories

2. MAC rule: objects that are accessible by the untrusted_app domain using read-like or stat-likeoperations

Page 12: Morpheus: Automatically Generating Heuristics to Detect … · 2019-07-16 · Morpheus: Automatically Generating Heuristics to Detect Android Emulators Yiming Jing†, Ziming Zhao†,

12

Artifact Retriever for retrieving artifacts in emulators and devices

• Send a probe into emulators and devices

– Request all non-signature permissions

– 3 modules

1. Directory walker

2. Reflection-based function caller

3. Binder IPC caller

Page 13: Morpheus: Automatically Generating Heuristics to Detect … · 2019-07-16 · Morpheus: Automatically Generating Heuristics to Detect Android Emulators Yiming Jing†, Ziming Zhao†,

13

Heuristic Extractor for extracting candidate red pills

• Extract two types of red pills

– Type E(mulator)

• True in >50% emulators and <50% real devices

– Type D(evice)

• False in >50% emulators and <50% real devices

Page 14: Morpheus: Automatically Generating Heuristics to Detect … · 2019-07-16 · Morpheus: Automatically Generating Heuristics to Detect Android Emulators Yiming Jing†, Ziming Zhao†,

14

Heuristic Extractor for extracting candidate red pills

• Extract two types of red pills

– Type E(mulator)1. /sys/qemu_trace exists2. The return value of getDeviceID contains

“000000000”

– Type D(evice)3. /proc/uid_stat exists4. The value of ro.build.tags contains “release-

key”

Page 15: Morpheus: Automatically Generating Heuristics to Detect … · 2019-07-16 · Morpheus: Automatically Generating Heuristics to Detect Android Emulators Yiming Jing†, Ziming Zhao†,

15

Heuristic Selector for ranking candidate red pills

• Mimic a feature selection process

– Labeled training set: emulator / real device

– Binary features: extracted candidate red pills

– Apply random forests to

• Generate a score for each candidate red pill

• Remove redundant red pills

Page 16: Morpheus: Automatically Generating Heuristics to Detect … · 2019-07-16 · Morpheus: Automatically Generating Heuristics to Detect Android Emulators Yiming Jing†, Ziming Zhao†,

16

Discovered Red Pills

• Experimental setup

– 3 sources of observable artifacts

• Files: /proc and /sys

• Android APIs that have no parameters

• Android system properties

– Dataset

• 16 instances of Android SDK emulators (QEMU)

• 11 instances of Genymotion™ emulators (VirtualBox)

• 25 distinct Android smartphones and tablets

Page 17: Morpheus: Automatically Generating Heuristics to Detect … · 2019-07-16 · Morpheus: Automatically Generating Heuristics to Detect Android Emulators Yiming Jing†, Ziming Zhao†,

17

Discovered Red Pills

Red Pills

File API Property Total

QEMU + VirtualBox 2,121 81 82 2,284

QEMU Only 2,961 163 132 3,256

VirtualBox Only 4,782 150 160 5,092

Total 9,864 394 374 10,632

Page 18: Morpheus: Automatically Generating Heuristics to Detect … · 2019-07-16 · Morpheus: Automatically Generating Heuristics to Detect Android Emulators Yiming Jing†, Ziming Zhao†,

18

Discovered Red Pills

• Most red pills we identified are related to software-emulated hardware

Page 19: Morpheus: Automatically Generating Heuristics to Detect … · 2019-07-16 · Morpheus: Automatically Generating Heuristics to Detect Android Emulators Yiming Jing†, Ziming Zhao†,

19

Discovered Red Pills

• Red pills for both QEMU and VirtualBox

– Network: net.eth0.dns1, isTetheringSupported()

– Power: /sys/../cpu1, /sys/.../scaling_driver

– Audio: /sys/class/i2c-dev

– USB: /sys/class/usb_device, /sys/module/usbcore

– Radio: gsm.version.baseband, getDeviceID()

Page 20: Morpheus: Automatically Generating Heuristics to Detect … · 2019-07-16 · Morpheus: Automatically Generating Heuristics to Detect Android Emulators Yiming Jing†, Ziming Zhao†,

20

Discovered Red Pills

• QEMU red pills

– QEMU: qemu.sf.fake_camera

– Goldfish: /sys/…/goldfish-battery

– Unsupported HW: /sys/module/bluetooth

• VirtualBox red pills

– VirtualBox: /sys/module/vboxguest

– PC HW: /proc/acpi, /sys/module/libata

Page 21: Morpheus: Automatically Generating Heuristics to Detect … · 2019-07-16 · Morpheus: Automatically Generating Heuristics to Detect Android Emulators Yiming Jing†, Ziming Zhao†,

21

Evaluation

• Experimental setup

– Top 10 File, API, and Property red pills

– 9 dynamic analysis tools/services

• DroidBox 2.3 and 4.1

• Andrubis, CopperDroid, SandDroid, TraceDroid

• Qihu 360, NVISO ApkScan, ForeSafe Scanner

– 128 distinct Android phones/tablets

Page 22: Morpheus: Automatically Generating Heuristics to Detect … · 2019-07-16 · Morpheus: Automatically Generating Heuristics to Detect Android Emulators Yiming Jing†, Ziming Zhao†,

22

Evaluation

• 3 red pills with 100% accuracy– /proc/ioports, “0ff\0:”, E

– /sys/devices/system/cpu/cpu0/cpufreq, D

– /sys/devices/virtual/misc/android_adb, D

• 17 red pills with >90% accuracy

Page 23: Morpheus: Automatically Generating Heuristics to Detect … · 2019-07-16 · Morpheus: Automatically Generating Heuristics to Detect Android Emulators Yiming Jing†, Ziming Zhao†,

23

Evaluation

• Binder IPC message returned by getDeviceID()contains “\0\0\03”

– Accuracy = 45.3%

– Sensitivity = 66.7%, Specificity = 43.8%

– DroidBox 4.1

• Dummy IMEI can be bypassed

– Smartphones sold in China

• IMEIs do not start with “35”

Page 24: Morpheus: Automatically Generating Heuristics to Detect … · 2019-07-16 · Morpheus: Automatically Generating Heuristics to Detect Android Emulators Yiming Jing†, Ziming Zhao†,

24

Evaluation

89.5%

62.9%

97.8%

PROPERTY

API

FILE

79.4%

89.9%

TYPE D(EVICE)

TYPE E(MULATOR)

77.0%

95.3%

CONTENT+ARTIFACT

ARTIFACT ONLY

Page 25: Morpheus: Automatically Generating Heuristics to Detect … · 2019-07-16 · Morpheus: Automatically Generating Heuristics to Detect Android Emulators Yiming Jing†, Ziming Zhao†,

Conclusion

• We have proved the threat of malware detecting Android emulators

• We have proposed Morpheus, a framework for systematically discovering red pills

• We have discovered more than 10,000 red pills, characterized them, and measured their accuracies

25

Page 26: Morpheus: Automatically Generating Heuristics to Detect … · 2019-07-16 · Morpheus: Automatically Generating Heuristics to Detect Android Emulators Yiming Jing†, Ziming Zhao†,

26

This work was supported in part by the National Science Foundation under Grant CNS-0916688 and National Research Foundation under Grant NRF-2014K1A1A2043029.

Yiming Jing

[email protected]

http://sefcom.asu.edu

Dataset and source code to be released at:http://honeynet.asu.edu/morpheus

Try our sample app