graduate operating systems mini-project: hacking bluetooth in linux alan joseph j caceres

16
Graduate Operating Graduate Operating Systems Systems Mini-Project: Mini-Project: Hacking Bluetooth In Linux Alan Joseph J Caceres

Upload: clarissa-maxwell

Post on 11-Jan-2016

226 views

Category:

Documents


2 download

TRANSCRIPT

Page 1: Graduate Operating Systems Mini-Project: Hacking Bluetooth In Linux Alan Joseph J Caceres

Graduate Operating SystemsGraduate Operating SystemsMini-Project:Mini-Project:

Hacking Bluetooth In Linux

Alan Joseph J Caceres

Page 2: Graduate Operating Systems Mini-Project: Hacking Bluetooth In Linux Alan Joseph J Caceres

Overview

• Hacking Bluetooth in Linux

• Modifying Linux Bluetooth stack to pass a sequence of bytes to a device in order to establish a connection.

Page 3: Graduate Operating Systems Mini-Project: Hacking Bluetooth In Linux Alan Joseph J Caceres

Introduction to BluetoothIntroduction to Bluetooth

3

• What is Bluetooth?– Form of wireless communication

– Short-range

– Connect multiple devices

– Low data rate compared to Wi-Fi

Page 4: Graduate Operating Systems Mini-Project: Hacking Bluetooth In Linux Alan Joseph J Caceres

Introduction to Bluetooth

• Form of wireless communication– Similar to Wi-Fi (IEEE 802.11)– Uses short-wavelength transmissions within 2.4GHz

range in the public radio spectrum– A form of ad-hoc networking – It follows the IEEE 802.15 standard for Wireless

Personal Area Networks (WPAN)

Page 5: Graduate Operating Systems Mini-Project: Hacking Bluetooth In Linux Alan Joseph J Caceres

Introduction to Bluetooth

• Short-range– Because of the short-wavelength used for

transmission; distance is limited– Low power device minimizes transmission distance

as well– Advantageous for creating Wireless Personal Area

Networks

Page 6: Graduate Operating Systems Mini-Project: Hacking Bluetooth In Linux Alan Joseph J Caceres

Introduction to Bluetooth

• Connect multiple devices– Excellent for ad-hoc networking– Devices can create Piconets–Master / Slave devices can switch roles as needed.– Devices can range from headsets to keyboards

and mice to gaming consoles like Nintendo's Wii gaming console.

Page 7: Graduate Operating Systems Mini-Project: Hacking Bluetooth In Linux Alan Joseph J Caceres

Bluetooth on Linux Linux distributions using the Linux kernel

2.4.6 and later implement the Open Source bluetooth stack BlueZ.

BlueZ provides different modules for the Linux platform to interface with various bluetooth enabled devices and services.

Page 8: Graduate Operating Systems Mini-Project: Hacking Bluetooth In Linux Alan Joseph J Caceres

Bluetooth on Linux

For this mini-project we will be looking at the latest version of the BlueZ bluetooth stack; BlueZ 4.101.

How can we use a sequence of bytes to establish a connection between two bluetooth devices?

Page 9: Graduate Operating Systems Mini-Project: Hacking Bluetooth In Linux Alan Joseph J Caceres

Checking out the source

In the BlueZ bluetooth stack there are many modules that are provided to assist in the “pairing” of various bluetooth devices.

Where do they store the passkey for these devices? It has to be in one of the modules.

Page 10: Graduate Operating Systems Mini-Project: Hacking Bluetooth In Linux Alan Joseph J Caceres

A little info...

Bluetooth devices have a “master/slave” relationship.

When two bluetooth devices establish a connection between each other they communicate via their Media Access Control (MAC) address.

Page 11: Graduate Operating Systems Mini-Project: Hacking Bluetooth In Linux Alan Joseph J Caceres

Master meet slave

After a connection between bluetooth devices have be established, the “master” device need only request the “slave” by its MAC address to initiate a connection if it becomes severed.

This feature is what I will be exploiting.

Page 12: Graduate Operating Systems Mini-Project: Hacking Bluetooth In Linux Alan Joseph J Caceres

Hacking it

In the BlueZ bluetooth stack there is a file called hidd.c that performs the connection authentication and encryption.

There are specific functions within this class that use the struct bdaddr_t which is an unsigned int array.

Page 13: Graduate Operating Systems Mini-Project: Hacking Bluetooth In Linux Alan Joseph J Caceres

Hacking it.

The unsigned int array within bdaddr_t has a size of 6. This is basically to hold the MAC address information in integer form.

A MAC address is basically six hexadecimal numbers. A call to the function str2ba() converts this into the bytes for the bdaddr_t struct.

Page 14: Graduate Operating Systems Mini-Project: Hacking Bluetooth In Linux Alan Joseph J Caceres

Use the MAC

Knowing the MAC address of both bluetooth devices is all that is needed to perform a “pairing”.

By hard coding the MAC address of both bluetooth devices into the bdaddr_t src and dst variables this would allow the devices to stay permanently paired.

Page 15: Graduate Operating Systems Mini-Project: Hacking Bluetooth In Linux Alan Joseph J Caceres

Use the MAC

An example would be seen in the request_authentication() method that has two bluetooth device addresses as parameters for source and destination address.

Removing these parameters or setting their default values to the devices' MAC addresses should immediately pair them when they are in range.

Page 16: Graduate Operating Systems Mini-Project: Hacking Bluetooth In Linux Alan Joseph J Caceres

Tricky tricky

Some devices may have MAC addresses that do not play well with the bluetooth stack. This may be because they contain 00 as the beginning or ending part of the address.

They may also use a modified way of connecting to a host machine such as using the host machine's address reversed as the passkey.

Hard-coding may be a way to circumvent this kind of trickery.