Android Debug Bridge: Difference between revisions
imported>BotanyGa change |
linkage |
||
| Line 1: | Line 1: | ||
{{Infobox software | |||
| title = Android Debug Bridge | |||
| name = | |||
| logo = Android Robot Head 2023.svg | |||
| logo caption = | |||
| logo alt = | |||
| logo size = 100px | |||
| collapsible = <!-- Any text here will collapse the screenshot. --> | |||
| screenshot = Adb on Command Prompt.png | |||
| screenshot size = | |||
| screenshot alt = | |||
| caption = Starting the adb server in [[Software:Cmd.exe|Command Prompt]], which then [[Network enumeration|enumerates]] the devices. After that, a [[Unix shell|shell]] is opened on the device being debugged to run the uname command. | |||
| other_names = | |||
| author = [[Company:Google|Google]] | |||
| developer = | |||
| released = <!-- {{Start date and age|YYYY|MM|DD|df=yes/no}} --> | |||
| ver layout = <!-- simple (default) or stacked --> | |||
| discontinued = <!-- Set to yes, if software is discontinued, otherwise omit. --> | |||
| latest release version = 34.0.1 (March 2023) | |||
| latest release date = <!-- {{Start date and age|YYYY|MM|DD|df=yes/no}} --> | |||
| latest preview version = | |||
| latest preview date = <!-- {{Start date and age|YYYY|MM|DD|df=yes/no}} --> | |||
| repo = [https://android.googlesource.com/platform/packages/modules/adb/ android.googlesource.com] | |||
| qid = | |||
| programming language = [[C++]] | |||
| middleware = | |||
| engine = <!-- or |engines= --> | |||
| operating system = Windows, Linux, macOS | |||
| platform = | |||
| included with = [[Software:Android SDK|Android SDK]] | |||
| replaces = | |||
| replaced_by = | |||
| service_name = | |||
| size = | |||
| standard = | |||
| language = | |||
| language count = <!-- Number only --> | |||
| language footnote = | |||
| genre = Software development tool | |||
| license = [[Software:Apache License 2.0|Apache License 2.0]] | |||
| website = {{URL|https://developer.android.com/studio/command-line/adb}} | |||
| AsOf = | |||
}} | |||
The '''Android Debug Bridge''' (commonly abbreviated as '''adb''') is a [[Software:Programming tool|programming tool]] used for the [[Debugging|debugging]] of [[Software:Android (operating system)|Android]]-based devices. The [[Daemon (computing)|daemon]] on the Android device connects with the server on the host PC over [[Engineering:USB|USB]] or [[Transmission Control Protocol|TCP]], which connects to the client that is used by the end-user over TCP. Made available as [[Open-source software|open-source software]] under the [[Software:Apache License|Apache License]] by [[Company:Google|Google]] since 2007, its features include a shell and the possibility to make backups. The adb software is available for [[Software:Microsoft Windows|Windows]], [[Software:Linux|Linux]] and [[Software:MacOS|macOS]]. It has been misused by [[Botnet|botnet]]s and other [[Malware|malware]], for which mitigations were developed such as [[RSA (cryptosystem)|RSA]] authentication and device [[Whitelisting|whitelisting]]. | |||
For example, Android [[Android application package|applications]] can be saved by the command <code>[[Backup|backup]]</code> to a file | == Features == | ||
[[File:Android Device Monitor.png|thumb|left|Android Device Monitor]] | |||
Features of adb include copying files from the host computer,<ref>{{Cite book|last=Darcey|first=Lauren|title=Android wireless application development|date=2012|publisher=Addison-Wesley|others=Shane Conder|isbn=978-0-321-81383-1|edition=3rd|location=Upper Saddle River, NJ|oclc=749852462}}</ref> installing apps, viewing logcat output, getting a [[Unix shell]],<ref>{{Cite web|title=Things You Can Do with Android's adb Command|url=https://www.dummies.com/web-design-development/mobile-apps/android-apps/things-you-can-do-with-androids-adb-command/|url-status=live|access-date=2021-09-09|website=[[Unsolved:For Dummies|For Dummies]]|language=en|archive-date=2018-05-15|archive-url=https://web.archive.org/web/20180515143530/https://www.dummies.com/web-design-development/mobile-apps/android-apps/things-you-can-do-with-androids-adb-command}}</ref> and rebooting into [[Qualcomm EDL mode]].<ref>{{Cite book|last=EASTTOM|first=CHUCK|title=An In-Depth Guide to Mobile Device Forensics|date=2021|publisher=CRC PRESS|isbn=978-0-367-63300-4|location=[S.l.]|pages=72|oclc=1250310301}}</ref> For example, Android [[Android application package|applications]] can be saved by the command <code>[[Backup|backup]]</code> to a file.<ref>{{cite web|author=Jack Wallen|date=2015-03-06|title=How to create a full backup of your Android device without root|url=https://www.techrepublic.com/article/how-to-create-a-full-backup-of-your-android-device-without-root/|access-date=2016-01-29|archive-date=2016-01-24|archive-url=https://web.archive.org/web/20160124184710/https://www.techrepublic.com/article/how-to-create-a-full-backup-of-your-android-device-without-root/|url-status=live}}</ref> It also includes support for the [[Java Debug Wire Protocol]].<ref name=":0">{{Cite book|last=Regupathy|first=Rajaram|title=Unboxing Android USB: a hands-on approach with real World examples|date=2014|isbn=978-1-4302-6209-1|location=Berkeley, CA|oclc=880673864}}</ref> | |||
Some [[Graphical user interface|graphical interfaces]] have been made available. The graphical Android Device Monitor in [[Software:Android Studio|Android Studio]] can be used for retrieving information from an Android device.<ref>{{Cite book|last1=Morgillo|first1=Ivan|last2=Viola|first2=Stefano|url=https://books.google.com/books?id=bOrUDQAAQBAJ|title=Learning embedded Android N programming: create the perfectly customized system by unleashing the power of Android OS on your embedded device|date=2016|location=Birmingham, UK|page=89|isbn=9781785283284|oclc=1020708322|access-date=2021-09-26|archive-date=2021-09-26|archive-url=https://web.archive.org/web/20210926122010/https://www.worldcat.org/title/learning-embedded-android-n-programming-create-the-perfectly-customized-system-by-unleashing-the-power-of-android-os-on-your-embedded-device/oclc/957278992|url-status=live}}</ref> | |||
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<ref>{{cite web | url=https://www.xda-developers.com/how-to-sideload-android-apps-on-windows-11/ | title=How to sideload Android apps on Windows 11 | date=23 January 2022 }}</ref> and Chrome OS's Android virtual machine.<ref>{{cite web | url=https://www.xda-developers.com/how-sideload-apps-chromebook/ | title=How to sideload apps to a Chromebook | date=5 March 2023 }}</ref> | |||
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.<ref>{{Cite web |title=User manual {{!}} Shizuku |url=https://shizuku.rikka.app/guide/setup/ |access-date=2024-07-19 |website=shizuku.rikka.app}}</ref> | |||
== Development history == | |||
The [[Software:Android SDK|Android Software Development Kit]] (SDK) was first released in 2007.<ref>{{Cite web|title=Google releases Android SDK|url=https://www.macworld.com/article/188112/androidsdk.html|url-status=live|access-date=2021-09-10|website=Macworld|language=en-US|archive-date=2021-09-10|archive-url=https://web.archive.org/web/20210910144537/https://www.macworld.com/article/188112/androidsdk.html}}</ref> Since 2017, Google made it possible to download adb separately from the Android SDK.<ref>{{Cite web|date=2017-01-05|title=Google makes ADB, fastboot, and other platform tools available without full SDK or Android Studio download|url=https://www.androidpolice.com/2017/01/05/google-makes-adb-fastboot-platform-tools-available-without-full-sdk-android-studio-download/|access-date=2021-09-09|website=Android Police|language=en-US|archive-date=2021-04-10|archive-url=https://web.archive.org/web/20210410215628/https://www.androidpolice.com/2017/01/05/google-makes-adb-fastboot-platform-tools-available-without-full-sdk-android-studio-download/|url-status=live}}</ref> | |||
In 2015, Microsoft released an Android emulator that can connect to the adb client.<ref>{{Cite web|last=Vasile|first=Cosmin|title=Microsoft Releases Android Emulator and It's Supposed to Be Faster than Google's|url=https://news.softpedia.com/news/microsoft-releases-android-emulator-and-it-s-supposed-to-be-faster-than-google-s-488016.shtml|url-status=live|access-date=2021-09-10|website=[[Softpedia]]|date=29 July 2015 |language=english|archive-date=2021-09-10|archive-url=https://web.archive.org/web/20210910152702/https://news.softpedia.com/news/microsoft-releases-android-emulator-and-it-s-supposed-to-be-faster-than-google-s-488016.shtml}}</ref> In 2016 for [[Software:Android Studio|Android Studio]] 2.0 a 5x performance improvement was made for installing apps and pushing files through adb.<ref>{{Cite web|title=Android Studio 2.0 - Beta|url=https://android-developers.googleblog.com/2016/02/android-studio-20-beta.html|url-status=live|archive-url=https://web.archive.org/web/20210910162958/https://android-developers.googleblog.com/2016/02/android-studio-20-beta.html|archive-date=2021-09-10|access-date=2021-09-10|website=Android Developers Blog|language=en}}</ref> For easier usage of [[Software:Android Things|Android Things]], a wrapper was made in 2017 around manual adb commands.<ref>{{Cite web|title=Android Things Developer Preview 6|url=https://android-developers.googleblog.com/2017/11/android-things-developer-preview-6.html|url-status=live|archive-url=https://web.archive.org/web/20210910162953/https://android-developers.googleblog.com/2017/11/android-things-developer-preview-6.html|archive-date=2021-09-10|access-date=2021-09-10|website=Android Developers Blog|language=en}}</ref> For Android 11 in 2020, Google added adb incremental installations.<ref>{{Cite web|title=Turning it up to 11: Android 11 for developers|url=https://android-developers.googleblog.com/2020/09/android11-final-release.html|access-date=2021-09-10|website=Android Developers Blog|language=en|archive-date=2021-09-17|archive-url=https://web.archive.org/web/20210917230702/https://android-developers.googleblog.com/2020/09/android11-final-release.html|url-status=live}}</ref> In 2020, Wi-Fi adb was integrated into Android Studio for macOS.<ref>{{Cite web|title=Announcing Android Studio Arctic Fox (2020.3.1) & Android Gradle plugin 7.0|url=https://android-developers.googleblog.com/2020/12/announcing-android-studio-arctic-fox.html|access-date=2021-09-10|website=Android Developers Blog|language=en|archive-date=2021-09-12|archive-url=https://web.archive.org/web/20210912132619/https://android-developers.googleblog.com/2020/12/announcing-android-studio-arctic-fox.html|url-status=live}}</ref> In 2021 for [[Software:Android 12|Android 12]], the <code>adb backup</code> command was limited so that backing up user data from apps is opt-in using a per-app manifesto configuration<ref>{{Cite web|title=Behavior changes: Apps targeting Android 12 {{!}} Android 12 Beta|url=https://developer.android.com/about/versions/12/behavior-changes-12?hl=bg|access-date=2021-09-28|website=Android Developers|language=en|archive-date=2021-09-28|archive-url=https://web.archive.org/web/20210928195103/https://developer.android.com/about/versions/12/behavior-changes-12?hl=bg|url-status=live}}</ref> after being deprecated in Android 10 along with <code>adb restore</code>.<ref>{{cite web | url=https://www.bleepingcomputer.com/news/mobile/google-considers-removing-android-adb-backup-and-restore/ | title=Google Considers Removing Android ADB Backup and Restore }}</ref> [[Software:Fuchsia (operating system)|Fuchsia]] will be backwards-compatible with adb. It will be replaced with fx and ffx.<ref>{{Cite web |last=Bradshaw |first=Kyle |date=2022-08-26 |title=Google wants to make Fuchsia devices manageable with Android's ADB tool |url=https://9to5google.com/2022/08/26/fuchsia-adb-proposal/ |access-date=2022-08-29 |website=9to5Google |language=en-US}}</ref> | |||
== Setup == | |||
{{Gallery | |||
|title= | |||
|width=200 | height=350 | |||
|align=right | |||
|File:USB debugging prompt warning for Android 12 and up.png|For enabling USB debugging on the Android device, it needs to be enabled in the "developer settings" window | |||
|File:USB debugging prompt - RSA auth - Android 12 and up.png|After the device is connected to the host computer, the user needs to verify the RSA key fingerprint of the host computer | |||
}} | |||
=== Host computer === | |||
For Windows, the Android SDK contains the adb.exe binary that can be extracted and installed.<ref>{{Cite book|last=Harwani|first=B. M.|title=PhoneGap build: developing cross platform mobile applications in the cloud|date=2013|isbn=978-1-4665-8975-9|location=Boca Raton|pages=38|oclc=862745697}}</ref> How-To Geek recommends adding the folder containing the binaries to the [[PATH (variable)|PATH]] environment variable.<ref>{{Cite web|last1=Hoffman|first1=Chris|last2=Fedewa|first2=Joe|date=4 September 2021|title=How to Install and Use ADB, the Android Debug Bridge Utility|url=https://www.howtogeek.com/125769/how-to-install-and-use-abd-the-android-debug-bridge-utility/|url-status=live|access-date=2021-09-09|website=How-To Geek|language=en-US|archive-date=2021-09-18|archive-url=https://web.archive.org/web/20210918232917/https://www.howtogeek.com/125769/how-to-install-and-use-abd-the-android-debug-bridge-utility/}}</ref> | |||
On [[Software:Ubuntu|Ubuntu]], adb can be installed with the <code>android-tools-adb</code> package.<ref>{{Cite book|last=Smyth|first=Neil|title=Android Studio 4. 0 Development Essentials - Java Edition: Developing Android Apps Using Android Studio 4. 0, Java and Android Jetpack.|date=2020|isbn=978-1-951442-21-7|location=Cary|chapter=7|oclc=1190906409}}</ref> For [[Software:Debian|Debian]], it has been recommended to also install the <code>android-sdk-platform-tools-common</code> package next to the <code>adb</code> package, which installs the [[Software:Udev|udev]] rules which makes it possible to run the tool without [[Superuser|root permissions]].<ref>{{Cite web|title=Debian -- Details of package adb in bullseye|url=https://packages.debian.org/stable/adb|access-date=2021-09-08|website=packages.debian.org|archive-date=2021-09-08|archive-url=https://web.archive.org/web/20210908120401/https://packages.debian.org/stable/adb|url-status=live}}</ref> For macOS and other Linux distributions, the platform tools can be downloaded and the PATH variable can be modified in [[Software:Bash (Unix shell)|bashrc]].<ref>{{Cite web|title=How to Install Android Debug Bridge (ADB) and Fastboot|url=https://www.lifewire.com/android-debug-bridge-adb-4149410 |archive-url=https://ghostarchive.org/archive/20220130/https://www.lifewire.com/android-debug-bridge-adb-4149410 |archive-date=2022-01-30|url-status=live|access-date=2022-01-18|website=Lifewire|language=en}} </ref> | |||
=== Android device === | |||
In Android 4.2.2 or later ([[Engineering:Android version history#Overview|API level 17]]), a dialog is shown with an RSA [[Public key fingerprint|fingerprint]] that the user needs to accept. This protects against computers exploiting the debugging mechanism without consent of the device user.<ref>{{Cite web|title=Run apps on a hardware device|url=https://developer.android.com/studio/run/device?hl=de|access-date=2021-09-08|website=Android Developers|language=en|archive-date=2021-09-08|archive-url=https://web.archive.org/web/20210908120934/https://developer.android.com/studio/run/device?hl=de|url-status=live}}</ref> 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.<ref>{{Cite web|last=Wallen|first=Jack|title=How to enable Developer options in Android 4.2|url=https://www.techrepublic.com/article/pro-tip-how-to-enable-developer-options-in-android-42/|url-status=live|access-date=2021-09-09|website=[[TechRepublic]]|language=en|archive-date=2021-09-09|archive-url=https://web.archive.org/web/20210909131841/https://www.techrepublic.com/article/pro-tip-how-to-enable-developer-options-in-android-42/}}</ref> Some Android vendors have different procedures to enable it. For example, Huawei requires entering a pincode before adb can be enabled. | |||
If the [[Engineering:Touchscreen|touchscreen]] 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.<ref>{{Cite news|last=Ogubuike|first=Udochi|date=2019-08-09|title=How to enable USB debugging mode on Android|url=https://punchng.com/how-to-enable-usb-debugging-mode-on-android/|url-status=live|access-date=2021-09-09|newspaper=The Punch|language=en-US|archive-date=2019-09-17|archive-url=https://web.archive.org/web/20190917190512/https://punchng.com/how-to-enable-usb-debugging-mode-on-android/}}</ref><ref name=":1">{{Cite web|last=Aranzulla|first=Salvatore|title=Come attivare debug USB|url=https://www.aranzulla.it/come-attivare-debug-usb-1144637.html|url-status=live|access-date=2021-09-09|website=Salvatore Aranzulla|language=it-IT|archive-date=2021-09-09|archive-url=https://web.archive.org/web/20210909140557/https://www.aranzulla.it/come-attivare-debug-usb-1144637.html}}</ref> | |||
== Architecture == | |||
The adb protocol can be transported over USB or over [[Wi-Fi]] through [[Transmission Control Protocol|TCP]]. It uses a [[Client–server model|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, <code>UsbDeviceManager</code> and <code>UsbDebuggingManager</code>.<ref name=":0" /> | |||
=== 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.<ref name=":0" /> | |||
=== Server ↔ daemon protocol === | |||
The messages sent from the server consist of a 24-byte long header, with the following fields:<ref name=":0" /> | |||
* Command | |||
* First argument | |||
* Second argument | |||
* Length of the payload, 0 or higher | |||
* CRC-32 of the data payload | |||
* Magic value, calculated through command XOR <code>0xFFFFFFFF</code> | |||
== Security == | |||
Up to Android 2.2, Android was vulnerable to the ''RageAgainstTheCage'' [[Exploit (computer security)|exploit]]. The adb [[Daemon (computing)|daemon]] did not check for the return value of the [[Setuid|setuid]] [[System call|system call]] when dropping privileges. The exploit [[Fork (system call)|forks]] processes until it fails due to the exhaustion of [[Process identifier|process identifier]]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.<ref>{{Cite book|last=Drake|first=Joshua J.|title=Android hacker's handbook|date=2014|publisher=Wiley|others=Zach Lanier, Collin Mulliner, Pau Oliva, Stephen A. Ridley, Georg Wicherski|isbn=978-1-118-60861-6|location=Indianapolis, IN|pages=75|oclc=875820167}}</ref> In 2017, a security vulnerability was disclosed that exploited ADB to take over the onboard [[Modem|modem]]. The attack required adb to be already enabled and authorized, although some workarounds were available.<ref>{{Cite web|last=Mendelsohn|first=Tom|date=2017-01-09|title=Google plugs severe Android vulnerability that exposed devices to spying|url=https://arstechnica.com/information-technology/2017/01/google-plugs-severe-android-bootmode-vulnerability/|url-status=live|access-date=2021-09-10|website=[[Ars Technica]]|language=en-us|archive-date=2021-09-10|archive-url=https://web.archive.org/web/20210910135518/https://arstechnica.com/information-technology/2017/01/google-plugs-severe-android-bootmode-vulnerability/}}</ref> | |||
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.<ref>{{Cite web|last=Cimpanu|first=Catalin|title=Android devices ensnared in DDoS botnet|url=https://www.zdnet.com/article/android-devices-ensnared-in-ddos-botnet/|url-status=live|access-date=2021-09-10|website=[[ZDNet]]|language=en|archive-date=2021-09-10|archive-url=https://web.archive.org/web/20210910135518/https://www.zdnet.com/article/android-devices-ensnared-in-ddos-botnet/}}</ref> adb can also be used to remove [[Malware|malware]], by booting into [[Safe mode|safe mode]] and running the <code>adb uninstall</code> command.<ref>{{Cite news|last=Schuman|first=Evan|title=This Vultur app takes malicious to the next level|language=en|work=Computerworld|url=https://www.computerworld.com/article/3627326/this-vultur-app-takes-malicious-to-the-next-level.html|access-date=2021-09-10|archive-date=2021-09-10|archive-url=https://web.archive.org/web/20210910135522/https://www.computerworld.com/article/3627326/this-vultur-app-takes-malicious-to-the-next-level.html|url-status=live}}</ref> | |||
== See also == | |||
* [[Software:Android recovery mode|Android recovery mode]] | |||
* [[Fastboot]] | |||
== References == | == References == | ||
{{Reflist}} | {{Reflist}} | ||
== External links == | |||
* {{Official website|https://developer.android.com/tools/adb}} | |||
* {{Cite web |title=Using ADB and fastboot |url=https://wiki.lineageos.org/adb_fastboot_guide |access-date=2023-05-02 |website=[[Software:LineageOS|LineageOS]] wiki}} | |||
* {{Cite web |title=Android Debug Bridge |url=https://wiki.archlinux.org/title/Android_Debug_Bridge |access-date=2023-05-02 |website=[[Software:Arch Linux|Arch Linux]] wiki}} | |||
* {{Cite web |title=Android/adb - Gentoo Wiki |url=https://wiki.gentoo.org/wiki/Android/adb |access-date=2023-05-02 |website=[[Software:Gentoo Linux|Gentoo Linux]] wiki}} | |||
* {{Cite web |title=Android Debug Bridge (Archive) |url=https://web.archive.org/web/20240226120857/https://en.droidwiki.org/wiki/Android_Debug_Bridge |access-date=2023-05-02 |website=Android Wiki |language=en}} | |||
{{Android}} | |||
[[Category:Android (operating system)]] | [[Category:Android (operating system)]] | ||
[[Category:Android (operating system) development software]] | |||
[[Category:Debugging]] | |||
[[Category:Communications protocols]] | [[Category:Communications protocols]] | ||
[[Category: | [[Category:Free software programmed in C++]] | ||
[[Category:Software using the Apache license]] | |||
{{Sourceattribution|Android Debug Bridge}} | {{Sourceattribution|Android Debug Bridge}} | ||
Latest revision as of 00:49, 20 May 2026
Starting the adb server in Command Prompt, which then enumerates the devices. After that, a shell is opened on the device being debugged to run the uname command. | |
| Original author(s) | |
|---|---|
| Stable release | 34.0.1 (March 2023)
|
| Repository | android.googlesource.com |
| Written in | C++ |
| Operating system | Windows, Linux, macOS |
| Included with | Android SDK |
| Type | Software development tool |
| License | Apache License 2.0 |
| Website | developer |
The Android Debug Bridge (commonly abbreviated as adb) is a programming tool used for the debugging of Android-based devices. The daemon on the Android device connects with the server on the host PC over USB or TCP, which connects to the client that is used by the end-user over TCP. Made available as open-source software under the Apache License by Google since 2007, its features include a shell and the possibility to make backups. The adb software is available for Windows, Linux and macOS. It has been misused by botnets and other malware, for which mitigations were developed such as RSA authentication and device whitelisting.
Features

Features of adb include copying files from the host computer,[1] installing apps, viewing logcat output, getting a Unix shell,[2] and rebooting into Qualcomm EDL mode.[3] For example, Android applications can be saved by the command backup to a file.[4] It also includes support for the Java Debug Wire Protocol.[5]
Some graphical interfaces have been made available. The graphical Android Device Monitor in Android Studio can be used for retrieving information from an Android device.[6]
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[7] and Chrome OS's Android virtual machine.[8]
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.[9]
Development history
The Android Software Development Kit (SDK) was first released in 2007.[10] Since 2017, Google made it possible to download adb separately from the Android SDK.[11]
In 2015, Microsoft released an Android emulator that can connect to the adb client.[12] In 2016 for Android Studio 2.0 a 5x performance improvement was made for installing apps and pushing files through adb.[13] For easier usage of Android Things, a wrapper was made in 2017 around manual adb commands.[14] For Android 11 in 2020, Google added adb incremental installations.[15] In 2020, Wi-Fi adb was integrated into Android Studio for macOS.[16] In 2021 for Android 12, the adb backup command was limited so that backing up user data from apps is opt-in using a per-app manifesto configuration[17] after being deprecated in Android 10 along with adb restore.[18] Fuchsia will be backwards-compatible with adb. It will be replaced with fx and ffx.[19]
Setup
Host computer
For Windows, the Android SDK contains the adb.exe binary that can be extracted and installed.[20] How-To Geek recommends adding the folder containing the binaries to the PATH environment variable.[21]
On Ubuntu, adb can be installed with the android-tools-adb package.[22] For Debian, it has been recommended to also install the android-sdk-platform-tools-common package next to the adb package, which installs the udev rules which makes it possible to run the tool without root permissions.[23] For macOS and other Linux distributions, the platform tools can be downloaded and the PATH variable can be modified in bashrc.[24]
Android device
In Android 4.2.2 or later (API level 17), a dialog is shown with an RSA fingerprint that the user needs to accept. This protects against computers exploiting the debugging mechanism without consent of the device user.[25] 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.[26] Some Android vendors have different procedures to enable it. For example, Huawei requires entering a pincode before adb can be enabled.
If the touchscreen 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.[27][28]
Architecture
The adb protocol can be transported over USB or over Wi-Fi 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.[5]
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.[5]
Server ↔ daemon protocol
The messages sent from the server consist of a 24-byte long header, with the following fields:[5]
- 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 did not check for the return value of the setuid system call when dropping privileges. The exploit forks processes until it fails due to the exhaustion of process identifiers. 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.[29] In 2017, a security vulnerability was disclosed that exploited ADB to take over the onboard modem. The attack required adb to be already enabled and authorized, although some workarounds were available.[30]
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.[31] adb can also be used to remove malware, by booting into safe mode and running the adb uninstall command.[32]
See also
References
- ↑ Darcey, Lauren (2012). Android wireless application development. Shane Conder (3rd ed.). Upper Saddle River, NJ: Addison-Wesley. ISBN 978-0-321-81383-1. OCLC 749852462.
- ↑ "Things You Can Do with Android's adb Command" (in en). https://www.dummies.com/web-design-development/mobile-apps/android-apps/things-you-can-do-with-androids-adb-command/.
- ↑ EASTTOM, CHUCK (2021). An In-Depth Guide to Mobile Device Forensics. [S.l.]: CRC PRESS. pp. 72. ISBN 978-0-367-63300-4. OCLC 1250310301.
- ↑ Jack Wallen (2015-03-06). "How to create a full backup of your Android device without root". https://www.techrepublic.com/article/how-to-create-a-full-backup-of-your-android-device-without-root/.
- ↑ 5.0 5.1 5.2 5.3 Regupathy, Rajaram (2014). Unboxing Android USB: a hands-on approach with real World examples. Berkeley, CA. ISBN 978-1-4302-6209-1. OCLC 880673864.
- ↑ Morgillo, Ivan; Viola, Stefano (2016). Learning embedded Android N programming: create the perfectly customized system by unleashing the power of Android OS on your embedded device. Birmingham, UK. p. 89. ISBN 9781785283284. OCLC 1020708322. https://books.google.com/books?id=bOrUDQAAQBAJ. Retrieved 2021-09-26.
- ↑ "How to sideload Android apps on Windows 11". 23 January 2022. https://www.xda-developers.com/how-to-sideload-android-apps-on-windows-11/.
- ↑ "How to sideload apps to a Chromebook". 5 March 2023. https://www.xda-developers.com/how-sideload-apps-chromebook/.
- ↑ "User manual | Shizuku". https://shizuku.rikka.app/guide/setup/.
- ↑ "Google releases Android SDK" (in en-US). https://www.macworld.com/article/188112/androidsdk.html.
- ↑ "Google makes ADB, fastboot, and other platform tools available without full SDK or Android Studio download" (in en-US). 2017-01-05. https://www.androidpolice.com/2017/01/05/google-makes-adb-fastboot-platform-tools-available-without-full-sdk-android-studio-download/.
- ↑ Vasile, Cosmin (29 July 2015). "Microsoft Releases Android Emulator and It's Supposed to Be Faster than Google's" (in english). https://news.softpedia.com/news/microsoft-releases-android-emulator-and-it-s-supposed-to-be-faster-than-google-s-488016.shtml.
- ↑ "Android Studio 2.0 - Beta" (in en). https://android-developers.googleblog.com/2016/02/android-studio-20-beta.html.
- ↑ "Android Things Developer Preview 6" (in en). https://android-developers.googleblog.com/2017/11/android-things-developer-preview-6.html.
- ↑ "Turning it up to 11: Android 11 for developers" (in en). https://android-developers.googleblog.com/2020/09/android11-final-release.html.
- ↑ "Announcing Android Studio Arctic Fox (2020.3.1) & Android Gradle plugin 7.0" (in en). https://android-developers.googleblog.com/2020/12/announcing-android-studio-arctic-fox.html.
- ↑ "Behavior changes: Apps targeting Android 12 | Android 12 Beta" (in en). https://developer.android.com/about/versions/12/behavior-changes-12?hl=bg.
- ↑ "Google Considers Removing Android ADB Backup and Restore". https://www.bleepingcomputer.com/news/mobile/google-considers-removing-android-adb-backup-and-restore/.
- ↑ Bradshaw, Kyle (2022-08-26). "Google wants to make Fuchsia devices manageable with Android's ADB tool" (in en-US). https://9to5google.com/2022/08/26/fuchsia-adb-proposal/.
- ↑ Harwani, B. M. (2013). PhoneGap build: developing cross platform mobile applications in the cloud. Boca Raton. pp. 38. ISBN 978-1-4665-8975-9. OCLC 862745697.
- ↑ Hoffman, Chris; Fedewa, Joe (4 September 2021). "How to Install and Use ADB, the Android Debug Bridge Utility" (in en-US). https://www.howtogeek.com/125769/how-to-install-and-use-abd-the-android-debug-bridge-utility/.
- ↑ Smyth, Neil (2020). "7". Android Studio 4. 0 Development Essentials - Java Edition: Developing Android Apps Using Android Studio 4. 0, Java and Android Jetpack.. Cary. ISBN 978-1-951442-21-7. OCLC 1190906409.
- ↑ "Debian -- Details of package adb in bullseye". https://packages.debian.org/stable/adb.
- ↑ "How to Install Android Debug Bridge (ADB) and Fastboot" (in en). https://www.lifewire.com/android-debug-bridge-adb-4149410.
- ↑ "Run apps on a hardware device" (in en). https://developer.android.com/studio/run/device?hl=de.
- ↑ Wallen, Jack. "How to enable Developer options in Android 4.2" (in en). https://www.techrepublic.com/article/pro-tip-how-to-enable-developer-options-in-android-42/.
- ↑ Ogubuike, Udochi (2019-08-09). "How to enable USB debugging mode on Android" (in en-US). The Punch. https://punchng.com/how-to-enable-usb-debugging-mode-on-android/.
- ↑ Aranzulla, Salvatore. "Come attivare debug USB" (in it-IT). https://www.aranzulla.it/come-attivare-debug-usb-1144637.html.
- ↑ Drake, Joshua J. (2014). Android hacker's handbook. Zach Lanier, Collin Mulliner, Pau Oliva, Stephen A. Ridley, Georg Wicherski. Indianapolis, IN: Wiley. pp. 75. ISBN 978-1-118-60861-6. OCLC 875820167.
- ↑ Mendelsohn, Tom (2017-01-09). "Google plugs severe Android vulnerability that exposed devices to spying" (in en-us). https://arstechnica.com/information-technology/2017/01/google-plugs-severe-android-bootmode-vulnerability/.
- ↑ Cimpanu, Catalin. "Android devices ensnared in DDoS botnet" (in en). https://www.zdnet.com/article/android-devices-ensnared-in-ddos-botnet/.
- ↑ Schuman, Evan. "This Vultur app takes malicious to the next level" (in en). Computerworld. https://www.computerworld.com/article/3627326/this-vultur-app-takes-malicious-to-the-next-level.html.
External links
- Official website
- "Using ADB and fastboot". https://wiki.lineageos.org/adb_fastboot_guide.
- "Android Debug Bridge". https://wiki.archlinux.org/title/Android_Debug_Bridge.
- "Android/adb - Gentoo Wiki". https://wiki.gentoo.org/wiki/Android/adb.
- "Android Debug Bridge (Archive)" (in en). https://web.archive.org/web/20240226120857/https://en.droidwiki.org/wiki/Android_Debug_Bridge.
