write

    [LOB] Level14: bugbear → giant

    [LOB] Level14: bugbear → giant

    giant keyword : RTL(Returen To Library) /* The Lord of the BOF : The Fellowship of the BOF - giant - RTL2 */ #include #include #include main(int argc, char *argv[]) { char buffer[40]; FILE *fp; char *lib_addr, *execve_offset, *execve_addr; char *ret; if(argc < 2){ printf("argv error\n"); exit(0); } // gain address of execve fp = popen("/usr/bin/ldd /home/giant/assassin | /bin/grep libc | /bin/aw..

    [LOB] Level13: darkknight → bugbear

    [LOB] Level13: darkknight → bugbear

    bugbear keyword : RTL /* The Lord of the BOF : The Fellowship of the BOF - bugbear - RTL1 */ #include #include main(int argc, char *argv[]) { char buffer[40]; int i; if(argc < 2){ printf("argv error\n"); exit(0); } if(argv[1][47] == '\xbf') { printf("stack betrayed you!!\n"); exit(0); } strcpy(buffer, argv[1]); printf("%s\n", buffer); } 분기문을 통해 RET 부분에 덮여씌워지는 주소 앞주소'\xbf'를 필터링 한다. 즉, '\xbf'로 시작하..

    [LOB] Level12: golem → darkknight

    [LOB] Level12: golem → darkknight

    Darkknight /* The Lord of the BOF : The Fellowship of the BOF - darkknight - FPO */ #include #include void problem_child(char *src) { char buffer[40]; strncpy(buffer, src, 41); printf("%s\n", buffer); } main(int argc, char *argv[]) { if(argc

    [LOB] Level11: skeleton → golem

    [LOB] Level11: skeleton → golem

    golem /* The Lord of the BOF : The Fellowship of the BOF - golem - stack destroyer */ #include #include extern char **environ; main(int argc, char *argv[]) { char buffer[40]; int i; if(argc < 2){ printf("argv error\n"); exit(0); } if(argv[1][47] != '\xbf') { printf("stack is still your friend.\n"); exit(0); } strcpy(buffer, argv[1]); printf("%s\n", buffer); // stack destroyer! memset(buffer, 0, ..

    [BOF, LOB] Level10: vampire → skeleton

    [BOF, LOB] Level10: vampire → skeleton

    skeleton /* The Lord of the BOF : The Fellowship of the BOF - skeleton - argv hunter */ #include #include 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] != '\xbf') { printf("stack is still your friend.\n"); ex..

    [LOB] Level9: troll → vampire

    [LOB] Level9: troll → vampire

    vampire /* The Lord of the BOF : The Fellowship of the BOF - vampire - check 0xbfff */ #include #include 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 changed! if(argv[1][46] == '\xff') { printf("but it's not forever\n"); exit(0); } strcpy(buffer, argv[1])..

    [LOB] Level8: orge → troll

    [LOB] Level8: orge → troll

    한동안 LOB문제를 안풀다가 엄~~청 오랜만에 이어서 풀어보기 시작했다. 그래서 그전과 풀이 방식과 설명내용 등... 많이 다를 수 있음을 주의하자ㅋㅋ troll /* The Lord of the BOF : The Fellowship of the BOF - troll - check argc + argv hunter */ #include #include 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); } // egghunter for(i=0; environ[i]; i++) memset(..

    Webhacking.kr Level 22 문제풀이

    Webhacking.kr Level 22 문제풀이

    Level 22 username password 아이디와 비밀번호를 넣고 로그인과 회원가입하는 버튼이 존재한다. 힌트도 위 사진처럼 보여지고 있다. 소스코드를 보면 id와 pw가 POST방식으로 전달되는 것을 볼 수 있다. 회원가입을 통해 아이디를 만들고 로그인을 해보았다. (ttest / 1234) key값을 보아 특정 암호화가 이루어 지는것 같다. key값의 길이를 알아보니 32바이트였다. 32바이트 하면 떠오르는건 MD5 해시 뿐이였다. 예상대로 MD5였다. 복호화 문자는 '1234zombie' 였다. 즉, 비밀번호를 생성하면 비밀번호 뒤에 'zombie'를 붙이고 md5 해싱을 하여 key값으로 사용한다. (지금 write-up쓰면서 생각해보니, '1234zombie' 라는 md5값이 서버에 있는..