Android Studio Emulator
The Android Studio Emulator is one of the most important tools for Android pentesting. It allows fast testing, easy resets, controlled networking, and frictionless static/dynamic analysis. This chapter focuses on practical setup, rooting, certificate installation, network interception, and pentesting-specific configuration.
Installing Android Studio
Download and install Android Studio based on your OS. Once installed:
-
Launch Android Studio
-
Open Device Manager
-
Click Create Device
-
Choose a Pixel device (Pixel 4 / Pixel 5 recommended)
-
Select a system image with Google APIs
-
Finish setup
Google APIs images provide:
-
Full debugging support
-
ADB root in many builds
-
Ability to bypass some restrictions easily
Enabling Root Access on the Emulator
Start the emulator:
emulator -avd <emulator_name>
Enable root:
adb root
adb remount
If successful, you can now access system directories.
Verify:
adb shell
su
If adb root fails, create a different system image:
-
Use Android 11 or earlier
-
Use x86_64 images with Google APIs
Root access is required for:
-
SSL certificate install
-
File system inspection
-
Data extraction from /data/data
-
Testing insecure storage
Installing an APK on Emulator
Install using ADB:
adb install app.apk
Install an updated version:
adb install -r app.apk
Install over existing signature mismatch:
adb install -r -d app.apk
This helps when modifying and repackaging apps for testing.
Setting Up Burp Suite Proxy
Change emulator connection to manual proxy:
-
Open Settings
-
Go to Network & Internet
-
Select your active network
-
Choose Advanced
-
Set proxy to Manual
-
Host: your PC IP
-
Port: 8080
Test:
adb shell ping <your_pc_ip>
You should receive responses.
Installing Burp’s Certificate on the Emulator
Export Burp certificate as DER:
-
Open Burp → Proxy → Options
-
Export certificate → cacert.der
Push certificate to emulator:
adb push cacert.der /sdcard/
Install certificate:
adb shell "mv /sdcard/cacert.der /system/etc/security/cacerts/"
adb shell "chmod 644 /system/etc/security/cacerts/cacert.der"
Reboot:
adb reboot
Now HTTPS traffic becomes interceptable.
Bypassing SSL Pinning on Emulator
Most modern apps use SSL pinning. Use Frida for bypass.
Push Frida server:
adb push frida-server /data/local/tmp/
adb shell "chmod 755 /data/local/tmp/frida-server"
Start it:
adb shell "/data/local/tmp/frida-server &"
Check connection:
frida-ps -U
Load SSL pinning bypass:
frida -U -f com.app -l ssl_bypass.js --no-pause
This restores interception functionality even for hardened apps.
Enabling Device File System Access
On rooted emulators you can access app private directories.
List installed packages:
adb shell pm list packages
Find app data location:
adb shell ls /data/data/<package_name>/
Pull files for offline analysis:
adb pull /data/data/<package_name>/shared_prefs/ .
Inspect:
-
SharedPreferences
-
Databases
-
Cache files
-
Logs
This helps identify insecure data storage issues instantly.
Setting Custom DNS and Host Redirection
Edit /etc/hosts for API redirection:
adb shell
su
echo "10.0.2.2 api.app.com" >> /etc/hosts
10.0.2.2 = host machine when using emulator.
Useful for:
-
Redirecting traffic
-
Testing staging servers
-
Injecting controlled responses
Enabling Network Debugging Mode
Run:
adb tcpip 5555
adb connect <emulator_ip>:5555
This allows wireless ADB for multi-device testing.
Using Snapshots for Fast Testing
Snapshots allow instant restore to clean state.
-
Open Device Manager
-
Enable Cold Boot
-
Create snapshot after setup
-
Whenever testing breaks the emulator → restore snapshot
This saves hours during pentesting.
Practical Pentester Emulator Workflow
-
Create emulator with Google APIs
-
Enable root with
adb root -
Set Burp proxy and install CA cert
-
Push and start Frida server
-
Install target APK
-
Decompile and analyze APK
-
Inspect app data via
/data/data -
Intercept network traffic
-
Bypass SSL pinning
-
Refresh emulator using snapshots
This provides the complete mobile app testing environment.
Intel Dump
-
Create emulator with Google APIs for pentesting
-
Enable adb root and remount system
-
Install APKs using adb commands
-
Route Android emulator traffic through Burp Suite
-
Install Burp certificate in system CA store
-
Start Frida server for runtime instrumentation
-
Inspect app private directories using adb
-
Modify hosts file for traffic redirection
-
Use snapshots for quick clean states