master_canary
·
Wargame/Dreamhack
1. intro 2. code 및 분석 2.1 code // gcc -o master master.c -pthread #include #include #include #include #include char *global_buffer; 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(60); } void get_shell() { system("/bin/sh"); } void *thread_routine() { char buf[256]; g..
Master Canary
·
Wargame/Dreamhack
1. intro 2. code & 분석 // Name: mc_thread.c // Compile: gcc -o mc_thread mc_thread.c -pthread -no-pie #include #include #include #include void giveshell() { execve("/bin/sh", 0, 0); } void init() { setvbuf(stdin, 0, 2, 0); setvbuf(stdout, 0, 2, 0); } int read_bytes (char *buf, int len) { int idx = 0; int read_len = 0; for (idx = 0; idx < len; idx++) { int ret; ret = read(0, buf+idx, 1); if (ret <..