rev-basic-1

2023. 1. 6. 12:14·Wargame/Dreamhack
728x90
반응형

1. intro

2. code 및 분석

2.1.  code

int __cdecl main(int argc, const char **argv, const char **envp)
{
  char v4[256]; // [rsp+20h] [rbp-118h] BYREF

  memset(v4, 0, sizeof(v4));
  printf("Input : ", argv, envp);
  scanf("%256s", v4);
  if ( compare(v4) )
    puts("Correct");
  else
    puts("Wrong");
  return 0;
}

 

_BOOL8 __fastcall sub_140001000(_BYTE *a1)
{
  if ( *a1 != 'C' )
    return 0i64;
  if ( a1[1] != 'o' )
    return 0i64;
  if ( a1[2] != 'm' )
    return 0i64;
  if ( a1[3] != 'p' )
    return 0i64;
  if ( a1[4] != 'a' )
    return 0i64;
  if ( a1[5] != 'r' )
    return 0i64;
  if ( a1[6] != '3' )
    return 0i64;
  if ( a1[7] != '_' )
    return 0i64;
  if ( a1[8] != 't' )
    return 0i64;
  if ( a1[9] != 'h' )
    return 0i64;
  if ( a1[10] != 'e' )
    return 0i64;
  if ( a1[11] != '_' )
    return 0i64;
  if ( a1[12] != 'c' )
    return 0i64;
  if ( a1[13] != 'h' )
    return 0i64;
  if ( a1[14] != '4' )
    return 0i64;
  if ( a1[15] != 'r' )
    return 0i64;
  if ( a1[16] != 'a' )
    return 0i64;
  if ( a1[17] != 'c' )
    return 0i64;
  if ( a1[18] != 't' )
    return 0i64;
  if ( a1[19] != '3' )
    return 0i64;
  if ( a1[20] == 'r' )
    return a1[21] == 0;
  return 0i64;
}

 

2.2. 분석

완벽하게 강의와 똑같은 문제라 굳이 써야하나 싶긴 하지만... 일단 쓴다;;

code와 같이 적절히 함수 이름을 변경해두었다.

결국은 compare 함수와 비교하기 때문에 이 부분만 보면 된다.

 

3. exploit

비교하는 각 문자를 모으면 끝.

_BOOL8 __fastcall sub_140001000(_BYTE *a1)
{
  if ( *a1 != 'C' )
    return 0i64;
  if ( a1[1] != 'o' )
    return 0i64;
  if ( a1[2] != 'm' )
    return 0i64;
  if ( a1[3] != 'p' )
    return 0i64;
  if ( a1[4] != 'a' )
    return 0i64;
  if ( a1[5] != 'r' )
    return 0i64;
  if ( a1[6] != '3' )
    return 0i64;
  if ( a1[7] != '_' )
    return 0i64;
  if ( a1[8] != 't' )
    return 0i64;
  if ( a1[9] != 'h' )
    return 0i64;
  if ( a1[10] != 'e' )
    return 0i64;
  if ( a1[11] != '_' )
    return 0i64;
  if ( a1[12] != 'c' )
    return 0i64;
  if ( a1[13] != 'h' )
    return 0i64;
  if ( a1[14] != '4' )
    return 0i64;
  if ( a1[15] != 'r' )
    return 0i64;
  if ( a1[16] != 'a' )
    return 0i64;
  if ( a1[17] != 'c' )
    return 0i64;
  if ( a1[18] != 't' )
    return 0i64;
  if ( a1[19] != '3' )
    return 0i64;
  if ( a1[20] == 'r' )
    return a1[21] == 0;
  return 0i64;
}
728x90
반응형
저작자표시 비영리 변경금지 (새창열림)

'Wargame > Dreamhack' 카테고리의 다른 글

Holymoly  (0) 2023.01.12
rev-basic-0  (0) 2023.01.06
ZeroShot  (0) 2023.01.04
Broken Tetris  (0) 2022.12.26
MSNW  (0) 2022.12.26
'Wargame/Dreamhack' 카테고리의 다른 글
  • Holymoly
  • rev-basic-0
  • ZeroShot
  • Broken Tetris
wyv3rn
wyv3rn
아저씨의 흔한 취미. wyv3rn#1249
  • wyv3rn
    think storage
    wyv3rn
  • 전체
    오늘
    어제
    • 분류 전체보기 (520)
      • To do list (7)
        • Doing (1)
        • Complete (6)
      • Diary (35)
      • Tips & theory (75)
      • Kernel Exploit (28)
        • Theory (16)
        • Exercise (5)
      • File Structure (6)
      • Wargame (322)
        • pwn.college (34)
        • Dreamhack (156)
        • pwnable.kr (15)
        • Lord of Sqlinjection (4)
        • Cryptohack (20)
        • Root me (27)
        • CodeEngn (4)
        • Exploit Education (22)
        • ROP Emporium (8)
        • H4C (10)
        • Hackerchool (22)
      • CTF (46)
        • Solved (44)
        • Unsolved (2)
      • Script (0)
      • RubiyaLap (0)
  • 블로그 메뉴

    • 홈
    • 방명록
  • 링크

  • 공지사항

    • PWN wargame 모음 (및 느낀점)
    • 비공개 글들에 대해.
    • 뭐라도 하나 얻어가시길...
  • 인기 글

  • 태그

    vtable
    rop
    RTL
    la ctf
    32bit
    root
    Me
    docker
    pwnable.kr
    Buffer Overflow
    tcache
    libc
    heap
    x86
    phoenix
    root-me
    Format String Bug
    exploit education
    lob
    CANARY
    FSB
    hackerschool
    cryptohack
    BOF
    dreamhack
    ROOT ME
    pwntools
    _IO_FILE
    x64
    64bit
  • 최근 댓글

  • 최근 글

  • 250x250
    반응형
  • hELLO· Designed By정상우.v4.10.3
wyv3rn
rev-basic-1
상단으로

티스토리툴바