[Reversing] Reversing Basic Challenge #0

2024. 7. 28. 22:16·Hacking/Write Up
728x90
반응형

문제 : https://dreamhack.io/wargame/challenges/14

 

rev-basic-0

Reversing Basic Challenge #0 이 문제는 사용자에게 문자열 입력을 받아 정해진 방법으로 입력값을 검증하여 correct 또는 wrong을 출력하는 프로그램이 주어집니다. 해당 바이너리를 분석하여 correct를 출

dreamhack.io

 

Code Analysis

입력해서 correct가 뜨는 문자열을 찾으면 된다

Reversing

IDA로 메인 함수를 보면

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

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

256바이트 길이의 문자열을 입력받아 v4에 넣고, 이를 sub_140001000함수에 인자로 v4를 넣어서 이게 true가 되면 Correct를 출력함

sub_140001000(a1)

_BOOL8 __fastcall sub_140001000(const char *a1)
{
  return strcmp(a1, "Compar3_the_str1ng") == 0;
}

"Compar3_the_str1ng"와 입력되는 문자열이 같으면 0이므로 같으면 true를 return

 

따라서 플래그가 Compar3_the_str1ng이다

 

728x90
반응형

'Hacking > Write Up' 카테고리의 다른 글

[Cryptography] Textbook-CBC  (4) 2024.08.03
[Reversing] Reversing Basic Challenge #1  (0) 2024.07.28
[Pwnable] bof  (4) 2024.07.28
[Pwnable] basic_exploitation_001  (0) 2024.04.03
[Cryptography] Textbook-RSA  (2) 2024.02.13
'Hacking/Write Up' 카테고리의 다른 글
  • [Cryptography] Textbook-CBC
  • [Reversing] Reversing Basic Challenge #1
  • [Pwnable] bof
  • [Pwnable] basic_exploitation_001
min_zu
min_zu
  • min_zu
    민주제도
    min_zu
  • 전체
    오늘
    어제
    • ._. (176)
      • AI (2)
        • DeepLearning (2)
        • CS231n (0)
      • Web (2)
        • ReactJS (0)
      • CS (83)
        • OS (7)
        • Data Structure (23)
        • Computer Architecture (8)
        • Computer Network (20)
        • Algorithm (25)
      • Linux (3)
        • KaliLinux (0)
        • Docker (1)
      • Hacking (83)
        • Write Up (25)
        • Pwnable (13)
        • Reversing (2)
        • Cryptography (12)
        • Web Hacking (4)
        • Window (6)
        • Network (7)
        • Web3 (13)
  • 블로그 메뉴

    • 홈
    • 태그
    • 방명록
  • 링크

  • 공지사항

  • 인기 글

  • 태그

    Sort
    WinAFL
    Tree
    OS
    UTM
    DataStructure
    Linux
    Web
    Graph
    Mac
    Search
    AI
    ComputerArchitecture
    DeepLearning
  • 최근 댓글

  • 최근 글

  • hELLO· Designed By정상우.v4.10.0
min_zu
[Reversing] Reversing Basic Challenge #0
상단으로

티스토리툴바