오버플로우

    [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] 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] 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] blackjack 문제풀이

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

    blackjack 문제를 푸는 시간보다 blackjack 게임에 대해 이해하는게 더 어려웠던 문제....😒 nc로 접속해 보면 위 처럼 보여지는데, 1번을 누르면 게임이 시작되고, 2번은 게임 설명이다. 블랙잭에 대해 몰라서 2번을 눌러 설명을 보기로 했다.(사실 이걸 읽고도 이해하지 못해서 블랙잭을 아는 지인한테 물어봐서 겨우 이해했다... 제대로 이해 했는지는 모르겠지만😂)블랙잭은 나와 딜러 2명이서 진행하는 게임이다.처음 서로 1장씩 가지게 되고 베팅을 하게 된다.그리고 각 라운드마다 'Hit'과 'Stay'중 선택을 할 수있다.각 라운드마다 받은 카드 숫자의 합이 21과 더 가까운 사람이 승리하게 되며, 21을 넘어서면 패배가 된다.그리고 21이 되면 무조건 승리하게 된다.대충 블랙잭은 이렇게 흘..

    [LOB] Level20: xavius → death_knight [完]

    [LOB] Level20: xavius → death_knight [完]

    death_knight /* The Lord of the BOF : The Fellowship of the BOF - dark knight - remote BOF */ #include #include #include #include #include #include #include #include #include main() { char buffer[40]; int server_fd, client_fd; struct sockaddr_in server_addr; struct sockaddr_in client_addr; int sin_size; if((server_fd = socket(AF_INET, SOCK_STREAM, 0)) == -1){ perror("socket"); exit(1); } server_..

    [LOB] Level19: nightmare → xavius

    [LOB] Level19: nightmare → xavius

    xavius /* The Lord of the BOF : The Fellowship of the BOF - xavius - arg */ #include #include #include main() { char buffer[40]; char *ret_addr; // overflow! fgets(buffer, 256, stdin); printf("%s\n", buffer); if(*(buffer+47) == '\xbf') { printf("stack retbayed you!\n"); exit(0); } if(*(buffer+47) == '\x08') { printf("binary image retbayed you, too!!\n"); exit(0); } // check if the ret_addr is li..

    [LOB] Level18: succubus → nightmare

    [LOB] Level18: succubus → nightmare

    nightmare /* The Lord of the BOF : The Fellowship of the BOF - nightmare - PLT */ #include #include #include #include main(int argc, char *argv[]) { char buffer[40]; char *addr; if(argc < 2){ printf("argv error\n"); exit(0); } // check address addr = (char *)&strcpy; if(memcmp(argv[1]+44, &addr, 4) != 0){ printf("You must fall in love with strcpy()\n"); exit(0); } // overflow! strcpy(buffer, arg..

    [LOB] Level17: zombie_assassin → succubus

    [LOB] Level17: zombie_assassin → succubus

    succubus keyword : RTL /* The Lord of the BOF : The Fellowship of the BOF - succubus - calling functions continuously */ #include #include #include // the inspector int check = 0; void MO(char *cmd) { if(check != 4) exit(0); printf("welcome to the MO!\n"); // olleh! system(cmd); } void YUT(void) { if(check != 3) exit(0); printf("welcome to the YUT!\n"); check = 4; } void GUL(void) { if(check != ..