android forensics an custom recovery image

41
Android Forensics Presented By: Mohamed Khaled Thanks to: Ibrahim Mosaad Mohamed Shawky

Upload: mohamed-khaled

Post on 15-Jul-2015

262 views

Category:

Education


1 download

TRANSCRIPT

Page 1: Android forensics an Custom Recovery Image

Android Forensics

Presented By:

Mohamed Khaled

Thanks to: Ibrahim Mosaad Mohamed Shawky

Page 2: Android forensics an Custom Recovery Image

Agenda• Mobile Forensic Process• Different Mobile Forensic Scenario• Acquisition Guide• Challenges of Android Forensics• How to Circumvent the Pass Code• Types Of Analyses(Logical analysis)• Types Of Analyses(Physical analysis)• Android Partition Layout• Custom Recovery Modifications• How Data are Stored In Android• Example of Useful Data extracted from Android

Image

Page 3: Android forensics an Custom Recovery Image

Mobile Forensic Process

Intake

Identification

Preparation

Isolation

Processing

Verification

Documenting

Presentation

Archiving

• Receive device as evidence.• Receive request for

examination• Identify device specifications & capabilities• Identify Goals of Examination

• Prepare methods and tools to be used• Prepare media and forensic workstation

for examination• Prepare tools to most recent version

• Protect the evidence – Prevent remote data destruction

• Isolate from the Cellular network, bluetooth, and Wi-Fi• Conduct forensic acquisition

– Perform forensic analysis –Scan for malware

• Validate your acquisition –Validate your forensic findings• Keep notes about your findings

and process• Draft and finalize your forensic

reports• Prepare exhibits – Present your

findings• Keep a gold copy of data in a

safe place• Keep data in common formats

for future

Page 4: Android forensics an Custom Recovery Image

Data Acquisition Types

Manual Logical Physical

Page 5: Android forensics an Custom Recovery Image

scenarios

The device might be

found to be turned off

after seizure.

have internal or removable

memory

Locked

/unlocked

Have access via USB

debug mode or not

Page 6: Android forensics an Custom Recovery Image

Acquisition GuideA-(Unlocked)

• Airplane Mode

• SIM ID Cloning

Isolate Device from the Network

• Remove passcode

• Enable USB debugging

• Enable “Stay Awake”

• Disable timed screen lock features

Take the necessary steps

to ensure physical device

access is possible• Acquire supporting media

• SIM card(s)

• Media cards

• Check associated media for device backups

Physical Acquisitions

Page 7: Android forensics an Custom Recovery Image

A1 - Isolate Device from the Network

• Airplane Mode

• Remove the SIM card.

• Place device in a shieldedbag, box, tent, or room.

Page 8: Android forensics an Custom Recovery Image

A 2-Ensure physical device access is possible

• Enable USB debugging

• Enable “Stay Awake” option

• Disable timed screen lock features

Page 9: Android forensics an Custom Recovery Image

A3 - Physical Acquisitions

• Acquire supporting media

• SIM card(s)

• Media cards

• Check associated media for device backups(Connected PC or Network)

Page 10: Android forensics an Custom Recovery Image

Acquisition GuideB-(Locked)

1

Physical access requires

that USB debugging mode

is enabled.

Forensic tools will use custom bootloaders to bypass the passcode if applicable.

2

Acquire supporting media

• SIM cards

• Media card(s)

3

Check associated

computers and media for

device backups

• Computers and media cards

Page 11: Android forensics an Custom Recovery Image

Challenges of Android Forensics

• Access to system partitions is Restricted to The Android OS.

• Techniques for obtaining root privilege differ depending on Android version, device manufacturer and model.

• The OS has Authentication mechanisms that uses passwords, tactile patterns or biometric information

Page 12: Android forensics an Custom Recovery Image

How to Circumvent thePass Code

• The smudge attack

• Flash a New Recovery Partition (Our Solution)

• Know Gmail user name andpassword for the device

• JTAG and Chip-off

Page 13: Android forensics an Custom Recovery Image

Types Of Analyses(Logical analysis)

• It is possible to backup all the present data in a cell phone without rooting

– Using Android Debug Bridge (adbbackup command).• $ adb backup -apk -shared -system -all -f %1.backup

– created a backup file which was later converted to .tar archive• $ java -jar abe.jar unpack %1.backup %1.tar

Page 14: Android forensics an Custom Recovery Image
Page 15: Android forensics an Custom Recovery Image
Page 16: Android forensics an Custom Recovery Image
Page 17: Android forensics an Custom Recovery Image

Physical Analysis (Low level analysis )

• Low level analysis is based on exact, bit to bit, copy of userdata partition.

• After the copy, this partition is stored as a single file.

• which is later used as input for other analysis tools.

• Only a root user can make such a copy, so the phone must have been rooted at first.

Page 18: Android forensics an Custom Recovery Image

What is rooting?

• Process of overcoming limitations imposed by manufacturers on smartphone or tablet owners.

• Gives an owner the ability toreplace and/or alter system applications and settings

• Run applications requiringadministrator-level privileges

• This includes listing active mounted partitions and cloning them

Page 19: Android forensics an Custom Recovery Image

Physical analysis(Recovery Mode)

• Another Way to Do Physical Analysis is by using Recovery Rom

• But first We Are Going to Talk About the Android Partition Layout

Page 20: Android forensics an Custom Recovery Image

Android Partition Layout

• boot loader

• Splash

• Boot

• Recovery

• System

• Userdata or Data

• Cache

• Radio

Page 21: Android forensics an Custom Recovery Image

Android Partition Layout (Cont.)• boot loader: Stores the phone’s boot loader

program, which takes care of :

– Initializing the hardware when the phone boots

– Booting the Android kernel

– Implementing alternative boot modes such as download mode.

• boot: Stores the Android boot image, which consists of :

– Linux kernel(zImage)

– and the root file system ram disk (initrd).

• splash: Stores the first splash screen image seen right after

powering on the device.

Page 22: Android forensics an Custom Recovery Image

Android Partition Layout (Cont.)

• userdata (data): this is the device’s internal storage for– Application data

– User files such as: pictures, videos, audio, downloads.

– This is mounted as /data on a booted system.

• system: Stores the Android system image that is mounted as /system on a device. Contains– the Android framework.

– Libraries.

– system binaries.

– pre-installed applications.

Page 23: Android forensics an Custom Recovery Image

Android Partition Layout (Cont.)

• cache: Used to store various utility files such as :

– recovery logs and update packages downloaded over-the-air. On devices with applications installed on an SD card

– it may also contain the dalvik-cache folder, which stores the Dalvik Virtual Machine (VM) cache.

Page 24: Android forensics an Custom Recovery Image

Physical analysis(Recovery Mode)

• It is an operating designed to

– apply updates

– format the device

– perform other maintenance on the devices.

• The stock recovery mode on most devices is very basic

– Only provides a number of limited functions

– Does not provide root privileges in a shell.

Page 25: Android forensics an Custom Recovery Image

Physical analysis(Recovery Mode)

• Should use extreme caution when installing a custom recovery partition as the process often contains kernel and radio updates

• Could render the device unusable “bricked”.

• Extensive testing must be performed on a lab device first to ensure no issues occur.

• Examiners should understand what is being modified on the device during the installation of a custom recovery firmware.

Page 26: Android forensics an Custom Recovery Image

Custom Recovery RomExamples

• Cyanogenmod Recovery(clockworkmod)

• TeamWin (TWRP)

Page 27: Android forensics an Custom Recovery Image

Custom Recovery Modifications

• We are going to modify in the Cyanogenmodsource code

• The source code is writen in C Programming language.

Page 28: Android forensics an Custom Recovery Image

Custom Recovery ModificationsRemove Security Pattern

• The pattern file is at – /data/system/gesture.key

• Other security pattern are in file – /data/system/password.key

• We will also use the pre defined function”__system”.– Which will enable us to run Linux commands like ls,rm,…etc

– __system("rm /data/system/gesture.key"); //remove the pattern

– __system("rm /data/system/password.key"); // remove any other lock like face or voice or password.

Page 29: Android forensics an Custom Recovery Image

• In order to do physical imaging you have to run command like– dd if = /dev/sda1 of =/media/pc/file.dd

– Where if is the source(the media whci we want to image).

– The of is the destination

• So We have to know:– the name of the driver of the source partition (i.e

/data or /system)

– The name of the destination driver (USB Flash for example)

Custom Recovery ModificationPhysical imaging

Page 30: Android forensics an Custom Recovery Image

How To Know The Name Of The Driver For The Source Partition

• Using the file

– /etc/recovery.fstab

• We will search in the /etc/recovery.fstab till we find the driver name equivalent to the partition we want to image

Page 31: Android forensics an Custom Recovery Image

Who to Know The name Of The Destination Driver (USB Flash for example)

• Vold: The volume manager daemon.

• Automatically Mount Sdcard and USB Flash memory (If connected)– When Device Startup

– OR When Connected

• We are going to search in the Vold till we find USB or SdCard.

Page 32: Android forensics an Custom Recovery Image

How Data are Stored In Android

• Android provides developers with five methods for storing data to a device.

1. Shared preferences

2. Internal storage

3. External storage

4. SQLite

5. Network

Page 33: Android forensics an Custom Recovery Image

How Data are Stored In Android(Shared preferences)

• Allow a developer to store key-value pairs of primitive data types in a lightweight XML format.

– /data/data/<com.android.contacts>/shared_prefs

• Used to set the programs configuartion

Page 34: Android forensics an Custom Recovery Image

How Data are Stored In Android(Internal storage)

• Contain more complicated data structures.

• The files are stored in the application’s /data/data subdirectory.

• Files can only be read by the application.

• Indicate data that may be of interest to a forensic analyst

Page 35: Android forensics an Custom Recovery Image

How Data are Stored In Android(External storage)

• Files stored on the internal device’s storage have strict security and location parameters.

• Files on the various external storage devices have far fewer constraints.

• Emulated SdCard and Actual SdCard

• Examples– Pictures,Videos,…,etc

Page 36: Android forensics an Custom Recovery Image

How Data are Stored In Android(SQLite)

• Databases are used for structured data storage – SQLite is a popular database format appearing in

– many mobile systems

– traditional operating systems.

– /data/data/<packageName>/databases.

• SQLite databases are a rich source of forensic data.

Page 37: Android forensics an Custom Recovery Image

How Data are Stored In Android(Network)

• Very few applications took advantage of the network as a storage option.

• The Android Developer web site provides very few details for those interested in network storage.

• You can use the network (when it is available) to store and retrieve data on your own web-based services.

– Dropbox

– Google Drive

– Onedrive

Page 38: Android forensics an Custom Recovery Image

Example of Useful Data extracted from Android Image

• Android Browser Password– /data/data/com.android.browser/databases/webv

iew.db• .table

• select * from password;

– data/com.android.chrome/app_chrome/Default/Login• Open Login Data file using txt viewer

– /data/misc/wifi/ • Open wpa_supplicant.conf file using txt viewer.

Page 39: Android forensics an Custom Recovery Image

References

• Android Forensics

– by Andrew Hoog

• Android Hacker's Handbook– Joshua J. Drake,Pau Oliva Fora,Zach Lanier,Collin Mulliner,Stephen A. Ridley andGeorg

Wicherski

• Developing Process for Mobile Device Forensics– Det. Cynthia A. Murphy

• Android Forensics, Part 1: How we recovered (supposedly) erased data– https://blog.avast.com/2014/07/09/android-foreniscs-pt-2-how-we-recovered-erased-data/

• http://www.cclgroupltd.com/mobile-device-forensics-data-acquisition-types/

• http://www.cclgroupltd.com/mobile-device-forensics-data-acquisition-types/

• http://forum.xda-developers.com/galaxy-nexus/general/guide-phone-backup-unlock-root-t1420351

Page 40: Android forensics an Custom Recovery Image
Page 41: Android forensics an Custom Recovery Image