Wednesday, 17 October 2012

Discovering Bluetooth Devices

In July 2011 Michael Ossmann wrote a blog post entitled "Discoverability is Not a Mitigating Factor" which discussed the Bluetooth security advice being given about discoverable devices by people and organisations that should know better.  It is worth reading his post in full, but I'll quote two important parts here:

"LAP sniffing is easy. Spill and Bittau showed how to sniff LAPs with a USRP for about $1000. Now it can be done with an Ubertooth One for about a tenth of that price. It can even be done using Travis Goodspeed's method for promiscuous sniffing with lower cost platforms."

"The UAP is only slightly more difficult for an attacker to learn. Project Ubertooth and gr-bluetooth include software that implements automatic UAP determination based on passive observation of just a few packets."

I completely agree with Michael on this, the methods for retrieving the LAP and UAP are easy and well known, but we still hear advice suggesting that turning off the discoverable setting for your device will protect it from being found by malicious attackers.  So, taking in to account Wright's law:

“Security will not get better until tools for practical exploration of the attack surface are made available.” -Josh Wright

I wrote a tool that would initiate a standard Bluetooth device scan, but also add devices discovered with the Ubertooth.  I call the tool "ubertooth-scan" and it's available from the master branch of the Ubertooth git repository.

Ubertooth-scan requires an Ubertooth and a standard Bluetooth device on a host with libbluetooth (bluez) installed.  First we use the Bluetooth device to perform an HCI scan, this is the same as running "hcitool scan" from the command line.  The second part of the tool uses the Ubertooth to promiscuously sniff for Bluetooth packets, retrieving the LAP and UAP values before handing them over to libbluetooth to query the device name.  Most non-discoverable devices respond to name inquiries.

I've also added an extended query (triggered by the -x option) which will check the device for supported features, chipset version and clock offset from the local device.

Using a dongle to get the clock offset for a remote device allows us to calculate the clock value of the target and use that to hop along with the piconet, dumping packet data to screen as we go.  Here's a quick snippet of the code in action, apologies for the low quality video:

I'll be presenting this in more detail, along with other recent developments in the Ubertooth project, at Ruxcon this weekend.  If you are in Melbourne or are already planning to attend Ruxcon, and would like more detail, please come to my presentation at 2pm on Sunday in track 1.