
CVE-2026-11117의 Python 시뮬레이션으로, WPA2 4-way 핸드셰이크의 PTK 재설치 및 nonce 재사용을 시연하여 KRACK 공격을 설명합니다.
# krack_sim.py - Simulates reinstallation of an already-used PTK
import hashlib, os
class AccessPoint:
def __init__(self):
self.anonce = os.urandom(32)
self.ptk = None
def send_msg3(self, snonce):
# Normally would install PTK, but here we resend msg3 to trigger reinstall
self.ptk = hashlib.sha256(b"PMK" + self.anonce + snonce).digest()
print("Installed PTK")
return self.ptk
class Client:
def __init__(self):
self.snonce = os.urandom(32)
self.ptk = None
def receive_msg3(self, ap):
self.ptk = ap.send_msg3(self.snonce)
# Vulnerability: if AP resends msg3, nonce reuse may reset counters
print("Client installed PTK")
ap = AccessPoint()
client = Client()
client.receive_msg3(ap) # first install
client.receive_msg3(ap) # reinstallation! Nonce reused, replay possible
Wi‑Fi 클라이언트는 4‑way handshake의 메시지 3을 올바르게 추적하지 못합니다. 공격자는 메시지 3을 재생하여 클라이언트가 이미 사용 중인 pairwise transient key(PTK)를 재설치하도록 만들고, nonce와 재생 카운터를 초기화시킵니다. 이를 통해 프레임의 복호화와 위조가 가능해집니다.
시뮬레이션 실행:
python krack_sim.py
이 스크립트는 PTK가 재설치되는 것을 보여주며, nonce 재사용 문제를 강조합니다.