목록Pwnable/해커스쿨 FTZ write-up (20)
뇌
보호되어 있는 글입니다.
level19 - id : level19 , pw : swimming in pink [level19@ftz level19]$ ls attackme hintpublic_html tmp [level19@ftz level19]$ cat hint main() { char buf[20]; gets(buf); printf("%s\n",buf); } [level19@ftz level19]$ 이전 문제들보다 매우 간단해보인다. gets 함수의 취약점에 의해 BOF 취약점을 사용할 수 있는 점은 같지만, setreuid 함수를 이용하여 level20 의 권한을 얻는 부분이 없다. 파일 자체에 setuid 가 level20 으로 설정되어있으므로 setuid 가 있는 쉘 코드를 사용하면 된다. 처음에는 내가 애초에 setu..
level18 - id : level18 , pw : why did you do it [level18@ftz level18]$ ls attackme hintpublic_html tmp [level18@ftz level18]$ cat hint #include #include #include #include void shellout(void); int main() { char string[100]; int check; int x = 0; int count = 0; fd_set fds; printf("Enter your command: "); fflush(stdout); // 표준출력 버퍼 비우기 ("Enter your command: " 를 먼저 출력해버림) while(1) { if(count >= 100)..
level17 - id : level17 , pw : king poetic [level17@ftz level17]$ ls attackme hintpublic_html tmp [level17@ftz level17]$ cat hint #include void printit() { printf("Hello there!\n"); } main() { int crap; void (*call)()=printit; char buf[20]; fgets(buf,48,stdin); setreuid(3098,3098); call(); } [level17@ftz level17]$ printit 함수의 메모리 주소를 call 함수포인터에 저장한다. 그리고 변수 buf 에 표준입력으로 입력받고, printit 함수(call)를 호..
level16 - id : level16 , pw : about to cause mass [level16@ftz level16]$ ls attackme attackme.c hint public_html tmp [level16@ftz level16]$ cat attackme.c cat: attackme.c: 허가 거부됨 [level16@ftz level16]$ cat hint #include void shell() { setreuid(3097,3097); system("/bin/sh"); } void printit() { printf("Hello there!\n"); } main() { int crap; void (*call)()=printit; char buf[20]; fgets(buf,48,stdin)..
level15 - id : level15 , pw : guess what [level15@ftz level15]$ ls attackme hintpublic_html tmp [level15@ftz level15]$ cat hint #include main() { int crap; int *check; char buf[20]; fgets(buf,45,stdin); if (*check==0xdeadbeef) { setreuid(3096,3096); system("/bin/sh"); } } [level15@ftz level15]$ 이번 문제는 level14 문제에서 check 가 포인터 인 것만 바뀌었다. attackme 파일을 gdb 로 분석해보자. [level15@ftz level15]$ cp attackm..
level14 - id : level14 , pw : what that nigga want? [level14@ftz level14]$ ls attackme hintpublic_html tmp [level14@ftz level14]$ cat hint 레벨14 이후로는 mainsource의 문제를 그대로 가져왔습니다. 버퍼 오버플로우, 포맷스트링을 학습하는데는 이 문제들이 최고의 효과를 가져다줍니다. #include #include main() { int crap; int check; char buf[20]; fgets(buf,45,stdin); if (check==0xdeadbeef) { setreuid(3095,3095); system("/bin/sh"); } } [level14@ftz level14]$..
level13 - id : level13 , pw : have no clue [level13@ftz level13]$ ls attackme hintpublic_html tmp [level13@ftz level13]$ cat hint #include main(int argc, char *argv[]) { long i=0x1234567; char buf[1024]; setreuid( 3094, 3094 ); if(argc > 1) strcpy(buf,argv[1]); if(i != 0x1234567) { printf(" Warnning: Buffer Overflow !!! \n"); kill(0,11); } } [level13@ftz level13]$ 이번 문제는 level11 과 거의 같은 문제이지만 i ..
level12 - id : level12 , pw : it is like this [level12@ftz level12]$ ls attackme hintpublic_html tmp [level12@ftz level12]$ cat hint #include #include #include int main( void ) { char str[256]; setreuid( 3093, 3093 ); printf( "문장을 입력하세요.\n" ); gets( str ); printf( "%s\n", str ); } [level12@ftz level12]$ 이 문제도 level11 문제와 같은 문제인데, 인자값이 아니라 표준입력으로 입력 받는다는 차이가 있다. gets 함수도 마찬가지로 최대 입력 받는 문자의 개수를 정하..
level11 - id : level11 , pw : what!@#$? [level11@ftz level11]$ ls attackme hintpublic_html tmp [level11@ftz level11]$ cat hint #include #include int main( int argc, char *argv[] ) { char str[256]; setreuid( 3092, 3092 ); strcpy( str, argv[1] ); printf( str ); } [level11@ftz level11]$ hint 는 이름이 명시되지도 않은 파일의 소스코드가 적혀있다. 그리고 attackme 라는 새로운 파일이 생겼다. [level11@ftz level11]$ ls -l 합계 28 -rwsr-x--- 1 ..