PI 1: Magic in the Air
Description:
We are investigating an individual we believe is connected to a group smuggling drugs into the country and selling them on social media. You have been posted on a stake out in the apartment above theirs and with the help of space-age eavesdropping technology have managed to extract some data from their computer. What is the phone number of the suspect’s criminal contact?
flag format includes country code so it should be in the format: rgbCTF{+00000000000}
Category: Forensics
First Blood: 3 hour, 4 minutes after release by team dcua
Attempt this challenge by downloading it from here
The other questions in this series: PI2 and PI3
PI 1: Solution
Unzipping the data reveals a file with no extension. We can check its type with the file
command:
BTSnoop is a bluetooth packet capture and is handled well by Wireshark. Lets open it there to have a look.
The first part of the packet capture is littered with bluetooth handshake noise that we can ignore for now, what we want to find out is what kind of device we are eavesdropping on. One of the first packets to transmit data from the device after session is established is in the above picture. Observe 3 important fields in wireshark:
- [Source Device Name: G613]
- Handle: 0x002c (Human Interface Device: Report)
- Value: 001c0000000000
- [Expert Info (Note/Undecided): Undecoded]
Starting from the bottom, whatever this Value
field is, it occurrs in every packet sent from our remote bluetooth device to the PC we are eavesdropping from. The Expert Info: Undecoded
is Wireshark telling us that this Value
field was decoded automatically, as wireshark has detected the bluetooth key exchange caught earlier in the capture file. We know it is a Human Interface Device
and after googling the device name, G613
, we find out that it is in fact, a bluetooth keyboard that we are eavesdropping on.
Considering we are looking at bluetooth packets coming from a keyboard, and (excluding the Bluetooth pairing packets) our keyboard is sending data (the Value
field) over and over again to our host computer, AND that Value
field is changing every time, it is not a short logical jump to make to assume that each Value
field represents some kind of keyboard event. For example a keypress.
There are many ways to proceed here, but I opt for exporting the packet capture as JSON (File -> export packet dissections -> as JSON
) and processing it further in an IPython
terminal.
First we need a function to strip out the btatt Value
field:
Then we can run it on the json output from wireshark of our packet capture:
Using some documentation online, we can begin to understand how this data is formatted. The second byte is the key value and the first byte indicates whether SHIFT is held down.
We can filter out Value
data that doesn’t pertain to an actual keypress as this won’t contribute to the readability of our evesdropped message. With that in mind, we can simply decode character by caracter as follows:
Awesome. We have intercepted one half of a conversation it seems. Our suspect has leaked several bits of personally indentifiable information. We have a phone number and we know its Swedish and we know the flag format uses the international country code format. Thus the flag is rgbCTF{+46736727859}
Find the Private Investigator 2 writeup here.