실행시켜보면 overflow me을 출력한다.

이게 코드이다.


gdb로 까보니 배열과 key사이의 거리는 52인것을 알수 있다.

Flag : daddy, I just pwned a buFFer :)

'IT > Pwnable.kr' 카테고리의 다른 글

pwnable.kr / col  (0) 2016.04.09
pwnable.kr / fd  (0) 2016.04.07




#include <stdio.h>

#include <string.h>

unsigned long hashcode = 0x21DD09EC;

unsigned long check_password(const char* p){

        int* ip = (int*)p;

        int i;

        int res=0;

        for(i=0; i<5; i++){

                res += ip[i];

        }

        return res;

}


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

        if(argc<2){

                printf("usage : %s [passcode]\n", argv[0]);

                return 0;

        }

        if(strlen(argv[1]) != 20){

                printf("passcode length should be 20 bytes\n");

                return 0;

        }


        if(hashcode == check_password( argv[1] )){

                system("/bin/cat flag");

                return 0;

        }

        else

                printf("wrong passcode.\n");

        return 0;

}


Hint
hashcode를 5번씩 쪼개 저장 하므로 맞는 식을 세워 입력 해주면 된다.
./col `python -c 'print "\xC8\xCE\xC5\x06"*4 +"\xCC\xCE\xC5\x06"'`


'IT > Pwnable.kr' 카테고리의 다른 글

pwnable.kr / bof  (0) 2016.07.17
pwnable.kr / fd  (0) 2016.04.07




#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;


Hint 

0x1234 16진수 ==>> 4660 10진수

이고,buf가 LETMEWIN 와같을때,

'IT > Pwnable.kr' 카테고리의 다른 글

pwnable.kr / bof  (0) 2016.07.17
pwnable.kr / col  (0) 2016.04.09

+ Recent posts