[darkelf@localhost darkelf]$ cat orge.c /* The Lord of the BOF : The Fellowship of the BOF - orge - check argv[0] */ #include <stdio.h> #include <stdlib.h> extern char **environ; main(int argc, char *argv[]) { char buffer[40]; int i; if(argc < 2){ printf("argv error\n"); exit(0); } // here is changed! if(strlen(argv[0]) != 77){ printf("argv[0] error\n"); exit(0); } // egghunter for(i=0; environ[i]; i++) memset(environ[i], 0, strlen(environ[i])); if(argv[1][47] != '\xbf') { printf("stack is still your friend.\n"); exit(0); } // check the length of argument if(strlen(argv[1]) > 48){ printf("argument is too long!\n"); exit(0); } strcpy(buffer, argv[1]); printf("%s\n", buffer); // buffer hunter memset(buffer, 0, 40); } |
argv[0]이 77byte여야하네요 ㅋㅋ 심볼릭 링크를 이용하란 얘기겠군요
'워게임 > lord of bof' 카테고리의 다른 글
level 8 -> 9 (0) | 2015.10.23 |
---|---|
level 7 -> 8 (0) | 2015.10.23 |
level 5 -> 6 (0) | 2015.10.23 |
level 4 -> 5 (0) | 2015.10.23 |
level 3 -> 4 (0) | 2015.10.23 |