buffer

    [LOB] Level7: darkelf → orge (renew)

    [LOB] Level7: darkelf → orge (renew)

    orge /* The Lord of the BOF : The Fellowship of the BOF - orge - check argv[0] */ #include #include extern char **environ; main(int argc, char *argv[]) { char buffer[40]; int i; if(argc < 2){ printf("argv error\n"); exit(0); } // here is changed! if(strlen(argv[0]) != 77){ printf("argv[0] error\n"); exit(0); } // egghunter for(i=0; environ[i]; i++) memset(environ[i], 0, strlen(environ[i])); if(a..

    [LOB] Level6: wolfman → darkelf (renew)

    [LOB] Level6: wolfman → darkelf (renew)

    darkelf keyword : /* The Lord of the BOF : The Fellowship of the BOF - darkelf - egghunter + buffer hunter + check length of argv[1] */ #include #include extern char **environ; main(int argc, char *argv[]) { char buffer[40]; int i; 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(..

    [LOB] Level5: orc → wolfman (renew)

    [LOB] Level5: orc → wolfman (renew)

    wolfman keyword : egghunter+bufferhunter /* The Lord of the BOF : The Fellowship of the BOF - wolfman - egghunter + buffer hunter */ #include #include extern char **environ; main(int argc, char *argv[]) { char buffer[40]; int i; 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("st..

    [LOB] Level4: goblin → orc (renew)

    [LOB] Level4: goblin → orc (renew)

    orc keyword : BoF+egghunter /* The Lord of the BOF : The Fellowship of the BOF - orc - egghunter */ #include #include extern char **environ; main(int argc, char *argv[]) { char buffer[40]; int i; 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] Level3: cobolt → goblin (renew)

    [LOB] Level3: cobolt → goblin (renew)

    goblin keyword : BoF+env+argv /* The Lord of the BOF : The Fellowship of the BOF - goblin - small buffer + stdin */ int main() { char buffer[16]; gets(buffer); printf("%s\n", buffer); } 0x01. Static Analysis 앞서 문제 cobolt와 다른점은 cobolt에서는 main함수의 argv로 입력값을 받았다면, 지금 문제는 gets를 이용하여 문제를 받는다. 따라서 값을 넘겨주는 방식의 차이만 있을 뿐 앞 문제와 풀이 과정은 동일하다. 0x02. Dynamic Analysis & Exploit cobolt 문제와 동일하게 환경변수에 쉘코드를 넣고 문제..

    [LOB] Level2: gremlin → cobolt (renew)

    [LOB] Level2: gremlin → cobolt (renew)

    Cobolt keyword : BoF+env 0x01. Static Analysis /* The Lord of the BOF : The Fellowship of the BOF - cobolt - small buffer */ int main(int argc, char *argv[]) { char buffer[16]; if(argc < 2){ printf("argv error\n"); exit(0); } strcpy(buffer, argv[1]); printf("%s\n", buffer); } 주어진 cobolt바이너리의 소스코드를 살펴보자.buffer의 크기는 16바이트인데 strcpy로 크기 제한없이 argv의 인자값을 buffer로 복사한다.전 문제인 gremlin과 마찬가지로 BoF 취약점이 존재한다..

    [LOB] Level1: gate → gremlin (renew)

    [LOB] Level1: gate → gremlin (renew)

    gremlin keyword : BoF 0x01. Static Analysis /* The Lord of the BOF : The Fellowship of the BOF - gremlin - simple BOF */ 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); } 제공되는 소스코드를 살펴보면 굉장히 단순한 프로그램이다.argv인자로 받은 값을 strcpy함수를 이용하여 buffer에 저장하는데, buffer의 크기는 256바이트이다.여기서 Buffer OverFlow 취약점이 존재한..

    [pwnable.kr][Toddler] passcode 문제풀이

    [pwnable.kr][Toddler] passcode 문제풀이

    PASSCODE keyword : GOT Write, fflush #include #include void login(){ int passcode1; int passcode2; printf("enter passcode1 : "); scanf("%d", passcode1); fflush(stdin); // ha! mommy told me that 32bit is vulnerable to bruteforcing :) printf("enter passcode2 : "); scanf("%d", passcode2); printf("checking...\n"); if(passcode1==338150 && passcode2==13371337){ printf("Login OK!\n"); system("/bin/cat ..