Warning: The following steps require a familiarity and comfort with using Linux, which you really and truly need if you're going to be analyzing Android -- a Linux-based operating system.
First, you'll need a rooted Android device. How to actually perform the rooting and rooting-related issues is beyond the scope of this series, but there are plenty of resources on the Internet with detailed steps. The important part is that you must have root access on the device to use mac-robber.
Second, you'll need a way to get files onto your device. One of the first things I install after rooting my device is an SSH server. It comes in handy for several reasons, such as copying files using scp. Alternatively, I'll use adb (part of the Android SDK) to push the files to the device via a USB cable. There are plenty of other methods, but these are two of the quickest and easiest.
Next, you need mac-robber compiled from source code into an executable binary to run on your device. In my test environment, I used a Ubuntu Linux server, but you can easily use MobiSec or Backtrack Linux for the next steps. You'll need to download mac-robber, decompress it, open up a terminal window, and change directories into the folder containing the extracted mac-robber files. Then, run the following commands:
- sudo add-apt-repository ppa:linaro-maintainers/toolchain
- sudo apt-get install gcc-arm-linux-gnueabi
- arm-linux-gnueabi-gcc -static -o -mac-robber mac-robber.c
The first command adds a new Debian package repository that can be used to download and install software from. The second command installs the GNU C Compiler (GCC) cross-compiler allowing C code to be compile for ARM platforms. The third command uses the GCC cross-compiler to compile mac-robber into an executable. After step three, you should have a freshly compiled executable called "mac-robber."
Next, let's create a directory to store mac-robber on the Android filesystem and copy it over. Make sure the adb tool from the Android SDK is in your PATH or run it directly from the "platform-tools" directory.
- adb shell
- mkdir /data/mac-robber
- chmod 755 /data/mac-robber
- exit
- adb push mac-robber /data/mac-robber/
- adb shell "/data/mac-robber/mac-robber -V"
The first four steps start a shell on the Android device, create a new directory to house the mac-robber executable, set permissions on the new directory, and exit the shell. The last two commands push the mac-robber executable that we compiled earlier over to the Android device in the new directory, then run mac-robber with the "-V" flag to show the version information. Provided all of those commands completed successfully, we're ready to proceed. If not, feel free to email me at the address below.
I run mac-robber two ways on the Android device. The first is using SSH like so:
- ssh [email protected]
"/system/bin/mac-robber /" > AttachmentOpen.body
The second is using adb:
- ./adb shell "/system/bin/mac-robber /" > AttachmentOpen.body
The resulting file can then be processed into a timeline using mactime from the Sleuth Kit.
- mactime -b AttachmentOpen.body > AttachmentOpen.timeline
At this point, you have the basics to start creating timelines of the Android filesystem. In the next part of this series, I'll cover how to do the same with iOS, followed by a blog looking at some interesting things and actual vulnerabilities you can uncover using timeline analysis.
John Sawyer is a Senior Security Analyst with InGuardians, Inc. The views and opinions expressed in this blog are his own and do not represent those of his employer. He can be reached at [email protected] and found on Twitter @johnhsawyer.