Android Debug Bridge: Difference between revisions

Content deleted Content added
One Plus 5 is not relevant here, unix shells can be opened on any device after starting an adb server
m excess space
Line 51:
== 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|url=https://www.worldcat.org/oclc/749852462|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|access-date=2021-09-26|archive-date=2021-09-26|archive-url=https://web.archive.org/web/20210926122121/https://www.worldcat.org/title/android-wireless-application-development/oclc/749852462|url-status=live}}</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=[[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|url=https://www.worldcat.org/oclc/1250310301|title=An In-Depth Guide to Mobile Device Forensics|date=2021|publisher=CRC PRESS|isbn=0-367-63300-0|___location=[S.l.]|pages=72|oclc=1250310301|access-date=2021-09-26|archive-date=2021-09-26|archive-url=https://web.archive.org/web/20210926122044/https://www.worldcat.org/title/in-depth-guide-to-mobile-device-forensics/oclc/1250310301|url-status=live}}</ref> For example, Android [[Android application package|applications]] can be saved by the command <code>[[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|url=https://www.worldcat.org/oclc/880673864|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|access-date=2021-09-26|archive-date=2021-09-26|archive-url=https://web.archive.org/web/20210926122019/https://www.worldcat.org/title/unboxing-android-usb-a-hands-on-approach-with-real-world-examples/oclc/880673864|url-status=live}}</ref>
 
Some [[Graphical user interface|graphical interfaces]] have been made available. The graphical Android Device Monitor in [[Android Studio]] can be used for retrieving information from an Android device.<ref>{{Cite book|last=Morgillo|first=Ivan|last2=Viola|first2=Stefano|url=https://www.google.co.in/books/edition/Learning_Embedded_Android_N_Programming/bOrUDQAAQBAJ?hl=en|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>
Line 58:
The [[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]]|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 [[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 [[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 [[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>
 
== Setup ==
Line 84:
 
=== 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 intialinitial 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 ===
Line 97:
 
== 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]] [[system call]] when [[dropping privileges]]. The exploit [[Fork (system call)|forks]] processes until it fails due to the exhaustion of [[Process identifier|process identifiers]]. When the daemon crashes and restarts, it can't 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.|url=https://www.worldcat.org/oclc/875820167|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|access-date=2021-09-26|archive-date=2021-09-26|archive-url=https://web.archive.org/web/20210926122022/https://www.worldcat.org/title/android-hackers-handbook/oclc/875820167|url-status=live}}</ref>
 
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.<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]], by booting into [[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>