hcitool 对于 BLE 设备只能进行连接上的管理,如果需要更精细化的管理,就需要使用 gatttool
交互模式下的命令
我们这里可以查看一下设备上所有的特征(Characteristic)
handle 是特征的句柄,char properties 是特征的属性,char value handle 是特征值的句柄,uuid 是特征的通用唯一标识符
Flag one is a gift! You can only obtain it by reading this document or peaking at the source code. In short, this flag is to get you familiar with doing a simple write to a BLE handle. Do the following to get your first flag. Make sure you replace the MAC address in the examples below with your devices mac address!
这关主要是让我们熟悉对 BLE 句柄的特征进行简单的写入
首先,查看分数,初始分数为0/20
然后,提交向 0x2c 句柄提交flag
最后,检查我们的分数来查看flag是否被接受,发现分数变成了1/20
Check out the ascii value of handle 0x002e and submit it to the flag submision handle 0x002c. If you are using gatttool, make sure you convert it to hex with xxd. If you are using bleah, you can send it as a string value.
读取0x002e句柄的特征,只需要 --char-read 加 -a 指定 0x002e
转为ASCII值为 d205303e099ceff44835
Check out the ascii value of handle 0x0030. Do what it tells you and submit the flag you find to 0x002c.
跟上一题差不多
转为ASCII值为 MD5 of Device Name
之前用hcitool扫描出的结果就是设备名加MAC地址
将设备名BLECTF 进行 MD5 加密后得到值取前20位就是flag
Bluetooth GATT services provide some extra device attributes. Try finding the value of the Generic Access -> Device Name.
Read handle 0032 and do what it says. Notice that its not telling you to write to the flag handle as you have been. When you find the flag, go ahead and write it to the flag handle you have used in the past flags.
先读取看看0x0032句柄的特征的值
转ASCII值为 Write anything here
我们只需要往这个句柄里随便写点东西,这个特征的值就会变成flag
转为ASCII值为 3873c0270763568cf7aa
Follow the instructions found from reading handle 0x0034. Keep in mind that some tools only write hex values while other provide methods for writing either hex or ascii
转为ASCII值为 Write the ascii value "yo" here
转为ASCII值为 c55c6314b3db0a6128af
Follow the instructions found from reading handle 0x0036. Keep in mind that some tools only write hex values while other provide methods for writing either hex or ascii
转为ASCII值为 Write the hex value 0x07 here
我们之前写入的数据的格式都是字符串,现在需要的是整数类型,所以只需要 -n 直接接上对应的值就行了
转为ASCII值为 1179080b29f8da16ad66
Follow the instructions found from reading handle 0x0038. Pay attention to handles here. Keep in mind handles can be refrenced by integer or hex. Most tools such as gatttool and bleah allow you to specify handles both ways.
转为ASCII值为 Write 0xC9 to handle 58
跟上一题差不多
转为ASCII值为 f8b136d937fad6a2be9f
Take a look at handle 0x003c and do what it says. You should script up a solution for this one. Also keep in mind that some tools write faster than others.
转为ASCII值为 Brute force my value 00 to ff
就是让我们写个脚本来往这个0x003c句柄的特征里写数据
转为ASCII值为 933c1fcfa8ed52d2ec05
Talke a look at handle 0x003e and do what it says. Keep in mind that some tools have better connection speeds than other for doing reads and writes. This has to do with the functionality the tool provides or how it uses cached BT connections on the host OS. Try testing different tools for this flag. Once you find the fastest one, whip up a script or bash 1 liner to complete the task. FYI, once running, this task takes roughly 90 seconds to complete if done right.
转为ASCII值为 Read me 1000 times
比上一个简单,时间间隔调小一点
转为ASCII值为 6ffcd214ffebdc0d069e
Check out handle 0x0040 and google search gatt notify. Some tools like gatttool have the ability to subscribe to gatt notifications
转为ASCII值为 Listen to me for a single notification ,这个是让我们监听该句柄的一次通知
Check out handle 0x0042 and google search gatt indicate. For single response indicate messages, like this challenge, tools such as gatttool will work just fine.
转为ASCII值为 Listen to handle 0x0044 for a single indication ,让我们监听该句柄的一次指示。
Check out handle 0x0046 and do what it says. Keep in mind that this notification clallange requires you to recieve multiple responses in order to complete.
转为ASCII值为 Listen to me for multi notifications ,就是接收多个通知,没啥区别,因为我们的监听功能是持续的,能一直接收
转为ASCII值为 c9457de5fd8cafe349fd 与 U no want this msg
Check out handle 0x0042 and google search gatt indicate. Keep in mind that this chalange will require you to parse multiple indicate responses in order to complete the chalange.
这里题目写错了,把0x0048写成了0x0042
转为ASCII值为 Listen to handle 0x004a for multi indications ,上题同理
转为ASCII值为 b6f3a47f207d38e16ffa
Check out handle 0x004c and do what it says. Much like ethernet or wifi devices, you can also change your bluetooth devices mac address.
转为ASCII值为 Connect with BT MAC address 11:22:33:44:55:66
这个的意思其实就是让我们将我们蓝牙适配器的MAC地址改成 11:22:33:44:55:66
这里需要一个 bdaddr 工具,根据这个项目的 README,是支持我这个 CSR4.0 的蓝牙适配器的。但是如果你去看看这个项目 issue,可以发现修改 CSR 的设备的 MAC 地址时会有问题,就是显示修改成功,但是实际 MAC 地址还是原来的那个,我自己在修改时也发现这个问题。不过后来,把蓝牙适配器拔了再插上去后去查看,发现 MAC 地址成功改变了!
转为ASCII值为 aca16920583e42bdcf5f
Read handle 0x0048 and do what it says. Setting MTU can be a tricky thing. Some tools may provide mtu flags, but they dont seem to really trigger MTU negotiations on servers. Try using gatttool's interactive mode for this task. By default, the BLECTF server is set to force an MTU size of 20. The server will listen for MTU negotiations, and look at them, but we dont really change the MTU in the code. We just trigger the flag code if you trigger an MTU event with the value specified in handle 0x0048. GLHF!
这里题目写错了,把0x004e写成了0x0048
转为ASCII值为 Set your connection MTU to 444
直接使用 -m 来设置有些问题,不过可以进入交互模式来设置
转为ASCII值为 b1e409e5a4eaf9fe5158
Check out handle 0x0050 and do what it says. This chalange differs from other write chalanges as your tool that does the write needs to have write response ack messages implemente correctly. This flag is also tricky as the flag will come back as notification response data even though there is no "NOTIFY" property.
Take a look at handle 0x0052. Notice it does not have a notify property. Do a write here and listen for notifications anyways! Things are not always what they seem!