repositories

daemon-sec-cheatsheet

The cheatsheet vault for operators: AD, enumeration, exploitation, priv-esc, web, DFIR

clonegit clone https://git.daemon-sec.xyz/daemon-sec-cheatsheet.git
5555-android-debug-bridge.mdMarkdown163 lines7.1 KiBsource raw download

title: "5555 - Android Debug Bridge" section: "Network Services" sectionSlug: "network-services-pentesting" sourcePath: "src/network-services-pentesting/5555-android-debug-bridge.md" sourceUrl: "https://github.com/HackTricks-wiki/hacktricks/blob/188de82beb54e70956b2952367a0af91d26758b8/src/network-services-pentesting/5555-android-debug-bridge.md" sha: "188de82beb54e70956b2952367a0af91d26758b8" isIndex: false modified: true license: "CC-BY-NC-4.0"#

5555 - Android Debug Bridge#

Basic Information#

From the docs:[1]

Android Debug Bridge (adb) is a command-line tool to communicate with Android-based devices and emulators. Typical actions include installing packages, debugging, and getting an interactive Unix shell on the device.[1]

Example nmap fingerprint:

PORT     STATE SERVICE VERSION
5555/tcp open  adb     Android Debug Bridge device (name: msm8909; model: N3; device: msm8909)

Connect#

If you find ADB exposed and reachable, try connecting and enumerating quickly:

adb connect <ip>[:<port>]      # Default is 5555 for classic mode
adb devices -l                 # Confirm it shows as "device" (not unauthorized/offline)
adb shell                      # Get an interactive shell (uid usually shell)
whoami; id; getprop ro.debuggable ro.secure service.adb.tcp.port
adb root || true               # Works on eng/userdebug/insecure builds, many emulators/IoT

For a general ADB command reference, see:

Adb Commands

Quick Post-Exploitation#

Once you have shell, validate privileges and SELinux context:

id; getenforce; getprop ro.build.type ro.product.model ro.build.fingerprint

Enumerate and capture data#

You can use this to retrieve sensitive info (e.g., app secrets). For notes about Chrome data considerations, see the issue referenced here.

Code execution and payload delivery#

Port forwarding and pivoting#

Even without root, adb can forward local ports to device ports and vice versa. This is useful to access services bound locally on the device or to expose attacker services to the device.

Wireless Debugging (Android 11+)#

Modern Android implements TLS-protected wireless debugging with device-side pairing and mDNS discovery:[2]

# On the device: Developer options -> Wireless debugging -> Pair device with pairing code
# On attacker host (same L2 network, mDNS allowed):
adb pair <device_ip>:<pair_port>   # Enter the 6-digit code shown on device
adb mdns services                  # Discover _adb-tls-connect._tcp / _adb._tcp services
adb connect <device_ip>:<conn_port>

Notes

Offensive implications: if you can interact with the device UI (e.g., physical access or mobile MDM misconfig) to enable Wireless debugging and view the pairing code, you can establish a long-lived paired ADB channel without a cable. Some OEMs expose ADB over TCP in engineering/dev images without pairing—always check.

Hardening / Detection#

Defenders should assume any reachable adbd (TCP) is critical risk.

Shodan#

References#