ADB & Frida Setup

Part 2 of the Android Pentest series. This is the boring-but-critical groundwork — get it wrong and every later technique fails in confusing ways.

Before you can inject a certificate or hook a function, you need a working ADB connection and a running Frida server that exactly matches your host. This part covers that foundation.

Prerequisites

Tools on your host machine:

ToolCheckNotes
adbadb versionAndroid SDK Platform-Tools (use the latest)
fridafrida --versionPython package — install below
objectionobjection --versionBuilt on top of Frida
opensslopenssl versionFor certificate conversion (later parts)

On the device:

  • Root access (Magisk, SuperSU, or an eng/userdebug build)
  • frida-server matching both your Frida host version and the device architecture (ARM, ARM64, x86, x86_64)

⚠️ Version mismatch is the #1 cause of Frida failures. Always match frida-server to frida --version on your host. Grab the exact release from Frida’s GitHub releases.

Check device architecture

You need this to download the correct frida-server binary.

adb shell getprop ro.product.cpu.abi

Inside an adb shell session you can also list every supported ABI:

getprop ro.product.cpu.abilist

This returns something like arm64-v8a,armeabi-v7a,armeabi. The first entry is the primary architecture — use that when downloading frida-server. Common results: arm64-v8a (most modern devices), x86_64 (emulators), armeabi-v7a (older 32-bit devices).

ADB over Wi-Fi

Useful when USB is inconvenient or the device is across the room. Both device and host must be on the same network.

# 1. With USB still connected, switch ADB to TCP mode
adb tcpip 5555

# 2. Disconnect USB, then connect over Wi-Fi
adb connect <DEVICE_IP>:5555

📌 Edge case. Some devices reset to USB mode after a reboot — re-run adb tcpip with the cable connected. With multiple devices attached, target a specific one with adb -s <serial>.

Port forwarding

Port forwarding maps a local TCP port to a port on the device. This is essential for Frida and Objection over USB.

# Forward Frida's default port
adb forward tcp:27042 tcp:27042

# Verify the forward is active
adb forward --list

Install Frida tools on the host

pip install frida-tools objection

⚠️ Common mistake. The PyPI package is frida-tools, not frida alone. Installing just frida gives you the bindings without the CLI tools (frida, frida-ps, frida-ls-devices). objection depends on frida-tools and pulls it in automatically.

Run frida-server on the device

Download the matching frida-server from GitHub releases, push it, and run:

adb push frida-server-<version>-android-<arch> /data/local/tmp/frida-server
adb shell chmod +x /data/local/tmp/frida-server
adb shell /data/local/tmp/frida-server &

Verify it’s running:

frida-ps -U

A list of processes means you’re good. Nothing? The frida-server version almost certainly doesn’t match your host version exactly.

Frida over Wi-Fi

You can run frida-server listening on a network interface instead of USB:

# On device (adb shell)
./data/local/tmp/frida-server -l 0.0.0.0:8877 &

Then connect from the host with -H:

frida -H <DEVICE_IP>:8877 -f <package.name> -l script.js

⚠️ Security warning. Binding frida-server to 0.0.0.0 exposes it to the entire network. Only do this on isolated test networks. For production-adjacent environments, bind to 127.0.0.1 and use adb forward instead.

Troubleshooting

SymptomLikely causeFix
frida-ps -U shows nothingfrida-server not running or version mismatchRe-check architecture and version; restart frida-server
Objection can’t connectPort 27042 not forwardedadb forward tcp:27042 tcp:27042
adb tcpip rejectedCharge-only USB mode or ADB not authorizedEnable USB debugging; accept the RSA prompt on device
App crashes on launch with FridaScript error or incompatible hookUse -f (spawn) not -F (attach); read the stack trace

See also

References