The Android Debug Bridge (commonly abbreviated as adb) is a
programming tool
A programming tool or software development tool is a computer program that is used to develop another computer program, usually by helping the developer manage computer files. For example, a programmer may use a tool called a source code editor ...
used for the
debugging
In engineering, debugging is the process of finding the Root cause analysis, root cause, workarounds, and possible fixes for bug (engineering), bugs.
For software, debugging tactics can involve interactive debugging, control flow analysis, Logf ...
of
Android-based devices. The
daemon
A demon is a malevolent supernatural being, evil spirit or fiend in religion, occultism, literature, fiction, mythology and folklore.
Demon, daemon or dæmon may also refer to:
Entertainment Fictional entities
* Daemon (G.I. Joe), a character ...
on the Android device connects with the server on the host PC over
USB
Universal Serial Bus (USB) is an industry standard, developed by USB Implementers Forum (USB-IF), for digital data transmission and power delivery between many types of electronics. It specifies the architecture, in particular the physical ...
or
TCP, which connects to the client that is used by the end-user over TCP. Made available as
open-source software
Open-source software (OSS) is Software, computer software that is released under a Open-source license, license in which the copyright holder grants users the rights to use, study, change, and Software distribution, distribute the software an ...
under the
Apache License
The Apache License is a permissive free software license written by the Apache Software Foundation (ASF). It allows users to use the software for any purpose, to distribute it, to modify it, and to distribute modified versions of the software ...
by
Google
Google LLC (, ) is an American multinational corporation and technology company focusing on online advertising, search engine technology, cloud computing, computer software, quantum computing, e-commerce, consumer electronics, and artificial ...
since 2007, its features include a shell and the possibility to make backups. The adb software is available for
Windows
Windows is a Product lining, product line of Proprietary software, proprietary graphical user interface, graphical operating systems developed and marketed by Microsoft. It is grouped into families and subfamilies that cater to particular sec ...
,
Linux
Linux ( ) is a family of open source Unix-like operating systems based on the Linux kernel, an kernel (operating system), operating system kernel first released on September 17, 1991, by Linus Torvalds. Linux is typically package manager, pac ...
and
macOS
macOS, previously OS X and originally Mac OS X, is a Unix, Unix-based operating system developed and marketed by Apple Inc., Apple since 2001. It is the current operating system for Apple's Mac (computer), Mac computers. With ...
. It has been misused by
botnet
A botnet is a group of Internet-connected devices, each of which runs one or more Internet bot, bots. Botnets can be used to perform distributed denial-of-service attack, distributed denial-of-service (DDoS) attacks, steal data, send Spamming, sp ...
s and other
malware
Malware (a portmanteau of ''malicious software'')Tahir, R. (2018)A study on malware and malware detection techniques . ''International Journal of Education and Management Engineering'', ''8''(2), 20. is any software intentionally designed to caus ...
, for which mitigations were developed such as
RSA authentication and device
whitelisting.
Features

Features of adb include copying files from the host computer, installing apps, viewing logcat output, getting a
Unix shell
A Unix shell is a Command-line_interface#Command-line_interpreter, command-line interpreter or shell (computing), shell that provides a command line user interface for Unix-like operating systems. The shell is both an interactive command languag ...
, and rebooting into
Qualcomm EDL mode. For example, Android
applications
Application may refer to:
Mathematics and computing
* Application software, computer software designed to help the user to perform specific tasks
** Application layer, an abstraction layer that specifies protocols and interface methods used in a ...
can be saved by the command
backup
In information technology, a backup, or data backup is a copy of computer data taken and stored elsewhere so that it may be used to restore the original after a data loss event. The verb form, referring to the process of doing so, is "wikt:back ...
to a file. It also includes support for the
Java Debug Wire Protocol.
Some
graphical interfaces have been made available. The graphical Android Device Monitor in
Android Studio
Android Studio is the official integrated development environment (IDE) for Google's Android operating system, built on JetBrains' IntelliJ IDEA software and designed specifically for Android development. This is available for download on W ...
can be used for retrieving information from an Android device.
Android's method to install APK files on a device has been used as a way to sideload unofficial apps onto
Windows Subsystem for Android and Chrome OS's Android virtual machine.
Shizuku allows an Android phone to connect to its own ADB when connected to a wireless network. The application is available for free on the Google Play Store.
Development history
The
Android Software Development Kit (SDK) was first released in 2007. Since 2017, Google made it possible to download adb separately from the Android SDK.
In 2015, Microsoft released an Android emulator that can connect to the adb client. In 2016 for
Android Studio
Android Studio is the official integrated development environment (IDE) for Google's Android operating system, built on JetBrains' IntelliJ IDEA software and designed specifically for Android development. This is available for download on W ...
2.0 a 5x performance improvement was made for installing apps and pushing files through adb. For easier usage of
Android Things, a wrapper was made in 2017 around manual adb commands. For Android 11 in 2020, Google added adb incremental installations. In 2020, Wi-Fi adb was integrated into Android Studio for macOS. In 2021 for
Android 12
Android 12 is the Android version history, twelfth major release and 19th version of Android (operating system), Android, the mobile operating system developed by the Open Handset Alliance led by Google. The first beta was released on May 18, ...
, the
adb backup
command was limited so that backing up user data from apps is opt-in using a per-app manifesto configuration after being deprecated in Android 10 along with
adb restore
.
Fuchsia will be backwards-compatible with adb. It will be replaced with fx and ffx.
Setup
Host computer
For Windows, the Android SDK contains the adb.exe binary that can be extracted and installed. How-To Geek recommends adding the folder containing the binaries to the
PATH
A path is a route for physical travel – see Trail.
Path or PATH may also refer to:
Physical paths of different types
* Bicycle path
* Bridle path, used by people on horseback
* Course (navigation), the intended path of a vehicle
* Desir ...
environment variable.
On
Ubuntu
Ubuntu ( ) is a Linux distribution based on Debian and composed primarily of free and open-source software. Developed by the British company Canonical (company), Canonical and a community of contributors under a Meritocracy, meritocratic gover ...
, adb can be installed with the
android-tools-adb
package. For
Debian
Debian () is a free and open-source software, free and open source Linux distribution, developed by the Debian Project, which was established by Ian Murdock in August 1993. Debian is one of the oldest operating systems based on the Linux kerne ...
, it has been recommended to also install the
android-sdk-platform-tools-common
package next to the
adb
package, which installs the
udev
udev (userspace ) is a device manager for the Linux kernel. As the successor of devfsd and hotplug, udev primarily manages device nodes in the directory. At the same time, udev also handles all user space events raised when hardware devices ...
rules which makes it possible to run the tool without
root permissions. For macOS and other Linux distributions, the platform tools can be downloaded and the PATH variable can be modified in
bashrc.
Android device
In
Android 4.2.2 or later (
API level 17), a dialog is shown with an RSA
fingerprint
A fingerprint is an impression left by the friction ridges of a human finger. The recovery of partial fingerprints from a crime scene is an important method of forensic science. Moisture and grease on a finger result in fingerprints on surfa ...
that the user needs to accept. This protects against computers exploiting the debugging mechanism without consent of the device user. Starting in Android 4.2, the developer settings are hidden by default. Pressing seven times on the build number in the about menu makes them visible to the user. After that, the USB debugging option can be enabled. Some Android vendors have different procedures to enable it. For example, Huawei requires entering a pincode before adb can be enabled.
If the
touchscreen
A touchscreen (or touch screen) is a type of electronic visual display, display that can detect touch input from a user. It consists of both an input device (a touch panel) and an output device (a visual display). The touch panel is typically l ...
of an Android device is broken, it can be possible to connect a mouse to the device using
USB On-The-Go and enable USB debugging.
Architecture
The adb protocol can be transported over USB or over
Wi-Fi
Wi-Fi () is a family of wireless network protocols based on the IEEE 802.11 family of standards, which are commonly used for Wireless LAN, local area networking of devices and Internet access, allowing nearby digital devices to exchange data by ...
through
TCP. It uses a
client-server architecture. There are two different protocols in use. The first is between the client and the server and the second is between the server and the daemon. The adb daemon is implemented in
C and located in the Android user space. The daemon is facilitated by the Android USB framework,
UsbDeviceManager
and
UsbDebuggingManager
.
[
]
Client ↔ server protocol
The communication mode between the client and server is a TCP socket. The server listens on a port, to which the client has to send a request. The request contains a 4-byte initial field in ASCII and a payload. The payload starts with the word host, to indicate it should be sent to the server. The server can then reply with OKAY or FAIL to indicate the status, combined with an optional payload and length.[
]
Server ↔ daemon protocol
The messages sent from the server consist of a 24-byte long header, with the following fields:[
* Command
* First argument
* Second argument
* Length of the payload, 0 or higher
* CRC-32 of the data payload
* Magic value, calculated through command XOR ]0xFFFFFFFF
Security
Up to Android 2.2, Android was vulnerable to the ''RageAgainstTheCage'' exploit. The adb daemon
A demon is a malevolent supernatural being, evil spirit or fiend in religion, occultism, literature, fiction, mythology and folklore.
Demon, daemon or dæmon may also refer to:
Entertainment Fictional entities
* Daemon (G.I. Joe), a character ...
did not check for the return value of the setuid
The Unix and Linux access rights flags setuid and setgid (short for ''set user identity'' and ''set group identity'') allow users to run an executable with the file system permissions of the executable's owner or group respectively and to chang ...
system call
In computing, a system call (syscall) is the programmatic way in which a computer program requests a service from the operating system on which it is executed. This may include hardware-related services (for example, accessing a hard disk drive ...
when dropping privileges. The exploit forks
In cutlery or kitchenware, a fork (from 'pitchfork') is a Eating utensil, utensil, now usually made of metal, whose long handle terminates in a head that branches into several narrow and often slightly curved tine (structural), tines with whic ...
processes until it fails due to the exhaustion of process identifier
In computing, the process identifier (a.k.a. process ID or PID) is a number used by most operating system kernel (operating system), kernels—such as those of Unix, macOS and Windows—to uniquely identify an active Process (computing), process. ...
s. When the daemon crashes and restarts, it cannot start a new process with dropped privileges and keeps running as root. Then adb provided a root shell. In 2017, a security vulnerability was disclosed that exploited ADB to take over the onboard modem
The Democratic Movement (, ; MoDem ) is a centre to centre-right political party in France, whose main ideological trends are liberalism and Christian democracy, and that is characterised by a strong pro-Europeanist stance. MoDem was establis ...
. The attack required adb to be already enabled and authorized, although some workarounds were available.
Various families of malware such as ADB.Miner, Ares, IPStorm, Fbot and Trinity have scanned the internet for public availability of the adb interface and installed malware on those devices. adb can also be used to remove malware
Malware (a portmanteau of ''malicious software'')Tahir, R. (2018)A study on malware and malware detection techniques . ''International Journal of Education and Management Engineering'', ''8''(2), 20. is any software intentionally designed to caus ...
, by booting into safe mode
Safe mode is a diagnosis, diagnostic mode of a computer operating system (OS). It can also refer to a mode of operation by application software. ''Safe mode'' is intended to help fix most, if not all, problems within an operating system. It is a ...
and running the adb uninstall
command.
See also
* Android recovery mode
* Fastboot
References
External links
*
*
*
*
*
{{Android
Android (operating system)
Debugging
Communications protocols
Android (operating system) development software