[Dreamhack] rev-basic-2

김성진·2022년 8월 8일
0

Dreamhack_Reversing

목록 보기
3/13

📒 Description


📒 C code

📖 main

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

  memset(v4, 0, sizeof(v4));
  sub_1400011B0("Input : ", argv, envp);
  sub_140001210("%256s", v4);
  if ( (unsigned int)sub_140001000(v4) )
    puts("Correct");
  else
    puts("Wrong");
  return 0;
}

📖 sub_140001000

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

  for ( i = 0; (unsigned __int64)i < 0x12; ++i )
  {
    if ( *(_DWORD *)&aC[4 * i] != *(unsigned __int8 *)(a1 + i) )
      return 0i64;
  }
  return 1i64;
}

0x12, 즉 18바이트가 들어가야 하나 보다.
내가 입력한 i번째 글자랑 aC[4 * i] 글자랑 같아야 하겠다.


📒 Exploit


이렇게 배열 안의 값들이 보이게 되는데 이렇게 확인 가능하다.

profile
Today I Learned

0개의 댓글