A Guide to Bluetooth Man-In-The-Middle (MITM)¶
What is a Bluetooth Man-In-The-Middle Attack?¶

A Man-in-the-Middle attack happens when a malicious actor intercepts communications between two parties without their knowledge. In the case of Bluetooth, a MITM attack involves an attacker positioning themselves near two Bluetooth devices.
A good example is a Bluetooth keyboard. A keyboard can send important information like passwords or code that an attacker can user for further attacks.
A Bluetooth attacker performing a MITM attack in the example above creates two connections:
- A connection between the attacker and the keyboard – Central
- A connection between the attacker and the computer – Peripheral
An attacker forces the devices to connect indirectly through it, and each device ends up encrypting data using an encryption key that the attacker knows.
Performing a successful MITM attack on Bluetooth requires actively sending packets.
Risks Associated with Bluetooth MITM Attacks¶
- Data Interception: Perhaps the most obvious risk is the interception of sensitive data. Bluetooth connections often transmit personal information, such as contact lists, messages, or financial data. Intercepting this data can lead to identity theft, financial loss, or unauthorized access to personal accounts.
- Device Compromise: MITM attacks can also lead to the compromise of connected devices. By intercepting communication between a smartphone and a smart lock, for example, an attacker could gain unauthorized access to the lock, compromising the security of the premises.
- Malware Injection: In addition to intercepting data, attackers can inject malware into the communication stream. This malware could then infect the connected devices, leading to further exploitation or data exfiltration.
Vulnerabilities in Legacy Pairing¶
蓝牙传统配对不仅容易受到MITM等主动攻击,也容易受到攻击者只是从空中捕获数据包的被动攻击。
为了避免传统配对,您必须使用蓝牙安全连接和安全简单配对功能。这些将阻止被动数据包捕获工作。让我们来了解一下原因。
Why Bluetooth needs specific MITM protection?¶
假设您使用的是LE安全连接或BR/EDR安全连接,蓝牙将利用椭圆曲线Diffie-Hellman(ECDH)加密来执行密钥交换。
ECDH允许具有私钥/公钥组合的两个设备在不安全的通道上建立共享密钥。就蓝牙而言,它是一系列密钥,最终是长期密钥(LTK)。
尽管非对称密钥加密(如ECC和RSA)可用于加密和解密,但它们通常效率低下。因此,非对称加密的主要用途是交换对称加密将使用的密钥,在这种情况下是AES。
因此,我们有两个设备,每个设备都有私钥和公钥,可以通过ECDH进行通信和交换信息并建立密钥。但有一个问题。你怎么知道你收到的公钥属于你想交谈的一方?毕竟,攻击者可以很容易地向您提供任何公钥。
这是启用MITM攻击的核心问题,也是蓝牙上MITM保护更复杂的原因。
此问题并非蓝牙独有。在Web上,同样的问题可以通过公钥基础设施和证书来解决。现代浏览器和操作系统附带了一组属于受信任实体的证书,如Microsoft Root Authority、Thawte Timestaming CA等。
这些证书提供了一个信任链,因此当您的浏览器收到网站的证书时,您知道该证书是有效的,因为它是由受信任方签名的。您隐含地相信,该机构已经竭尽全力确保证书由正确的实体正确拥有。
在蓝牙的情况下,没有证书、信任根或公钥基础设施。这是因为支持X.509证书很复杂,而且由于蓝牙在小型嵌入式设备上运行,可能没有足够的内存来支持这一点。
更糟糕的是,蓝牙设备的接口往往受到限制。大多数设备只有一个按钮。其他人有键盘或显示器,也许两者都有。一个完美的例子是没有显示器或键盘的蓝牙耳机。
由于这些限制,蓝牙SIG创建了几种方法来帮助保护设备免受MITM的攻击(如果可能的话)。这些方法需要某种形式的输入/输出(IO)。对于没有任何保护的设备,如果不创建自定义安全方案,就无法使用蓝牙进行任何MITM保护。让我们来复习一下这些方法。
MITM的蓝牙安全简单配对(SSP)和LE安全连接关联模型¶

记住,我们的目标是能够确保我们与正确的设备交谈。
LE安全连接和安全简单配对(用于BR/EDR)使用基本相同的关联模型。这些是建立配对关联的模式,使系统能够安全地抵御MITM攻击。
Just Works– When one of the devices has no I/O capabilities, then this is the only possibility. Just works uses Numeric Comparison, but uses 0 as the. With Just Works there is no MITM protectionPasskey Entry– Used when one device has an input ability to enter digits but doesn’t have a display. For example, a keyboard can enter a passkey but can’t display the results. This model provides MITM protectionNumeric Comparison– When the two devices connecting both have a display capable of showing the six digit number and a button able to confirm or reject the number. This Model provides MITM protectionOut of Band– This mechanism allows sending the keys via an out of band methodology that’s implementation specific. The security of this approach depends on the mechanism. This is a relatively rare approach from our experience because it requires custom implementation and a communications method.
关联模型的目的是帮助用户确认他们正在与正确的设备交谈。这甚至不仅仅是为了安全&在一个有多个相同产品的地方,确保连接到正确的设备至关重要。
上表显示了IO功能和可能使用的模型的组合。值得注意的是,MITM保护取决于两种设备的能力。如果任一设备没有I/O或没有按钮,那么不提供任何保护的Just Works是唯一的选择。
How practical are Bluetooth Man-In-The-Middle Attack?¶
尽管蓝牙规范认为主动MITM攻击很困难,但现实情况是,在实践中进行这些攻击并不困难。事实上,我们一直在执行这些操作,设备也不需要很复杂
您需要能够同时充当BLE中央和外围设备的硬件。这可以是Linux设备,也可以是嵌入式板
如果被攻击的设备已连接,可以使它们断开连接,或者攻击者可以等待连接停止
只是提醒你,蓝牙MITM缓解将MITM攻击者成功的可能性降低到约1/10^16,这是非常低的。参考链接:蓝牙 - 什么是Man-in-the-middle protection_蓝牙中间人攻击-CSDN博客
蓝牙设备的一个巨大问题是,其中许多设备没有IO,因此无法抵御MITM攻击。这使得攻击许多设备成为可能,因为它们很少实施任何额外的安全措施来弥补这些限制。
Additional Factors in MITM attacks¶
我们在攻击蓝牙设备时的上述假设是,我们可以强制设备连接到我们,而不是相互连接。当设备从未连接过时,这相对容易,因为当这种情况发生时,我们可以攻击它们。
当两个设备已经连接时,我们的成功部分取决于迫使设备忽略或删除它们以前使用的密钥,或者允许新的连接。这并不总是可能的。蓝牙设备是否允许这种情况发生取决于系统设计。
可利用的特征之一是修复机制。假设用户更换了键盘,则必须允许用户将新键盘连接到PC。但是,此机制可能不容易利用,因为它可能需要用户手动执行此步骤。例如,删除蓝牙设备或按下键盘上的按钮。
Mitigating MITM Attacks¶
While Bluetooth MITM attacks pose a significant threat, there are several measures that users and manufacturers can take to mitigate the risk:
- Use Secure Pairing: Utilize Bluetooth pairing methods that offer stronger security, such as Secure Simple Pairing (SSP), Numeric Comparison and LE Secure Connections (LESC) and avoid Legacy Pairing which offers no security
- Leverage Display, Keyboard, and IO –
- Stay Vigilant: Be cautious when connecting to unfamiliar Bluetooth devices. Verify the identity of devices before pairing and avoid sharing sensitive information over Bluetooth in untrusted environments. When critical, perform the pairing in a secure location.