[Dreamhack] Simple Patch Me

chrmqgozj·2025년 2월 7일

DreamHack

목록 보기
20/39
  1. main
__int64 __fastcall main(int a1, unsigned __int64 a2, char **a3)
{
  puts("I will show you the flag after 1 year :p");
  dword_40404C = 0;
  while ( (unsigned int)dword_40404C <= 0x2237 )
  {
    sleep(0xE10u);
    if ( ++dword_40404C == 1 )
    {
      puts("1 hour passed");
    }
    else
    {
      a2 = (unsigned int)dword_40404C;
      printf("%u hours passed\n", (unsigned int)dword_40404C);
    }
    if ( !(dword_40404C % 0x18u) )
    {
      if ( dword_40404C == 24 )
      {
        puts("1 day has paased.");
      }
      else
      {
        a2 = dword_40404C % 0x18u;
        printf("%u days have passed.\n", a2);
      }
    }
  }
  printf("Great xD 1 year has passed! The flag is: ");
  sub_401196("Great xD 1 year has passed! The flag is: ", a2);
  return 0LL;
}

현실시간으로 1년이 지나야 flag를 출력해주는 프로그램이다. 이를 패치하여 1년이 지나지 않아도 플래그를 출력하도록 해야 한다.

0x2237 = 24*365 즉, 1년만큼의 시간이 지나면 while문을 빠져나온다.

  1. patch

while문 조건을 <= 0으로 변경하였다.

sleep도 없앴다.

그런데 플래그가 깨졌다.

  1. gdb
    patch로 sleep만 없애고 동적으로 수정하기로 했다.

0개의 댓글