canary

System Hacking Advanced

[dreamhack] Master Canary

Master Canary└─# checksec mc_thread[*] '/root/dream/Master Canary/mc_thread' Arch: amd64-64-little RELRO: Partial RELRO Stack: Canary found NX: NX enabled PIE: No PIE (0x400000)SSP가 적용됐다. 카나리를 bypass하는 문제라고 예상할 수 있다. 코드를 분석해보자.#include #include #include #include void giveshell() { execve("/bin/sh", 0, 0); }int main() { pthread_t thread_t; if (pthread_create(..

System Hacking Advanced

[dreamhack] Return to Library

문제분석#include #include const char* binsh = "/bin/sh";int main() { char buf[0x30]; setvbuf(stdin, 0, _IONBF, 0); setvbuf(stdout, 0, _IONBF, 0); // Add system function to plt's entry system("echo 'system@plt"); // Leak canary printf("[1] Leak Canary\n"); printf("Buf: "); read(0, buf, 0x100); printf("Buf: %s\n", buf); // Overwrite return address printf("[2] Overwrite return address\n"); ..

System Hacking Advanced

[dreamhack] Return to Shellcode

checksec└─# checksec r2s[*] '/root/dream/rts/r2s' Arch: amd64-64-little RELRO: Full RELRO Stack: Canary found NX: NX disabled PIE: PIE enabled RWX: Has RWX segmentsNX 보호기법이 적용되지 않았다. 따라서 쉘코드를 이용한 공격이 가능하다. 문제분석 & 풀이int main() { char buf[0x50]; init(); printf("Address of the buf: %p\n", buf); printf("Distance between buf and $rbp: %ld\n",(char*)__bu..

System Hacking Advanced

[dreamhack] ssp_001

SSP(Stack Smashing Protector) SSP(Stack Smashing Protector)SSP는 BOF를 방어하기 위한 보호기법 중 하나로 함수를 실행할 때, canary라는 랜덤 값을 스택에 추가하여 BOF로 스택 데이터가 변조됐는지 확인하는 방법이다. canary가 변조된 경우는 스택 데이터가keyme2003.tistory.com #include #include #include #include void get_shell() { system("/bin/sh");}void print_box(unsigned char *box, int idx) { printf("Element of index %d is : %02x\n", idx, box[idx]);}void menu() { ..

keyme
'canary' 태그의 글 목록