목록War game (54)
둘둘리둘둘리둘둘리둘둘리둘둘리둘
[dark_eyes@Fedora_1stFloor ~]$ cat ./hell_fire.c/* The Lord of the BOF : The Fellowship of the BOF - hell_fire - Remote BOF on Fedora Core 3 - hint : another fake ebp or got overwriting - port : TCP 7777*/ #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, std..
VM 이미지가 날라가서 .. 풀면서 메모한거라도 남깁니다. 제생각엔 해커스쿨 FTZ 다 푸셨다면 19번문제 제외하고는 다 이정도 힌트로 풀 수 있을거라 생각합니다.혹시라도 이 글을 보고 해커스쿨 레드햇 푸시는분은 궁금한점 물어보세요! 1. gremlin :2. cobolt :3. goblin :4. orc:5. wolfman:6. darkelf :7. orge :8. troll :9. vampire :10. skeleton :11. golem :12. darkknight :13. bugbear :14. giant : 15. assassin :16. zombie_assassin:17. succubus :18. nightmare :19. xavius :20. death_kinght : 19."\xeb\x11..
/* The Lord of the BOF : The Fellowship of the BOF - dark_eyes - Local BOF on Fedora Core 3 - hint : RET sleding*/ int main(int argc, char *argv[]){ char buffer[256]; char saved_sfp[4]; if(argc < 2){ printf("argv error\n"); exit(0); } // save sfp memcpy(saved_sfp, buffer+264, 4); // overflow!! strcpy(buffer, argv[1]); // restore sfp memcpy(buffer+264, saved_sfp, 4); printf("%s\n", buffer);} sfp값..
[gate@Fedora_1stFloor ~]$ cat ./iron_golem.c/* The Lord of the BOF : The Fellowship of the BOF - iron_golem - Local BOF on Fedora Core 3 - hint : fake ebp*/ 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);} Fedora core3부터는 redhat보다 제대로 된 ASLR이 적용되고, 라이브러리 주소가 0x00으로 시작되고, NX-Bit가 존제한다. 이 말은 즉 프로그..
#include main(int argc,char **argv){ char bleh[80]; setreuid(3101,3101); fgets(bleh,79,stdin); printf(bleh);} 80byte의 bleh의 공간에 stdin으로 79byte를 입력받아 출력한다. 오버플로우 취약점은 찾을 수 없으니 포맷스트링 버그를 사용해 문제를 풀어야 한다. -포맷스트링 버그란?printf(bleh);처럼 인자 하나만 들어가면서 그 인자를 조작할 수 있을때, 그 인자에 %d,%s등이 들어가면 printf동작시 인자를 포맷 갯수만큼 인식하고 ebp+8(첫번째 인자 자리)에서 부터 4씩 높은주소의 [그림 1]과 같이 값을 출력한다.[그림 1] 여기서 %n을 만나면 다음 인자값이 들어갈 자리가 가진 주소에 여태..
main(){ char buf[20]; gets(buf); printf("%s\n",buf);} 여태까지의 문제와 달리 setreuid를 main에서 호출하지 않는다. 그말은 직접 setreuid를 실행해 준 후 쉘을 실행시켜야 level20의 권한을 얻을 수 있다는 것 이다. 단순하게 생각해서 여태까지 풀어왔던 방법에서 쉘 코드에 setreuid(3100,3100)만 추가해 주고 환경변수에 쉘 코드 등록 후 리턴 주소를 환경변수로 덮어주면 된다. 물론 쉘코드를 짜야하는 번거로움이 있다. --풀이--[level19@ftz tmp]$ export sh=`python -c 'print "\x90"*2000+"\x31\xc0\x89\xc1\x89\xc3\x66\xb9\x1c\x0c\x66\xbb\x1c\x0c..
#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); while(1) { if(count >= 100) printf("what are you trying to do?\n"); if(check == 0xdeadbeef) shellout(); else { FD_ZERO(&fds); //fdset 초기화 FD_SET(STDIN_FILENO,&fds); //fdset중 stdin에 해당하는 비트를 1로 세트 if(select(FD_SETSIZ..
#include void printit() { printf("Hello there!\n");} main(){ int crap; void (*call)()=printit; char buf[20]; fgets(buf,48,stdin); setreuid(3098,3098); call();} Level16(http://dool2ly.tistory.com/23)과 다른점은 shell을 띄워주는 함수가 없다는것 뿐이다.Level16과 마찬가지로 변수 call의 내용이 printit의 주소가 아니라 쉘 코드의 시작 주소를 넣어주면 되겠다.고맙게도 setreuid가 있으니 쉘 코드는 단순히 shell만 실행시켜주면 된다. Level11(http://dool2ly.tistory.com/18)에서 부터 해왔듯 환경변수 s..
#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); call();} shell함수와 printit함수가 정의되어 있고아래와 같이 동작한다.1. 변수 call에 printit함수의 주소값을 넣는다. 2. 크기 20byte인 buf에 stdin으로부터 최대 48byte까지 입력받는다.3. call을 호출한다.call을 호출할때 printit이 아니라 shell이 호출되게 하면 된다. 함수 printit의 주소와 shell의 주소는 ..
#include main(){ int crap; int *check; char buf[20]; fgets(buf,45,stdin); if (*check==0xdeadbeef) { setreuid(3096,3096); system("/bin/sh"); }} Level14에서 한번 꼬았다.. check가 가진값이 아니라 check가 가리키는곳의 값이 0xdeadbeef인지 검사후 맞으면 쉘을 띄워준다. 풀이는 level14(http://dool2ly.tistory.com/21)와 다를게 없지만, check에 0xdeadbeef를 넣어줄게 아니라 0xdeadbeef를 가진 주소를 넣어줘야 한다. 0xdeadbeef는 이미 main함수에 하드코딩 돼있으니 그 값을 가져다 쓰면 되겠다. 페이로드 : [ dummy..