연구실:System

[pwnable.kr] fd (1pt) write up

작성자 정보

  • za9uar 작성
  • 작성일

컨텐츠 정보

본문

※ 지문: 

 Mommy! what is a file descriptor in Linux?

 

* try to play the wargame your self but if you are ABSOLUTE beginner, follow this tutorial link:

https://youtu.be/971eZhMHQQw

 

ssh [email protected] -p2222 (pw:guest)

 

 

※ 풀이:

file discriptor를 이용한 문제다.

 fd@pwnable:~$ cat fd.c

#include <stdio.h>

#include <stdlib.h>

#include <string.h>

char buf[32];

int main(int argc, char* argv[], char* envp[]){

if(argc<2){

printf("pass argv[1] a number\n");

return 0;

}

int fd = atoi( argv[1] ) - 0x1234;

int len = 0;

len = read(fd, buf, 32);

if(!strcmp("LETMEWIN\n", buf)){

printf("good job :)\n");

system("/bin/cat flag");

exit(0);

}

printf("learn about Linux file IO\n");

return 0;

}

 

0x1234 -> 10진수로 4660 이어서

4660을 매개변수로 전달하고

strcmp 조건식을 만족시키도록 LETMEWIN을 입력했다.

 

fd@pwnable:~$ ./fd 4660

LETMEWIN

good job :)

mommy! I think I know what a file descriptor is!! <- FLAG ? DRAG HERE !

관련자료

댓글 0
등록된 댓글이 없습니다.

최근글


새댓글