SystemHacking(95)
-
FC3 ALL CLREAR
FC3 주요 목표1> 랜덤메모리보호기법을 어떻게 우회할 것 인가 ? 2> 라이브러리의 주소를 0x00 으로 시작되어 연속적으로 함수를 호출 할 수 없음을 우회3> fake ebp , GOT Overwriting , pop_pop_ret , fgets , RET Sleding [1] gate -> iron_golem ( Fake EBP )랜덤메모리보호기법 => 라이브러리주소 이용saved ebp = fake ebpsaved eip = &execl+3=> execl( fake ebp + 8 , fake ebp + 12 , fake ebp + 16 )execl( 경로를 포함한 실행파일의 이름 , 인자들 ... , NULL )fake ebp + 8 == 0x00000068 ==> symbolic link 이용 ..
2017.12.13 -
[3] bof
소스코드12345678910111213141516171819#include #include #include void func(int key){ char overflowme[32]; printf("overflow me : "); gets(overflowme); // smash me! if(key == 0xcafebabe){ system("/bin/sh"); } else{ printf("Nah..\n"); }}int main(int argc, char* argv[]){ func(0xdeadbeef); return 0;} Colored by Color Scriptercs 가상서버에서 #wget http://pwnable.kr/bin/bof 명령어를 이용해서 bof 파일을 다운받은 후 디버깅 해보자func함수0..
2017.12.05 -
[1] fd
파일 디스크립터 ( File Discriptor ) 0 : 표준 입력1 : 표준 출력2 : 표준 에러 12345678910111213141516171819202122 #include #include #include char buf[32];int main(int argc, char* argv[], char* envp[]){ if(argc 표준입력을 받아서 32길이만큼의 데이터를 buf에 저장 strcmp( str1 , str2 )str1 과 str2 를 비교해서 같으면 0 , str1 > str2 : 양수 , str1 < str2 : 음수 반환 atoi() 함수입력받은 문자열을 long 정수형으로 변환한다* fd = atoi( argv[1] ) - 0x1234* 0x1234 == 4660
2017.12.05 -
[5] evil_wizard -> dark_stone ( GOT Overwriting & Remote BOF )
evil_wizard / get down like that이전 문제와 푸는 방법은 같지만 Remote 라는 점만 다르다 ( cat 과 nc를 이용한 풀이 ) [ dark_stone.c ]1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253 /* The Lord of the BOF : The Fellowship of the BOF - dark_stone - Remote BOF on Fedora Core 3 - hint : GOT overwriting again - port : TCP 8888*/ #include // magic potion for youvoid pop_pop_ret(vo..
2017.12.01 -
[4] hell_fire -> evil_wizard ( GOT Overwriting )
GOT Overwriting을 사용하기 위해서는 pop_pop_ret 코드가 필요하다해당 서버 버전에서는 pop_pop_ret 코드가 없어서 문제의 소스코드에 직접 입력 해두고 있다 1> RTL 의 주소가 0x00 으로 시작되어 한 개 이상의 함수를 호출 할 수 없다 & 인자를 사용하면 함수를 최대 두개 호출 할 수 있다=> pop_pop_ret 를 사용하여 해결 / NULL 값을 입력할 수 없기 때문에 함수들의 PLT 주소를 이용한다 2> 호출함수 주소 변조=> strcpy 이용 [ 형식 ]char *strcpy(char *dest, const char *src);payload : ( strcpy'plt + pop_pop_ret + dst + src + strcpy'plt + pop_pop_ret + ..
2017.11.30 -
[3] dark_eyes -> hell_fire ( Fake EBP & fgets Cache memory / mprotect)
dark_eyes / because of you [ hellfire.c ]12345678910111213141516171819202122232425262728 #include int main(){ char buffer[256]; char saved_sfp[4]; char temp[1024]; printf("hell_fire : What's this smell?\n"); printf("you : "); fflush(stdout); // give me a food fgets(temp, 1024, stdin); // save sfp memcpy(saved_sfp, buffer+264, 4); // overflow!! strcpy(buffer, temp); // restore sfp memcpy(buffer+2..
2017.11.28