hakcing

    [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값이 서버에 있는..

    webhacking.kr Level 46 문제풀이

    webhacking.kr Level 46 문제풀이

    Level 46 level : index.phps 파일을 보면, 특정 필터링이 일어나고, 쿼리문을 통해 얻은 값이 'admin'이면 문제가 풀린다. 1을 넣어보니 위와 같이 출력되었다. lv 파라미터를 통해 'admin'의 데이터를 추출해야 하므로 다음과 같은 방법을 사용하면 될것 같았다. 위 그림을 통해 'admin'이 출력되는 것을 볼 수 있다. 그러면 lv값에는 무엇을 넣어야 되는지 궁금할 수 있다. 위 사진처럼 lv값에 상관없이 'admin'의 값이 먼저 출력된다. 이런 경우라면 lv의 무엇이든 상관 없다. 하지만, 대상 시스템에서는 어떻게 출력 될지 모르므로 확실하게 앞부분을 False로 만들고 'admin' 데이터만 출력하게 하는 것이 좋다.(실제 이문제에서도 lv값이 False일 때 풀리게 ..