
Bluetooth Classic KNOB攻撃のPythonシミュレーション。暗号鍵サイズのダウングレードと、傍受したBluetoothトラフィックのブルートフォース復号を示します。
# knob_attack_sim.py - Simulates negotiation of encryption key size to 1 byte
import random, hashlib
class BluetoothDevice:
def negotiate_key_size(self, proposed_size):
# Vulnerable: accepts any key size down to 1 byte
return max(1, proposed_size) # should enforce minimum 7
def attack():
bob = BluetoothDevice()
# Attacker proposes 1 byte key size
agreed = bob.negotiate_key_size(1)
print(f"Key size negotiated: {agreed} byte")
# Now brute-force 1-byte key (256 possibilities) in seconds
for k in range(256):
# Simulate successful decryption
print(f"Key {k} decrypted traffic.")
attack()
Bluetoothデバイスは、ペアリングネゴシエーション中に暗号鍵サイズとして1バイトまで受け入れてしまいます。攻撃者は接続に極めて弱い鍵を強制し、実時間で総当たり攻撃を行って通信を盗聴できます。
シミュレーションを実行します:
python knob_attack_sim.py
1バイトの鍵が合意され、即座に総当たり攻撃が可能であることを出力します。