[Global Vehicle Cybersecurity Competition 2025] #3 Password Change Policy [RAMN] Write-Up

2025. 9. 14. 15:45·CTF
반응형

문제 정보

This challenge dives into Universal Diagnostic Services (UDS) and firmware reverse engineering. You'll need to reconstruct a complete firmware image from a raw CAN log file.

The main goal is to identify and understand a new Security Access algorithm embedded within the firmware. This algorithm is common to other automotive security access algorithms, requiring meticulous binary analysis to extract. Success hinges on your UDS knowledge and reverse engineering skills.

Prompt: I updated my RAMN with a new firmware for ECU C, but it seems like the Security Access algorithm has been updated and I can’t unlock it anymore.

ECU C just gave me the seed: 9A5ABF0C1AAFDEB72761E909501D6E9

What is the answer to that seed? (Note: flag is 32-character hexadecimal string, all caps.)


one file is provided:
[challenge3...]

문제 풀이 요약

  1. 제공된 can log에는 UDS 프레임을 확인할 수 있음
  2. UDS프레임의 흐름은 security access level 1을 승인 받은 뒤에 업로드 기능으로 펌웨어를 업로드하는 과정
  3. 해당 부분에서 byte를 추출하여 펌웨어를 획득
  4. 디컴파일 도구를 이용해 펌웨어 내 0x27, 0x67 부분을 시퀀스로 찾아 함수 탐색
  5. 시드 생성 함수랑 검증 함수를 찾아 연산을 확인해보니 고정된 상수와 XOR연산을 수행함
  6. 문제의 시드 9A5ABF0C1CAAFDEB72761E909501D6E9와 연산하면 Flag 출력
  7. FLAG : 8869AE3F0E99ECD860450FA38732C7DA

문제 풀이 상세

1. 주어진 CAN log를 SavvyCan의 ISO-TP Decoder를 이용해 확인하면 UDS를 이용하여 firmware를 업로드 하는 부분이 식별된다.

 

2. firmware로 보이는 byte를 추출하여 펌웨어를 복원하고 정적 분석을 통해 UDS 로직을 확인할 수 있다.

 

3. 0x27, 0x67 등을 스칼라 검색하여 시드 생성, 검증 로직을 확인하면 Seed는 고정된 값으로 XOR 연산을 수행하는 것으로 보인다.

•  sub_8004BF4 : 시드 생성 함수

 

• sub_8004CD4 : 키 검증 함수

 

4. 고정된 값은 메모리 0x801b358의 값을 사용합니다.

0x12, 0x33, 0x11, 0x33, 0x12, 0x33, 0x11, 0x33, 0x12, 0x33, 0x11, 0x33, 0x12, 0x33, 0x11, s 0x33

 

5. 문제에서 원하는 시드와 연산하면 FLAG 값을 찾을 수 있습니다.

# seed
# 9A 5A BF 0C
# 1C AA FD EB 
# 72 76 1E 90 
# 95 01 D6 E9
rand_block = [
    0x9A, 0x5A, 0xBF, 0x0C,
    0x1C, 0xAA, 0xFD, 0xEB,
    0x72, 0x76, 0x1E, 0x90,
    0x95, 0x01, 0xD6, 0xE9
]

# byte_801B358 테이블 (앞 16바이트)
byte_801B358 = [
    0x12, 0x33, 0x11, 0x33,
    0x12, 0x33, 0x11, 0x33,
    0x12, 0x33, 0x11, 0x33,
    0x12, 0x33, 0x11, 0x33
]

# 전역 버퍼 시뮬레이션
byte_20032B0C = [0] * 44

# [12..27] 에 랜덤값 채워넣기
for i in range(16):
    byte_20032B0C[12 + i] = rand_block[i]

# XOR 연산 [28..43] = [rand] ^ [테이블]
for j in range(16):
    byte_20032B0C[28 + j] = byte_20032B0C[12 + j] ^ byte_801B358[j]

# v2[10..25] = 랜덤 블록 복사
v2 = [0] * 26
for k in range(16):
    v2[10 + k] = byte_20032B0C[12 + k]

print("byte_20032B0C[12..27] =", [hex(x) for x in byte_20032B0C[12:28]])
print("byte_20032B0C[28..43] =", [hex(x) for x in byte_20032B0C[28:44]])
print("v2[10..25]            =", [hex(x) for x in v2[10:26]])


for i in [hex(x)[2:] for x in byte_20032B0C[28:44]]:
    print(i.upper(),end=' ')

 

• FLAG : 8869AE3F0E99ECD860450FA38732C7DA


 

반응형

'CTF' 카테고리의 다른 글

[Global Vehicle Cybersecurity Competition 2025] #4 AutoGraph [RAMN] Write-Up  (0) 2025.09.14
[Global Vehicle Cybersecurity Competition 2025] #1 Wired Keyless Entry [PowerPC] Write-Up  (0) 2025.09.14
[Global Vehicle Cybersecurity Competition 2025] #3 Firmware Reveal Write-Up  (0) 2025.09.14
[Global Vehicle Cybersecurity Competition 2025] #2 SAE EAS Write-Up  (0) 2025.09.14
[Global Vehicle Cybersecurity Competition 2025] #1 Red Alert Write-Up  (0) 2025.09.14
'CTF' 카테고리의 다른 글
  • [Global Vehicle Cybersecurity Competition 2025] #4 AutoGraph [RAMN] Write-Up
  • [Global Vehicle Cybersecurity Competition 2025] #1 Wired Keyless Entry [PowerPC] Write-Up
  • [Global Vehicle Cybersecurity Competition 2025] #3 Firmware Reveal Write-Up
  • [Global Vehicle Cybersecurity Competition 2025] #2 SAE EAS Write-Up
tae3
tae3
  • tae3
    tae3log
    tae3
  • 링크

    • LinkedIn
  • 전체
    오늘
    어제
    • 전체보기 (50)
      • 보안 이론 (37)
        • 웹 보안 (13)
        • 네트워크 보안 (6)
        • 시스템 보안 (3)
        • 클라우드 보안 (15)
        • 차량 보안 (0)
      • CTF (12)
      • 리눅스 (1)
  • 태그

    /dpkg/lock
    AES
    ALB
    amazon linux
    argus
    Auto scaling
    Automotive Security
    awk
    AWS
    bWAPP
  • hELLO· Designed By정상우.v4.10.4
tae3
[Global Vehicle Cybersecurity Competition 2025] #3 Password Change Policy [RAMN] Write-Up
상단으로

티스토리툴바