{% hint style="success" %} Learn & practice AWS Hacking:[**HackTricks Training AWS Red Team Expert (ARTE)**](https://training.hacktricks.xyz/courses/arte)\ Learn & practice GCP Hacking: [**HackTricks Training GCP Red Team Expert (GRTE)**](https://training.hacktricks.xyz/courses/grte)
Support HackTricks * Check the [**subscription plans**](https://github.com/sponsors/carlospolop)! * **Join the** ๐Ÿ’ฌ [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** us on **Twitter** ๐Ÿฆ [**@hacktricks\_live**](https://twitter.com/hacktricks\_live)**.** * **Share hacking tricks by submitting PRs to the** [**HackTricks**](https://github.com/carlospolop/hacktricks) and [**HackTricks Cloud**](https://github.com/carlospolop/hacktricks-cloud) github repos.
{% endhint %} # ์†Œ๊ฐœ Bluetooth 4.0 ์‚ฌ์–‘ ์ดํ›„๋กœ ์‚ฌ์šฉ ๊ฐ€๋Šฅํ•œ BLE๋Š” 40๊ฐœ์˜ ์ฑ„๋„๋งŒ ์‚ฌ์šฉํ•˜๋ฉฐ, 2400์—์„œ 2483.5 MHz ๋ฒ”์œ„๋ฅผ ์ปค๋ฒ„ํ•ฉ๋‹ˆ๋‹ค. ๋ฐ˜๋ฉด, ์ „ํ†ต์ ์ธ Bluetooth๋Š” ๋™์ผํ•œ ๋ฒ”์œ„์—์„œ 79๊ฐœ์˜ ์ฑ„๋„์„ ์‚ฌ์šฉํ•ฉ๋‹ˆ๋‹ค. BLE ์žฅ์น˜๋Š” **๊ด‘๊ณ  ํŒจํ‚ท**(**๋น„์ฝ˜**)์„ ์ „์†กํ•˜์—ฌ ํ†ต์‹ ํ•˜๋ฉฐ, ์ด ํŒจํ‚ท์€ BLE ์žฅ์น˜์˜ ์กด์žฌ๋ฅผ ์ฃผ๋ณ€์˜ ๋‹ค๋ฅธ ์žฅ์น˜์— ๋ฐฉ์†กํ•ฉ๋‹ˆ๋‹ค. ์ด ๋น„์ฝ˜์€ ๋•Œ๋•Œ๋กœ **๋ฐ์ดํ„ฐ**๋ฅผ **์ „์†ก**ํ•˜๊ธฐ๋„ ํ•ฉ๋‹ˆ๋‹ค. ์ฒญ์ทจ ์žฅ์น˜, ์ฆ‰ ์ค‘์•™ ์žฅ์น˜๋Š” ๊ด‘๊ณ  ์žฅ์น˜์— ํŠน์ •ํ•˜๊ฒŒ ์ „์†ก๋œ **SCAN ์š”์ฒญ**์œผ๋กœ ๊ด‘๊ณ  ํŒจํ‚ท์— ์‘๋‹ตํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. ๊ทธ ์Šค์บ”์— ๋Œ€ํ•œ **์‘๋‹ต**์€ **๊ด‘๊ณ ** ํŒจํ‚ท๊ณผ ๋™์ผํ•œ ๊ตฌ์กฐ๋ฅผ ์‚ฌ์šฉํ•˜๋ฉฐ, ์ดˆ๊ธฐ ๊ด‘๊ณ  ์š”์ฒญ์— ๋งž์ง€ ์•Š์•˜๋˜ ์ถ”๊ฐ€ ์ •๋ณด(์˜ˆ: ์ „์ฒด ์žฅ์น˜ ์ด๋ฆ„)๋ฅผ ํฌํ•จํ•ฉ๋‹ˆ๋‹ค. ![](<../.gitbook/assets/image (201) (2) (1) (1).png>) ํ”„๋ฆฌ์•ฐ๋ธ” ๋ฐ”์ดํŠธ๋Š” ์ฃผํŒŒ์ˆ˜๋ฅผ ๋™๊ธฐํ™”ํ•˜๋ฉฐ, 4๋ฐ”์ดํŠธ ์ ‘๊ทผ ์ฃผ์†Œ๋Š” **์—ฐ๊ฒฐ ์‹๋ณ„์ž**๋กœ, ์—ฌ๋Ÿฌ ์žฅ์น˜๊ฐ€ ๋™์ผํ•œ ์ฑ„๋„์—์„œ ์—ฐ๊ฒฐ์„ ์‹œ๋„ํ•˜๋Š” ์‹œ๋‚˜๋ฆฌ์˜ค์—์„œ ์‚ฌ์šฉ๋ฉ๋‹ˆ๋‹ค. ๋‹ค์Œ์œผ๋กœ, ํ”„๋กœํ† ์ฝœ ๋ฐ์ดํ„ฐ ๋‹จ์œ„(**PDU**)๋Š” **๊ด‘๊ณ  ๋ฐ์ดํ„ฐ**๋ฅผ ํฌํ•จํ•ฉ๋‹ˆ๋‹ค. ์—ฌ๋Ÿฌ ์œ ํ˜•์˜ PDU๊ฐ€ ์žˆ์œผ๋ฉฐ, ๊ฐ€์žฅ ์ผ๋ฐ˜์ ์œผ๋กœ ์‚ฌ์šฉ๋˜๋Š” ๊ฒƒ์€ ADV\_NONCONN\_IND์™€ ADV\_IND์ž…๋‹ˆ๋‹ค. ์žฅ์น˜๋Š” **์—ฐ๊ฒฐ์„ ์ˆ˜๋ฝํ•˜์ง€ ์•Š๋Š”** ๊ฒฝ์šฐ **ADV\_NONCONN\_IND** PDU ์œ ํ˜•์„ ์‚ฌ์šฉํ•˜์—ฌ ๊ด‘๊ณ  ํŒจํ‚ท์—์„œ๋งŒ ๋ฐ์ดํ„ฐ๋ฅผ ์ „์†กํ•ฉ๋‹ˆ๋‹ค. ์žฅ์น˜๋Š” **์—ฐ๊ฒฐ์„ ํ—ˆ์šฉํ•˜๋Š”** ๊ฒฝ์šฐ **ADV\_IND**๋ฅผ ์‚ฌ์šฉํ•˜๋ฉฐ, **์—ฐ๊ฒฐ**์ด **์„ค๋ฆฝ**๋˜๋ฉด ๊ด‘๊ณ  ํŒจํ‚ท ์ „์†ก์„ ์ค‘๋‹จํ•ฉ๋‹ˆ๋‹ค. ## GATT **์ผ๋ฐ˜ ์†์„ฑ ํ”„๋กœํŒŒ์ผ**(GATT)์€ **์žฅ์น˜๊ฐ€ ๋ฐ์ดํ„ฐ๋ฅผ ํ˜•์‹ํ™”ํ•˜๊ณ  ์ „์†กํ•˜๋Š” ๋ฐฉ๋ฒ•**์„ ์ •์˜ํ•ฉ๋‹ˆ๋‹ค. BLE ์žฅ์น˜์˜ ๊ณต๊ฒฉ ํ‘œ๋ฉด์„ ๋ถ„์„ํ•  ๋•Œ, GATT(๋˜๋Š” GATTs)์— ์ฃผ์˜๋ฅผ ์ง‘์ค‘ํ•˜๋Š” ๊ฒฝ์šฐ๊ฐ€ ๋งŽ์Šต๋‹ˆ๋‹ค. ์ด๋Š” **์žฅ์น˜ ๊ธฐ๋Šฅ์ด ํŠธ๋ฆฌ๊ฑฐ๋˜๋Š” ๋ฐฉ๋ฒ•**๊ณผ ๋ฐ์ดํ„ฐ๊ฐ€ ์ €์žฅ, ๊ทธ๋ฃนํ™” ๋ฐ ์ˆ˜์ •๋˜๋Š” ๋ฐฉ๋ฒ•์ด๊ธฐ ๋•Œ๋ฌธ์ž…๋‹ˆ๋‹ค. GATT๋Š” ์žฅ์น˜์˜ ํŠน์„ฑ, ์„ค๋ช…์ž ๋ฐ ์„œ๋น„์Šค๋ฅผ 16๋น„ํŠธ ๋˜๋Š” 32๋น„ํŠธ ๊ฐ’์œผ๋กœ ํ‘œ ํ˜•์‹์œผ๋กœ ๋‚˜์—ดํ•ฉ๋‹ˆ๋‹ค. **ํŠน์„ฑ**์€ ์ค‘์•™ ์žฅ์น˜์™€ ์ฃผ๋ณ€ ์žฅ์น˜ ๊ฐ„์— **์ „์†ก๋˜๋Š”** **๋ฐ์ดํ„ฐ** ๊ฐ’์ž…๋‹ˆ๋‹ค. ์ด๋Ÿฌํ•œ ํŠน์„ฑ์€ **์ถ”๊ฐ€ ์ •๋ณด๋ฅผ ์ œ๊ณตํ•˜๋Š”** **์„ค๋ช…์ž**๋ฅผ ๊ฐ€์งˆ ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. **ํŠน์„ฑ**์€ ํŠน์ • ์ž‘์—…์„ ์ˆ˜ํ–‰ํ•˜๋Š” ๊ฒƒ๊ณผ ๊ด€๋ จ์ด ์žˆ๋Š” ๊ฒฝ์šฐ **์„œ๋น„์Šค**๋กœ **๊ทธ๋ฃนํ™”**๋˜๋Š” ๊ฒฝ์šฐ๊ฐ€ ๋งŽ์Šต๋‹ˆ๋‹ค. # ์—ด๊ฑฐ ```bash hciconfig #Check config, check if UP or DOWN # If DOWN try: sudo modprobe -c bluetooth sudo hciconfig hci0 down && sudo hciconfig hci0 up # Spoof MAC spooftooph -i hci0 -a 11:22:33:44:55:66 ``` ## GATTool **GATTool**๋Š” ๋‹ค๋ฅธ ์žฅ์น˜์™€ **์—ฐ๊ฒฐ**์„ **์„ค์ •**ํ•˜๊ณ , ํ•ด๋‹น ์žฅ์น˜์˜ **ํŠน์„ฑ**์„ ๋‚˜์—ดํ•˜๋ฉฐ, ์†์„ฑ์„ ์ฝ๊ณ  ์“ธ ์ˆ˜ ์žˆ๊ฒŒ ํ•ด์ค๋‹ˆ๋‹ค.\ GATTTool์€ `-I` ์˜ต์…˜์œผ๋กœ ๋Œ€ํ™”ํ˜• ์…ธ์„ ์‹œ์ž‘ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค: ```bash gatttool -i hci0 -I [ ][LE]> connect 24:62:AB:B1:A8:3E Attempting to connect to A4:CF:12:6C:B3:76 Connection successful [A4:CF:12:6C:B3:76][LE]> characteristics handle: 0x0002, char properties: 0x20, char value handle: 0x0003, uuid: 00002a05-0000-1000-8000-00805f9b34fb handle: 0x0015, char properties: 0x02, char value handle: 0x0016, uuid: 00002a00-0000-1000-8000-00805f9b34fb [...] # Write data gatttool -i -b --char-write-req -n gatttool -b a4:cf:12:6c:b3:76 --char-write-req -a 0x002e -n $(echo -n "04dc54d9053b4307680a"|xxd -ps) # Read data gatttool -i -b --char-read -a 0x16 # Read connecting with an authenticated encrypted connection gatttool --sec-level=high -b a4:cf:12:6c:b3:76 --char-read -a 0x002c ``` ## ๋ฒ ํ„ฐ์บก ```bash # Start listening for beacons sudo bettercap --eval "ble.recon on" # Wait some time >> ble.show # Show discovered devices >> ble.enum # This will show the service, characteristics and properties supported # Write data in a characteristic >> ble.write >> ble.write ff06 68656c6c6f # Write "hello" in ff06 ``` {% hint style="success" %} AWS ํ•ดํ‚น ๋ฐฐ์šฐ๊ธฐ ๋ฐ ์—ฐ์Šตํ•˜๊ธฐ:[**HackTricks Training AWS Red Team Expert (ARTE)**](https://training.hacktricks.xyz/courses/arte)\ GCP ํ•ดํ‚น ๋ฐฐ์šฐ๊ธฐ ๋ฐ ์—ฐ์Šตํ•˜๊ธฐ: [**HackTricks Training GCP Red Team Expert (GRTE)**](https://training.hacktricks.xyz/courses/grte)
HackTricks ์ง€์›ํ•˜๊ธฐ * [**๊ตฌ๋… ๊ณ„ํš**](https://github.com/sponsors/carlospolop) ํ™•์ธํ•˜๊ธฐ! * **๐Ÿ’ฌ [**๋””์Šค์ฝ”๋“œ ๊ทธ๋ฃน**](https://discord.gg/hRep4RUj7f) ๋˜๋Š” [**ํ…”๋ ˆ๊ทธ๋žจ ๊ทธ๋ฃน**](https://t.me/peass)์— ์ฐธ์—ฌํ•˜๊ฑฐ๋‚˜ **ํŠธ์œ„ํ„ฐ** ๐Ÿฆ [**@hacktricks\_live**](https://twitter.com/hacktricks\_live)**๋ฅผ ํŒ”๋กœ์šฐํ•˜์„ธ์š”.** * **[**HackTricks**](https://github.com/carlospolop/hacktricks) ๋ฐ [**HackTricks Cloud**](https://github.com/carlospolop/hacktricks-cloud) ๊นƒํ—ˆ๋ธŒ ๋ฆฌํฌ์ง€ํ† ๋ฆฌ์— PR์„ ์ œ์ถœํ•˜์—ฌ ํ•ดํ‚น ํŠธ๋ฆญ์„ ๊ณต์œ ํ•˜์„ธ์š”.**
{% endhint %}