GO KALI FREE

ADB

Reverse Engineering

Beginnerlow risk

ADB, or Android Debug Bridge, is a versatile command-line tool that acts as a client-server program, facilitating communication between your development machine (the client) and an Android device (running the adbd daemon) via a server process binding TCP port 5037. It ships as part of the Android SDK Platform Tools, and on Kali Linux, it's available as the `android-tools-adb` package. ADB is the standard device bridge for Android mobile pentesting and forensics, enabling actions like deploying Frida servers, pulling APKs, and capturing detailed logcat output for analysis.

Installation

sudo apt update && sudo apt install android-tools-adb

Basic Syntax

adb devices

Quick Facts

Full Name
Android Debug Bridge
License
Apache License 2.0 (part of AOSP)
Category
Reverse Engineering
Architecture
Client-server (client, daemon, server)
First Released
~2008 (with Android SDK)
Latest Stable
ADB 37.0.3 (November 2026)
Server Port
5037/TCP
Kali Package
android-tools-adb

Tool Overview

ADB, or Android Debug Bridge, is a fundamental command-line utility for anyone working with Android devices, from developers to security researchers. It operates as a client-server system where a client runs on your development machine, an `adbd` daemon runs on the Android device, and a server process on your machine manages the communication, typically binding to TCP port 5037. This architecture allows for powerful and flexible interaction with Android devices.

Google includes ADB in the Android SDK Platform Tools, ensuring it's the official and standard way to bridge your computer and Android devices. For Kali Linux users, the tool is conveniently packaged as `android-tools-adb` in the APT repositories, making installation straightforward. Its capabilities extend far beyond simple debugging, encompassing a wide array of mobile security and forensic tasks.

In the realm of mobile pentesting and forensics, ADB is indispensable. It's used for deploying dynamic instrumentation frameworks like Frida, extracting application packages (APKs) for static analysis, capturing detailed `logcat` output to understand application behavior or crashes, and for many other low-level device interactions. Its ubiquity and versatility make it a cornerstone tool in any Android security professional's toolkit.

Quick Reference Commands

Verified quick-reference commands for ADB
CommandPurpose
adb devicesList connected Android devices and their status.
adb install <path_to_apk>Install an Android application package (APK) onto the device.
adb pull <remote_path> <local_path>Copy a file or directory from the device to your computer.
adb push <local_path> <remote_path>Copy a file or directory from your computer to the device.
adb shellStart an interactive remote shell on the connected Android device.
adb logcatDisplay real-time log messages from the device's system log.
Android Debug Bridge

Common Commands

adb versionDisplays the installed Android Debug Bridge version.
adb devicesLists all connected Android devices, emulators, and their current state.
adb devices -lLists connected devices with verbose information, including product, model, and device details.
adb -s <serial> <command>Targets a specific Android device by its serial number for the given command.
adb -d <command>Targets the single attached USB hardware device for the given command.
adb -e <command>Targets the single running Android emulator for the given command.
adb start-serverStarts the ADB server process on the host machine if it's not already running.
adb kill-serverTerminates the ADB server process on the host machine.
adb usbRestarts the adbd daemon on the device in USB mode, useful after connecting via Wi-Fi.
adb disconnect [<host>]Disconnects from a specified ADB network host or all connected network devices.
adb mdns track-services --proto-textMonitors for ADB-enabled devices on the local network via mDNS discovery (Android 11+).
adb install <path_to_apk>Installs an Android application package (APK) onto the connected device.
adb install -t <path_to_apk>Installs a test-only Android application package (APK) onto the connected device.
adb install-multiple <paths_to_apks...>Installs multiple split APKs or base APKs simultaneously onto the device.
adb shell pm list packagesLists all installed packages on the Android device.
adb shell pm list packages -3Lists only third-party (non-system) installed packages on the device.
adb shell pm path <package>Displays the full path to the APK file for a specified package on the device.
adb shell pm uninstall <package>Uninstalls an application from the Android device given its package name.
adb shell pm clear <package>Deletes all data associated with a specified application package.
adb shell am force-stop <package>Forcefully stops all processes associated with a given application package.
adb shell am start -a android.intent.action.VIEWStarts an activity on the device using a specified intent action.
adb pull <remote> <local>Copies a file or directory from the Android device to the local machine.
adb push <local> <remote>Copies a file or directory from the local machine to the Android device.
adb forward tcp:6100 tcp:7100Sets up arbitrary port forwarding from the host machine to the device.
adb shell ls /system/binLists the contents of the `/system/bin` directory on the device's filesystem.
adb shellStarts an interactive remote shell on the connected Android device.
adb shell <command>Executes a single shell command directly on the Android device without entering an interactive shell.
adb shell getprop ro.product.cpu.abiRetrieves the CPU Architecture Binary Interface (ABI) of the device.
adb shell settings get secure android_idRetrieves the unique Android ID from the device's secure settings.
adb shell dumpsys batteryDumps detailed information about the device's battery service.
adb logcatDisplays real-time log messages from the device's system log buffer.
adb exec-out screencap -p > screen.pngCaptures a screenshot of the device's screen and saves it as a PNG file on the host machine.
adb shell screenrecord /sdcard/demo.mp4Records the device's screen activity and saves it as an MP4 file on the device (Android 4.4+).
adb bugreportGenerates a comprehensive bug report ZIP file containing device logs, dumpsys, and dumpstate.
adb rebootReboots the connected Android device into the normal operating system.
adb reboot bootloaderReboots the device into its bootloader mode, often used for flashing images.
adb reboot recoveryReboots the device into its recovery mode, used for system updates or factory resets.
adb reboot sideloadReboots the device into sideload mode to apply an OTA update from ADB.
adb sideload <update.zip>Applies an over-the-air (OTA) update ZIP file to the device while in recovery sideload mode.
adb rootRestarts the adbd daemon on the device with root permissions, usually only on userdebug/engineering builds.

Step-by-Step Guide

  1. 1Before starting, ensure you have an authorized Android device within your control and define the scope of your mobile pentesting or analysis activities.
  2. 2Install ADB on your Kali Linux system by first updating your package lists and then installing the `android-tools-adb` package with `sudo apt update && sudo apt install android-tools-adb`. You may optionally install `android-tools-fastboot` for device flashing capabilities.
  3. 3On your Android device, enable 'Developer options' (usually by tapping the build number in 'About phone' multiple times). Inside Developer options, enable 'USB debugging' and then connect the device to your Kali Linux machine via a USB cable.
  4. 4Look for an 'Allow USB debugging?' dialog on your Android device. It will prompt you to accept an RSA key authorization. This dialog must be accepted for ADB to function; if it doesn't appear, try disconnecting/reconnecting or revoking USB debugging authorizations.
  5. 5Verify the connection from Kali Linux using `adb devices` or `adb devices -l`. The output should show your device as 'device'. If it shows 'unauthorized', recheck the RSA key dialog on the device. If 'offline' or 'no device', check USB connection and debugging settings.
  6. 6As a test, install a sample APK using `adb install /path/to/your/app.apk` (replace with a real test app). Then, list installed packages to confirm the app's presence with `adb shell pm list packages` or `adb shell pm list packages -3`.
  7. 7Pull a file from the device (e.g., a newly installed APK) using `adb pull /data/app/com.example.app-1/base.apk ~/Downloads/example.apk`. Simultaneously, capture real-time logs for the installed app using `adb logcat MyAppTag:D *:S` (replace MyAppTag with your app's log tag if known).
  8. 8To set up wireless debugging (Android 11+), ensure both devices are on the same Wi-Fi network. On the device, go to Developer options -> Wireless debugging. Select 'Pair device with pairing code' and use `adb pair <device_ip>:<port>` on Kali with the provided code. Then `adb connect <device_ip>:<port>`. For Frida, `adb push /path/to/frida-server /data/local/tmp/frida-server` then `adb shell` and `chmod +x /data/local/tmp/frida-server && /data/local/tmp/frida-server &` to start it.

Warnings

Use Cases

Mobile Pentest Lab Setup

Set up a mobile pentesting lab by connecting Android devices, verifying their status, and preparing them for further analysis with security tools.

App Installation and Extraction

Install new or updated APKs onto a device and extract existing application packages for static analysis or backup.

Logcat Crash Analysis

Capture, filter, and analyze real-time `logcat` output to diagnose application crashes, performance issues, or suspicious activity.

Screenshot and Screen-Record Evidence

Document findings and create evidence by taking screenshots or recording screen activity directly from the device.

Wireless Debugging

Establish a debugging connection to Android devices over a Wi-Fi network for greater flexibility and convenience in lab environments.

Frida/Objection Deployment

Push and launch dynamic instrumentation frameworks like Frida or mobile exploration tools like Objection onto the device for runtime analysis.

Key Features

Best Practices

Common Errors

Device shown as 'unauthorized' by `adb devices`.
Unlock the Android device, check for the authorization dialog, and tap 'Allow'. If it doesn't appear, try revoking USB debugging authorizations and reconnecting.
No devices listed or device shown as 'offline' by `adb devices`.
Ensure USB debugging is enabled, try a different cable/port, restart the device and ADB server (`adb kill-server` then `adb devices`), and ensure correct drivers are installed (though Kali usually handles this).
Error: more than one device/emulator.
Use `adb -s <serial_number> <command>`, `adb -d <command>` (for the single USB device), or `adb -e <command>` (for the single emulator) to specify the target.
ADB server didn't start.
Run `adb kill-server`, then execute any `adb` command (e.g., `adb devices`) to force the server to restart.
Failed to stat remote file/directory: No such file or directory.
Verify the exact remote path using `adb shell ls <directory>` or `adb shell find <directory> -name <filename>`. Ensure the device has permissions for the operation (root may be needed for some paths).
Unknown package: <package_name> (for `pm` commands).
Use `adb shell pm list packages` or `adb shell pm list packages -3` to find the correct package name of the installed application.
Remote shell command parsing errors.
For commands with spaces, quote the entire argument string passed to `adb shell` twice. Example: `adb shell "ls -l '/sdcard/My Docs/'"`.
Failed to authenticate or connect over Wi-Fi.
Ensure both host and device are on the same trusted Wi-Fi network. Check firewall rules. For Android 11+, ensure successful `adb pair` and `adb connect` steps.

People Also Ask

Is ADB safe?

ADB is generally safe when used responsibly on devices you own or are authorized to test. However, if used maliciously or on unauthorized devices, it can compromise security and lead to data loss. Always ensure USB debugging is protected.

Is ADB legal?

Yes, ADB is legal. It is an official tool provided by Google as part of the Android SDK Platform Tools. Its legality depends entirely on how it is used; using it on devices you don't own or without authorization for malicious purposes is illegal.

Why is adb devices not showing my device?

If `adb devices` isn't showing your device, check if USB debugging is enabled in Developer options, ensure the RSA key authorization is accepted, verify the USB cable/port, and confirm that `adbd` is running on the device. Restarting the ADB server can also help.

Does ADB need root?

No, ADB does not need root access to function. Most ADB commands (installing apps, pulling files from user-accessible directories, `logcat`, `adb shell`) work without root. `adb root` itself only works on userdebug/engineering builds or emulators to restart `adbd` with root privileges.

What is ADB used for in hacking?

In ethical hacking, ADB is used to install test payload APKs, push exploits, extract sensitive data, capture logs for reconnaissance, bypass basic security controls (e.g., enable proxies), and deploy dynamic analysis frameworks like Frida for runtime manipulation.

How do I fix "adb: command not found"?

If you encounter "adb: command not found" on Kali Linux, it means ADB is not installed or not in your system's PATH. Fix this by running `sudo apt update && sudo apt install android-tools-adb`. After installation, open a new terminal or reboot for PATH changes to apply.

Related Tools

Objection

Reverse Engineering

Objection is a runtime mobile exploration toolkit, powered by Frida, built to help you assess the security of your mobile applications without needing a jailbroken or rooted device.

Frida

Reverse Engineering

Frida is a dynamic instrumentation toolkit for developers, reverse-engineers, and security researchers. It allows you to inject snippets of JavaScript or your own library into native apps on various platforms — making it the industry standard for runtime analysis and mobile app security testing.

Burp Suite

Web Application

Burp Suite is the industry-standard web application security testing platform from PortSwigger, free as Community Edition on Kali Linux. Learn how to use Burp Suite: install it, route your browser through its proxy, intercept your first request, and test it with Repeater and Intruder.

MSFVenom

Exploitation

MSFVenom is a standalone payload generator and encoder utility within the Metasploit Framework, first introduced in Metasploit 4.0 (2015) to replace the legacy msfpayload and msfencode tools with a single unified interface. It enables security professionals, penetration testers, and students to create, customize, and encode payloads for multiple platforms including Windows, Linux, macOS, Android, and PHP. MSFVenom is widely used in CTF competitions, security training labs, authorized penetration testing engagements, and red team operations to generate reverse shells, Meterpreter payloads, shellcode, and encoded executables. Understanding MSFVenom helps both offensive and defensive security professionals learn payload construction techniques, encoding methods, and detection strategies used in modern cybersecurity.

Radare2

Reverse Engineering

Radare2 (r2) is a complete open-source framework for reverse engineering and binary analysis. It bundles a disassembler, debugger, hex editor, and scripting engine into a single lightweight command-line toolkit that supports dozens of architectures and executable formats.

GDB

Reverse Engineering

Learn how to use GDB, the GNU Debugger, by building a small C program with debug symbols and following it from the first breakpoint to a crash. Use the same steps to inspect variables, read a backtrace, and tell when a core dump or a look at the assembly would help.

Related Cybersecurity Guides

Networking · Intermediate

DNS Explained: How the Domain Name System Works and Its Security

An in-depth exploration of DNS architecture, resolution process, record types, caching, security threats, and privacy protocols like DoH and DoT.

Ethical Hacking · Intermediate

Reverse Engineering for Beginners: Learn to Analyze Binaries with Ghidra & GDB

Learn reverse engineering from scratch: analyze binaries with Ghidra and GDB, read assembly, crack a practice binary, and build a starter toolkit.

Linux · Beginner

SSH Fundamentals: Secure Remote Access and Administration

Learn SSH for secure remote access including key-based authentication, configuration, tunneling, port forwarding, and security hardening.

Linux · Beginner

100 Essential Linux Commands Every Beginner Should Know

A quick-reference cheat sheet of 100 essential Linux commands every beginner should know, organized by category with syntax, examples, and practical use cases for system administration and cybersecurity.

Frequently Asked Questions

What is ADB?

ADB stands for Android Debug Bridge. It's a versatile command-line tool that acts as a client-server program to facilitate communication between a development workstation and an Android device. It comprises a client (on your machine), a daemon (`adbd`) on the device, and a server (on your machine) that manages their communication.

What is ADB used for?

ADB is primarily used for debugging Android devices, installing and uninstalling applications, transferring files, running shell commands on the device, capturing logs (`logcat`), and performing various system-level interactions. It's a crucial tool for Android developers, mobile pentesters, and forensic analysts.

How do I install ADB on Kali Linux?

To install ADB on Kali Linux, first update your package list with `sudo apt update`. Then, install the `android-tools-adb` package using `sudo apt install android-tools-adb`. This will provide the necessary ADB client and server components on your system.

How do I connect my Android phone to ADB?

Connect your Android device to your computer via USB. On the device, enable 'Developer options' (if not already enabled) and then enable 'USB debugging' within those options. When prompted by an 'Allow USB debugging?' dialog on your device, accept the RSA key authorization. Then, verify the connection from your computer using `adb devices`.

How do I install an APK with ADB?

Once your device is connected and authorized, you can install an APK using the command `adb install /path/to/your/application.apk`. Replace `/path/to/your/application.apk` with the actual file path of the APK on your computer. You may use `-t` for test-only APKs.

How do I use ADB shell?

To use the ADB shell, type `adb shell` in your terminal to start an interactive shell session on the connected device. You can then run Linux commands directly on the device. To execute a single command without entering an interactive session, use `adb shell <command>`, for example, `adb shell ls /sdcard`.

How do I transfer files with ADB?

To transfer files from your computer to the device, use `adb push <local_path> <remote_path>`. For example, `adb push myfile.txt /sdcard/myfile.txt`. To copy files from the device to your computer, use `adb pull <remote_path> <local_path>`, for example, `adb pull /sdcard/downloaded_app.apk ~/Downloads/`.

How do I capture logs with ADB logcat?

To capture logs, use `adb logcat`. This command will stream all log messages from the device in real-time. You can filter logs by tag and priority, for instance, `adb logcat ActivityManager:I MyApp:D *:S` to show Info-level messages for ActivityManager, Debug-level for MyApp, and suppress all other tags.

How do I connect ADB over Wi-Fi?

For Android 11+, ensure both devices are on the same Wi-Fi network. On the device, enable 'Wireless debugging' in Developer options. Then, use `adb pair <device_ip>:<port>` on your computer with the provided pairing code, followed by `adb connect <device_ip>:<port>`. For Android 10 and lower, you first need USB debugging, then `adb tcpip 5555`, disconnect USB, and finally `adb connect <device_ip>:5555`.

What port does ADB use?

The ADB server on your host machine binds to local TCP port 5037. All ADB clients communicate with this server through port 5037. On the device side, `adbd` (the daemon) listens on a different port, often 5555 for emulators or when configured for TCP/IP debugging.

Why does adb devices show my device as unauthorized?

The 'unauthorized' status means that your device has not yet granted permission for your computer's RSA key to debug it. You need to unlock your Android device and look for the 'Allow USB debugging?' dialog, then tap 'Allow' or 'OK'. Ensure 'Always allow from this computer' is checked for convenience.

Why does adb devices show offline or no device?

If `adb devices` shows 'offline' or 'no device', it typically indicates a problem with the USB connection, device drivers, or USB debugging settings. Check the USB cable, try a different port, ensure USB debugging is enabled, and that no other process is interfering with ADB on your computer. Sometimes restarting the ADB server (`adb kill-server` then `adb start-server`) helps.

What is the difference between ADB and Fastboot?

ADB (Android Debug Bridge) is used to communicate with an Android device that has fully booted into the Android OS and has USB debugging enabled. Fastboot, on the other hand, is a separate protocol and tool used when the device is in bootloader mode, primarily for flashing custom recoveries, kernels, or entire Android images. They serve different purposes at different stages of device operation.

Can ADB unlock a phone or bypass the lock screen?

No, ADB cannot bypass a device's lock screen or unlock a phone directly without prior authorization. For ADB to function, USB debugging must already be enabled on the device, and you must accept the RSA key authorization dialog, which requires an unlocked device to interact with it. Any claims of using ADB to unlock a locked phone are misconceptions.

Tags

#adb#android-debug-bridge#android#mobile-security#mobile-pentesting#android-forensics#logcat

Output Explanation

ADB commands generally provide direct output to the terminal, indicating success or failure. For instance, `adb install` prints 'Success' on successful installation, or an error message if it fails. When running `adb shell <command>`, the output is the standard output and standard error from the command executed on the device, and the ADB client's exit code reflects the remote command's exit code. The `adb devices` command output is particularly important for verifying connectivity and device state. A typical output from the official documentation: `List of devices attached / emulator-5556 device product:sdk_google_phone_x86_64 model:Android_SDK_built_for_x86_64 device:generic_x86_64 / emulator-5554 device product:sdk_google_phone_x86 model:Android_SDK_built_for_x86 device:generic_x86 / 0a388e93 device usb:1-1 product:razor model:Nexus_7 device:flo`. This shows the device serial (e.g., `emulator-5556`, `0a388e93`), its state (`device`, `offline`, or `unauthorized`), and for `-l` flag, additional columns like `product`, `model`, and `device`. The `logcat` command streams logs with a format like `I/ActivityManager( 585): Starting activity: Intent { action=android.intent.action...}` or `I/MyActivity( 1557): MyClass.getView() — get item number 1`, where `I` is the priority (Info), `ActivityManager` or `MyActivity` is the TAG, and `(585)` or `(1557)` is the process ID. Any other sample output provided on this page should be considered illustrative and not verbatim from official documentation unless explicitly stated otherwise.

Ethical Usage Notice

This tool is designed for authorized security testing, educational purposes, and legitimate network administration only. Unauthorized access to computer systems is illegal.