문제 소스는 아래와 같다. /* The Lord of the BOF : The Fellowship of the BOF – skeleton – argv hunter */ #include <stdio.h> #include <stdlib.h> extern char **environ; main(int argc, char *argv[]) { char buffer[40]; int i, saved_argc; if(argc < 2){ printf(argv error\n); exit(0); } // egghunter for(i=0; environ[i]; i++) memset(environ[i], 0, strlen(environ[i])); if(argv[1][47] …
BOF 원정대 – Level 9 (vampire)
이번 문제 소스는 아래와 같다. /* The Lord of the BOF : The Fellowship of the BOF – vampire – check 0xbfff */ #include <stdio.h> #include <stdlib.h> main(int argc, char *argv[]) { char buffer[40]; if(argc < 2){ printf(argv error\n); exit(0); } if(argv[1][47] != '\xbf') { printf(stack is still your friend.\n); exit(0); } // here is …
BOF 원정대 – Level 8 (troll)
이번 문제 소스는 아래와 같다. /* The Lord of the BOF : The Fellowship of the BOF – troll – check argc + argv hunter */ #include <stdio.h> #include <stdlib.h> extern char **environ; main(int argc, char *argv[]) { char buffer[40]; int i; // here is changed if(argc != 2){ printf(argc must be two!\n); exit(0); } …
BOF 원정대 – Level 7 (orge)
문제 소스는 아래와 같다. /* 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); …
BOF 원정대 – Level 6 (darkelf)
문제 소스는 아래와 같다. /* The Lord of the BOF : The Fellowship of the BOF – darkelf – egghunter + buffer hunter + check length of argv[1] */ #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); } // egghunter for(i=0; …
BOF 원정대 – Level 5 (wolfman)
문제소스는 아래와 같다. /* The Lord of the BOF : The Fellowship of the BOF – wolfman – egghunter + buffer hunter */ #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); } // egghunter for(i=0; environ[i]; i++) memset(environ[i], 0, strlen(environ[i])); if(argv[1][47] …
BOF 원정대 – Level 4 (orc)
문제 소스는 아래와 같다. /* The Lord of the BOF : The Fellowship of the BOF – orc – egghunter */ #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); } // egghunter for(i=0; environ[i]; i++) memset(environ[i], 0, strlen(environ[i])); if(argv[1][47] != '\xbf') …
BOF 원정대 – Level 3 (goblin)
문제 소스는 아래와 같다. /* The Lord of the BOF : The Fellowship of the BOF – goblin – small buffer + stdin */ int main() { char buffer[16]; gets(buffer); printf(%s\n, buffer); } 이전 문제와 다른 점은 인자를 argv로 받는것이 아니라 gets() 함수를 이용해 받는다는 것이다. get() 함수를 이용해 인자를 받을때는 아래와 같이 풀이를 하면 …
BOF 원정대 – Level 2 (cobolt)
Level 2 문제 소스는 아래와 같다. /* The Lord of the BOF : The Fellowship of the BOF – cobolt – small buffer */ int main(int argc, char *argv[]) { char buffer[16]; if(argc < 2){ printf(argv error\n); exit(0); } strcpy(buffer, argv[1]); printf(%s\n, buffer); } 이번 문제는 전 문제와 달리 버퍼의 크기가 작다. 이런 경우 환경변수를 …
BOF 원정대 – Level 1 (gremlin)
첫번째 문제다. 소스는 아래와 같이 아주 단순한 BOF 다. /* The Lord of the BOF : The Fellowship of the BOF – gremlin – simple BOF */ int main(int argc, char *argv[]) { char buffer[256]; if(argc < 2){ printf("argv error\n"); exit(0); } strcpy(buffer, argv[1]); printf("%s\n", buffer); } 이번 문제의 풀이는 여러가지가 될 수 있다. 환경변수에 …