Introduction
The following is a demonstration of how we will create an Android Emulator; then we will go through needed steps to acquire a logical image of the system and how we can start forensically analyzing it.In mobile forensic world (depending on the OS, the OS version, and the device) there are in general three main acquisition techniques:
- Direct acquisition
- Logical acquisition
- Physical acquisition
The logical acquisition is a bit-by-bit copy of a given logical storage, (the storage may refer to user data partition as well as system data partition), and this acquisition method produces
, in general, a relatively manageable file which can be analyzed and parsed by forensic tools. A full device backup, for instance, can be considered as a logically acquired image.
Physical acquisition acquires data directly from hardware by direct access to a given disk or flash memory. Physically acquiring a device is usually a headache but if successfully done, the produced copy can be used to recover deleted fragments and allows the examiner to put his hands on data remnants. Physical acquisition always starts by a dumping phase then a decoding phase.
This lab will be covering logical acquisition of Android emulator using Santoku Linux
Requirements
In this exercise we will use Santoku (https://santoku-linux.com) a dedicated to mobile forensics, analysis, and security, Linux distribution packaged in an easy to use, Open Source platform.Get started with Android emulator in Santoku
After login in into your Santoku machine, Navigate to your Android SDK Manager: Santoku –> Development Tools –> Android SDK ManagerSelect Tools –> Manage AVDs. Click “Create…” Enter a name for your Android Virtual Device (AVD_Forensics). Choose a device (Nexus One) then the OS (API Level 8) of your new AVD from the “Target” drop-down list. Allocate RAM (512 Mib), Internal Storage (300 Mib) and SD card size (300 Mib) then click OK:
From AVD manager select your created emulator and click on “Start”, Select applicable options on the next screen and click on “Launch”.
Once the virtual device is launched we can proceed by creating some evidence:
- Simulate SMS/GSM Calls
In a terminal window (CTRl+ALT+T) type in the command telnet localhost 5554 (5554 is the port opened by the emulator)
Once connection is established, send SMS using the command: sms send
And now reply the incoming SMS to make more evidence:
Always on the opened telnet terminal we can simulate GSM call using the command gsm call
The emulator will show incoming call user interface (UI) as follow:
Figure 1 – Simulated Incoming Call
The gsm command supports the many parameters but the most interesting in our study are:
- Call
: Simulate an inbound phone call from . - Accept
: Accept an inbound call from and change the call’s state “active”. - Busy
: Close an outbound call to and change the call’s state to “busy”. - Cancel
: Terminate an inbound or outbound phone call to/from .
So to accept the previously simulated phone call we can execute the command gsm accept
Once command executed the Incoming call user interface will switch to hang up UI:
Figure 2- Simulated accepted call
To simulate a missed call we can make a gsm call then cancel it:
- Create phone book entries
Logical acquisition
Open a terminal window and type in adb shell this will let us issue commands without entering the adb remote shell on the emulated device (or the device if using a real one). Once shell gained type in “mount” command, this command will attach the filesystem found on the device to one file tree:As highlighted in the screenshot above, the /data partition is at /dev/block/mtdblock1, you can execute “df” command to displays the amount of disk space available on this partition:
Type exit to exit out from the adb shell:
To pull a file or a directory the command is adb pull file /dest/file assuming that all user’s data is stored in /data/ partition we can simply extract all user /data partition by typing adb pull /data /path/to/store/files on a new terminal window (you can see what will be extracted by typing ls /data on your shell window):
Now you can start to explore all folders pulled directly using the OS Explorer:
Note that all installed applications are under /data/data folder.
If you want to extract a single application folder you can execute the command as adb pull /data/data/
- 1-Type adb shell to get back to shell environment
- 2-Type ls /data/data to get list of installed packages
You can change /path/Telephony/ to the path where you want to store extracted data (in the following example the path /home/infosec/Telephony was used)
To browse to this directory click on the icon of File Manager PCManFM then double click on Telephony folder:
Moreover, by exploring databases folder, we can see mmssms.db which contains everything related to the SMS/MMS as suggested by their tables name You can open it by right-clicking on the database and selecting “Sqliteman”:
By querying, for example, the SMS table (double click on the table to view it), we can find all SMS (and using other tables and columns we can correlate IDs to make solid evidence). The following is the SMS we’ve sent previously:
In addition to ADB, Santoku comes with AFLogical which provides a basic framework for extracting data from Android devices using Content Providers and then saves the data to the SD Card of the device including:
- Contacts
- Call Logs
- SMS
- MMS
- MMS Parts
- Device info
Before continuing, on your emulator, select the data you want to extract and click “Capture” then “OK” after data is extracted correctly:
On the terminal windows press enter to continue:
This will pull the data from SDCard to the location “~/aflogical-data”. Santoku will automatically pull all the data recovered from the emulator to that location:
To view the data, open a terminal window and type: cd ~/aflogical-data/ then ls to see created folder:
Now you can browse any images as well as the extracted data (such as contacts, call logs, MMS/SMS, and device info) in CSV format:
If you open SMS, for example, you will be able to see our previously simulated sms send
Most valuable information is usually stored in SQLite databases:
Evidence | Name of file | |
Phone book | \data\data\com.android.providers.contacts\ databases\contacts2.db | |
SMS, MMS messages | \data\data\com.android.providers.telephony\ databases\mmssms.db | |
Calendar | \data\com.android.providers.calendar\databases\ calendar.db | |
Log | \data\com.sec.android.provider.logsprovider\ databases\logs.db | |
User’s data | \data\system\users\accounts.db | |
Web-browser history | \data\data\com.android.browser\databases\ browser2.db | |
Dictionary | \data\user\comc.android.providers.userdictionary\ databases\user_dict.db |
Ethical Hacking Training – Resources (InfoSec)
You can also browse SQLite dbs by invoking Sqliteman utility from command line using: sqliteman database.db as follow:
As you can see this database contains 20 tables:
Moreover, by querying each table you can get very useful information such as calls history: (select * from calls)
No comments:
Post a Comment