Difference between revisions of "Setting Up Ubertooth on macOS for Bluetooth Hacking"

From Embedded Lab Vienna for IoT & Security
Jump to navigation Jump to search
Line 127: Line 127:


  sudo ubertooth-dfu -d bluetooth_rxtx.dfu -r
  sudo ubertooth-dfu -d bluetooth_rxtx.dfu -r
In case the libubertooth library is not loading check if the paths are correct.


In ubertooth-2020-12-R1/host the following command leads to getting a list of sniffed Bluetooth packets with their Lower Address Parts (LAP):
In ubertooth-2020-12-R1/host the following command leads to getting a list of sniffed Bluetooth packets with their Lower Address Parts (LAP):
Line 146: Line 148:
  mkfifo /tmp/pipe
  mkfifo /tmp/pipe
  ubertooth-btle -f 78:A5:04:62:71:3D -c /tmp/pipe
  ubertooth-btle -f 78:A5:04:62:71:3D -c /tmp/pipe
Find packages that involve the Polar Smartwatch


  systime=1728247529 freq=2402 addr=8e89bed6 delta_t=34.320 ms rssi=-60
  systime=1728247529 freq=2402 addr=8e89bed6 delta_t=34.320 ms rssi=-60
Line 166: Line 170:
     CRC:  47 e9 1f
     CRC:  47 e9 1f


=== Step 8 - Install Crackle ===
=== Step 8 - Use Crackle to crack packages ===


Enter these commands in the shell
Enter these commands:


  git clone https://github.com/mikeryan/crackle.git
  git clone https://github.com/mikeryan/crackle.git
Line 174: Line 178:
  make
  make


Try cracking your pcap.file
Now try cracking your pcap.file


  ./crackle -i <your_file.pcap>
  ./crackle -i <your_file.pcap> -o <your_new_output_file.pcap>
 
In this case it wasnt possible to crack any packages from the smartwatch.


=== Step 9 - Install bleak library ===
=== Step 9 - Install bleak library ===


Enter these commands in the shell
  pip install bleak
 
  python3.12 -m venv myenv
source myenv/bin/activate


=== Step 10 - Read characteristics ===
=== Step 10 - Read characteristics ===
Line 189: Line 192:
Enter these commands in the shell
Enter these commands in the shell


python3.12 -m venv myenv
source myenv/bin/activate


=== Step 11 - Subscribe to characteristics ===
=== Step 11 - Subscribe to characteristics ===
Line 196: Line 197:
Enter these commands in the shell
Enter these commands in the shell


python3.12 -m venv myenv
source myenv/bin/activate


=== Step 12 - Manipulate characteristics ===
=== Step 12 - Manipulate characteristics ===
Line 203: Line 202:
Enter these commands in the shell
Enter these commands in the shell


python3.12 -m venv myenv
 
source myenv/bin/activate


== Used Hardware ==
== Used Hardware ==

Revision as of 22:31, 4 December 2024

Summary

This is a step-by-step guide on how to sniff Bluetooth Low Energy (BLE) packets between a Polar Vantage Smartwatch and a phone using the Ubertooth One. It will go into detail on the setup on a MacBook Air with MacOS using a python environment for the libraries that are used for the setup. Additionally every step of the actual sniff will be outlined. This guide is based on the seminar paper "Smartwatch Hacking Attack" that was written within the FH-course "Selected IT-Security Chapters".

Requirements

  • Hardware tools: Ubertooth One: Firmware version: 2020-12-R1 (API:1.07)
  • Smartwatch: Polar Vantage M
  • Phone: Samsung Galaxy J3
  • Unix-based Operating System: macOS (macOS Sequoia 15.1.1), on a MacBook Air with an Apple M1 chip.
  • Virtual Environment: Python Environment: Python 3.12
  • Packages: libusb, wget, cmake, pkg-config, setuptools, pyqt5, numpy
  • Libraries: libbtbb, bleak
  • Software Tools: Crackle

These setup steps for the Ubertooth tool are also summarized here Ubertooth - Build Guide - https://ubertooth.readthedocs.io/en/latest/build_guide.html.

Description

Step 1 - Install homebrew

Enter these commands in the shell

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
eval "$(/opt/homebrew/bin/brew shellenv)"

Step 2 - Install Python Environment

Enter these commands in the shell

python3.12 -m venv myenv
source myenv/bin/activate

Step 3 - Install libusb, wget, cmake, pkg-config

Enter these commands in the shell

brew install libusb wget cmake pkg-config

Step 4 - Install the Bluetooth baseband library

Enter these commands in the shell

wget https://github.com/greatscottgadgets/libbtbb/archive/2020-12-R1.tar.gz -O libbtbb-2020-12-R1.tar.gz
tar -xf libbtbb-2020-12-R1.tar.gz
cd libbtbb-2020-12-R1
mkdir build
cd build
cmake ..
make

If errors occur with installing distutils switch to setuptools instead.

pip install setuptools

After installing the setuptools also change the "from distutils import setup" line in the the libbtbb-2020-12-R1/build/python/pcaptools/setup.py file to this:

from setuptools import setup

Also update the version in that same file to this:

version = '2020.12.R1'

If necessary set the pythonpath in case you have different python versions:

export PYTHONPATH=/Users/<username>/myenv/lib/python3.12/site-packages:$PYTHONPATH

Then retry:

make
sudo make install

Step 5 - Install the Ubertooth repository

Enter these commands in the shell

wget https://github.com/greatscottgadgets/ubertooth/releases/download/2020-12-R1/ubertooth-2020-12-R1.tar.xz
tar -xf ubertooth-2020-12-R1.tar.xz
cd ubertooth-2020-12-R1/host
mkdir build
cd build
cmake ..
make

If libusb module not found errors occur go to ubertooth-2020-12-R1/host/CMakeLists.txt an add your libusb-path manually:

include_directories(/opt/homebrew/include)
link_directories(/opt/homebrew/lib)

Additionally again change the "from distutils import setup" line in the the ubertooth-2020-12-R1/host/build/python/specan_ui/setup.py file to this:

from setuptools import setup

Also update the version in that same file to this:

version = '2020.12.R1'

Then retry:

make
sudo make install

If you get errors regarding the environment variables showing that your library wasnt found you need to set the library path via the MacOs's dynamic linker.

export DYLD_LIBRARY_PATH="/usr/local/lib:$DYLD_LIBRARY_PATH"

or make it persistent in shell configurations:

~/.zshrc

Afterwards confirm the ubertooth library is working correctly:

ubertooth-util

Step 6 - Test Ubertooth One commands

Test these commands:

ubertooth-util -H
ubertooth-util -v
ubertooth-util -p
ubertooth-util -s

Update Ubertooth firmware in ubertooth-2020-12-R1/ubertooth-one-firmware-bin:

sudo ubertooth-dfu -d bluetooth_rxtx.dfu -r

In case the libubertooth library is not loading check if the paths are correct.

In ubertooth-2020-12-R1/host the following command leads to getting a list of sniffed Bluetooth packets with their Lower Address Parts (LAP):

ubertooth-rx

For collecting Upper Address Parts (UAP) from the captured packets add -z:

ubertooth-rx -z

Let it run for a while and look at the output. It will be summarized as Survey Results at the end of the output. There you can see the significant part of Bluetooth addresses of devices that were scanned.

Step 7 - Use BTLE to follow the connection of the Bluetooth device you found. (Replace with device Bluetooth Address)

ubertooth-btle -f 78:A5:04:62:71:3D -r test.pcap

Or create a pipe for viewing the captures directly in Wireshark:

mkfifo /tmp/pipe
ubertooth-btle -f 78:A5:04:62:71:3D -c /tmp/pipe

Find packages that involve the Polar Smartwatch

systime=1728247529 freq=2402 addr=8e89bed6 delta_t=34.320 ms rssi=-60
20 1b c9 28 84 1a 9e a0 02 01 06 03 02 ee fe 0d ff 6b 00 72 08 00 00 00 00 00 00 00 00 47 e9 1f 
Advertising / AA 8e89bed6 (valid)/ 27 bytes
    Channel Index: 37
    Type:  ADV_IND
    AdvA:  a0:9e:1a:84:28:c9 (public)
    AdvData: 02 01 06 03 02 ee fe 0d ff 6b 00 72 08 00 00 00 00 00 00 00 00
        Type 01 (Flags)
           00000110
               LE General Discoverable Mode
               BR/EDR Not Supported
        Type 02 (16-bit Service UUIDs, more available)
           feee
        Type ff (Manufacturer Specific Data)
           Company: Polar Electro OY
           Data: 72 08 00 00 00 00 00 00 00 00
    Data:  c9 28 84 1a 9e a0 02 01 06 03 02 ee fe 0d ff 6b 00 72 08 00 00 00 00 00 00 00 00
    CRC:   47 e9 1f

Step 8 - Use Crackle to crack packages

Enter these commands:

git clone https://github.com/mikeryan/crackle.git
cd crackle
make

Now try cracking your pcap.file

./crackle -i <your_file.pcap> -o <your_new_output_file.pcap>

In this case it wasnt possible to crack any packages from the smartwatch.

Step 9 - Install bleak library

pip install bleak

Step 10 - Read characteristics

Enter these commands in the shell


Step 11 - Subscribe to characteristics

Enter these commands in the shell


Step 12 - Manipulate characteristics

Enter these commands in the shell


Used Hardware

Device to be used with this documentation Maybe another device to be used with this documentation

Courses

References