Week 5 - Analysing Android Apps Flashcards
adb - SDK tool
Most commonly used to interact with devices and emulators (install new apps, gain a shell on the system, read system logs, forward network ports, or do a multitude of other useful tasks).
Monitor - SDK Tool
Useful for viewing processes running on a device and taking screenshots of the device’s screen (useful for pen testers who need to gain evidence of an action for reporting purposes).
android - SDK Tool
Used to manage and create new Android emulators.
aapt - SDK Tool
Converts code into binary form to be packaged with apps.
Also useful for reverse-engineering APKs by converting app binaries to readable text.
Physical Devices vs Emulators
Emulators provide root access by default, physical devices do not.
Emulators do not operate correctly for certain apps (eg: USB, headphones, Wi-Fi, Bluetooth, etc) that require physical hardware.
Emulators do not allow making/receiving real phone calls (this can, however, be emulated to a degree using an interface).
Android Apps and the Common User
Users may or may not pay attention to permission requirements when installing.
Users experience apps through app UI.
As analysts, we are more interested in what happened behind the scenes when the app installed.
How did this app reach your device?
How did it go from a packaged download to an installed app that can be used securely?
Android OS
Consists of a stripped-down and modified Linux kernel, with some differences.
It includes an application virtual machine for running Java-like apps.
Each app is usually assigned its own unique user ID (UID) (10000 to 99999) and group ID (GID).
Special accounts like “system” and “root” exist.
Developers must assign unique package names to their apps.
Dalvik VM
A Google-customized Java Virtual Machine (JVM) bundled with core libraries.
It was designed to replace the JVM on resource-constrained hardware.
Multiple can run simultaneously.
They run Dalvik bytecode, converted from Java code into Dalvik Executable (DEX) files using the dx SDK utility.
Use Just In Time (JIT) compilation, which dynamically compiles bytecode into machine code during each app run.
Android Runtime (ART)
Each Android app runs in its own process with its own instance of ART.
Uses Ahead Of Time (AOT) compilation, translating the entire bytecode into machine code during app installation.
AOT compilation is a one-time event during installation, and it doesn’t require compilation at runtime.
Uses more storage space but offers faster execution.
Android Package (APK)
Android apps are usually distributed in the form of zipped archives with file extension .apk (Android Package)
APKs contain code, resources, and metadata.
aapt - APK Packaging Process
Converts XML resource files to binary form.
Source code and output from aapt are compiled into .class files by Java compiler.
aidl - APK Packaging Process
Converts .aidl files to .java.
Source code and output from aidl are compiled into .class files by Java compiler.
dx utility - APK Packaging Process
Converts .class files to a single classes.dex file.
apkbuilder tool - APK Packaging Process
Combines all resources, both compiled and non-compiled, and the DEX file into an APK.
jarsigner tool - APK Packaging Process
Signs the APK.