Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | ||||||
2 | 3 | 4 | 5 | 6 | 7 | 8 |
9 | 10 | 11 | 12 | 13 | 14 | 15 |
16 | 17 | 18 | 19 | 20 | 21 | 22 |
23 | 24 | 25 | 26 | 27 | 28 |
Tags
- ASM
- format
- Reverse
- reversing
- anti
- 2018
- practicalmalwareanalysis
- pico
- writeup
- shellcraft
- rev
- pwnable.kr
- pwn
- shellcode
- toddler
- Bottle
- Bug
- CTF
- FSB
- Toddler's Bottle
- CANARY
- Rookiss
- BOF
- Read
- picoCTF
- pwnable
- TUCTF
- string
- Leak
- PMA
Archives
- Today
- Total
제리의 블로그
pwnable.kr fd 본문
fd - 1 pt
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 fd@pwnable.kr -p2222 (pw:guest)
파일 디스크립터 문제입니다.
<출처: 위키피디아>
stdin 은 0, stdout 은 1, stderr 는 2 입니다. 표준 입출력이죠.
fd@ubuntu:~$ ls -l
total 16
-r-sr-x--- 1 fd_pwn fd 7322 Jun 11 2014 fd
-rw-r--r-- 1 root root 418 Jun 11 2014 fd.c
-r--r----- 1 fd_pwn root 50 Jun 11 2014 flag
#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;
}
fd@ubuntu:~$ ./fd `python -c 'print 0x1234'`
LETMEWIN
good job :)
mommy! I think I know what a file descriptor is!!
'Wargame > pwnable.kr' 카테고리의 다른 글
pwnable.kr bof (0) | 2018.08.24 |
---|---|
pwnable.kr collision (0) | 2018.08.24 |
pwnable.kr echo1 (0) | 2018.08.22 |
pwnable.kr horcruxes (1) | 2018.08.20 |
pwnable.kr blukat (0) | 2018.08.19 |
Comments