SpiderLabs Blog

Abusing the Android Debug Bridge

Written by | Dec 14, 2012 1:12:00 PM

The android debug bridge (or ADB for short) is a valuable tool, it is what allows smart phone tinkerers unobstructed access to their device for customization. This said, the debug bridge has a major caveat of being too easily left on, and requiring no authentication before granting access. ADB can expose your phone to anyone who can gain physical access or is on the same network.

The tools to access ADB are free to download (they are bundled with the Android SDK) and allow access to all of the commands listed here: http://developer.android.com/tools/help/adb.html

Some of the more powerful actions are:

  • Install applications onto the phone.
  • Copy files to and from the device.
  • Open an interactive shell on the device.

If you've used ADB before, you know the standard approach is to access ADB via USB. Turn on USB debugging, plug in your phone to your computer and have fun! The caveat here is, when you unplug your phone, USB debugging is not always turned back off and it is not always apparent that it has been left on. The next time you plug your phone in to a USB port, if debugging was left on you have opened your phone up for attack.

I should clarify that these settings are unique to the OS you have installed on your phone, some operating systems turn off ADB automatically when you un plug from the network or USB host while others come shipped with ADB turned on by default. To expand on this below is the status bar from three different devices showing how each operating system decided to show if ADB has been turned on:

All of the above phones have debugging turned on, and are plugged in. The icon on the far left states USB is connected, and on the two top examples they also report that USB debugging is turned on/active. For those who are curious, the order of the devices are a development HTC one, Stock Motorola , and finally a rooted phone with a common customized rom.

Seems safe right? Well I have encountered no devices or roms that give you the same notice in the status bar when ADB is enabled over the network, here is the same HTC development phone's status bar with ADB over the network enabled and currently connected:

 

The two most publicized attacks related to this are juice jacking and a physical drive by. Juice jacking involves setting up a malicious charging kiosk, or malware on a computer; so that when a phone or tablet has been plugged in an automated attack is initiated against the device. The physical drive by attack is when the attacker maximizes the short period of time a phone may be left unattended (such as in a public setting) in order to exfiltrate as much data as possible. With these physical drive-by attacks, it is also trivial to setup a network backdoor immediately, by setting an option that turns ADB on over the network. An attacker could plug in to your phone at a coffee shop and enable ADB over the network with a single command, that's faster than it takes you to retrieve your beverage from the counter. Once that is done, they can return to their laptop and continue the attack for as long as you remain on the coffee shop's wifi.

ADB over the network only exasperates the problem, as shown above. It may help with managing a large number of devices on a safe and secured network, but it has a severe problem: Not only is it unauthenticated full access to the phone over the network, ADB binds to every interface and IP address the device is connected to (including the cellular data network) and has no status bar notification. This places a large amount of trust that your cell provider has properly secured their cellular data network from allowing directly connecting to other devices on the data network.

How big of a threat is this really? While the payoff is immense, the likelihood someone has ADB enabled is low. An average android user typical has no reason to enable it, and it would be unlikely for a phone modder/tinkerer/hacker who is conscientious about this threat to leave it on. There is a sweet spot though; anyone who leaves this option on for convenience or by accident, and it happens. I have personally seen 2 occasions where a device had ADB turned on unbeknownst to the device's owner, when explaining this threat to people over the past year.

All you need to do to secure your phones and make sure this option is turned off this option when it's not in use. The option is in the phone's settings under the Developer menu:

Our TrustKeeper Scan Engine has recently been updated to include tests to detect devices with this insecure feature enabled on the network.