[Dreamhack] 리버싱 rev-basic-5 Writeup

2025. 2. 26. 19:56·Writeup

 

 

이전 rev-basic 시리즈와 유사한 구조의 문제다

correct를 출력하는 플래그를 찾으면 됨

틀린 값을 입력하면 wrong을 출력함

 

IDA에 로드해서 실행파일을 분석해 보겠음

 

 

input: 여기서 사용자에게 입력값을 받고

if 문에 있는 sub_140001000에서 비교해서 일치하면 correct 출력

 

__int64 __fastcall sub_140001000(__int64 a1)
{
  int i; // [rsp+0h] [rbp-18h]

  for ( i = 0; (unsigned __int64)i < 0x18; ++i )
  {
    if ( *(unsigned __int8 *)(a1 + i + 1) + *(unsigned __int8 *)(a1 + i) != byte_140003000[i] )
      return 0LL;
  }
  return 1LL;
}

 

if ( *(unsigned __int8 *)(a1 + i + 1) + *(unsigned __int8 *)(a1 + i) != byte_140003000[i] )

위의 수식을 간소화하면 이렇게 되겠다

a1[i+1]+al[i] = byte_140003000[i]

 

그리고 byte_140003000[i] 내용은 hex view에 들어가 보면 값을 찾을 수 있다

 

 

0x18 즉 24번 반복되니까 4C에서 끝나는 게 아니라 00도 배열에 들어가는 것 같다

편의를 위해 배열 이름을 arr[i] 이렇게 바꾸자면

 

arr[i] = [ADh, D8h, CBh, CBh, 9Dh, 97h, CBh, C4h, 92h, A1h, D2h, D7h, D2h, D6h, A8h, A5h, DCh, C7h, ADh, A3h, A1h, 98h, 4Ch, 00h]
a1[i+1]+al[i] = arr[i]

 

 

이렇게 정리할 수 있다. 근데 arr 배열의 마지막 요소가 0이니까 

al[23] = al[24] = 0이라는 추론이 가능함

그리고 16진수인 4C는 76이니까 al[23]+al[22], al[22] = 4C

4C+al[21] = 98h, al[21] = 4C

이런 식으로 뒤에서 역순으로 구하면 되겠으나

하나하나 노가다로 하기보다는 코드를 짜서 해보자..

 

al[i] = arr[i]-al[i+1]

 

찾았다!

'Writeup' 카테고리의 다른 글

[웹해킹] Lab: Basic SSRF against another back-end system Writeup  (0) 2025.03.02
[Dreamhack] 리버싱 rev-basic-6 Writeup  (0) 2025.02.28
[Hackthebox] Behind the Scenes 리버싱 챌린지 Writeup  (0) 2025.02.26
[웹해킹] Username enumeration via different responses - lab writeup  (0) 2025.02.23
[Dreamhack] 리버싱 rev-basic-4 Writeup  (0) 2025.02.22
'Writeup' 카테고리의 다른 글
  • [웹해킹] Lab: Basic SSRF against another back-end system Writeup
  • [Dreamhack] 리버싱 rev-basic-6 Writeup
  • [Hackthebox] Behind the Scenes 리버싱 챌린지 Writeup
  • [웹해킹] Username enumeration via different responses - lab writeup
이둥둥
이둥둥
"><script>prompt(document.cookie)</script>
  • 이둥둥
    시골쥐 해커
    이둥둥
  • 전체
    오늘
    어제
    • 분류 전체보기
      • 방통대
      • 리버싱
      • 웹해킹
      • 악성코드 분석
      • Defensive
      • 네트워크
      • 포렌식
      • Writeup
      • 사이버보안
      • 정보처리기사
      • Troubleshooting
      • 취준
  • 블로그 메뉴

    • 홈
    • 사이버보안
    • 방통대
    • 독후감
  • 링크

  • 공지사항

  • 인기 글

  • 태그

    정보보안
    hackthebox
    CTF
    burpsuite
    악성코드분석
    사이버보안
    독후감
    리버싱
    tryhackme
    웹해킹
  • 최근 댓글

  • 최근 글

  • hELLO· Designed By정상우.v4.10.3
이둥둥
[Dreamhack] 리버싱 rev-basic-5 Writeup
상단으로

티스토리툴바