System Hacking Advanced

System Hacking Advanced

[dreamhack] SigReturn-Oriented Programming

개념정리○ SROP란?Sigreturn-oriented-programming의 약자로 SROP라고 부른다. Sigreturn system call을 사용하는 ROP 기법: Sigreturn system call은 시그널을 받은 프로세스가 kernel mode에서 user mode로 복귀할 때 사용하는 system call을 의미한다. sigreturn syscall 을 이용해 모든 레지스터값을 컨트롤해서 exploit한다. 기본적으로 ROP와 똑같은 개념이지만, ROP를 수행하기위한 가젯이 부족한 경우에 사용할 수 있는 방법이다. 운영체제는 보안, 자원 관리 등의 이유로 user mode와 kernel mode를 컨텍스트 스위칭하면서 프로세스를 실행한다. 만약, 시그널이 발생한다면 kernel mode로..

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] master_canary

checksec└─# checksec master_canary[*] '/root/dream/master_canary/master_canary' Arch: amd64-64-little RELRO: Partial RELRO Stack: Canary found NX: NX enabled PIE: No PIE (0x400000)NX, SSP가 적용됐다. 문제분석// gcc -o master master.c -pthread#include #include #include #include #include char *global_buffer;void get_shell() { system("/bin/sh");}void *thread_routine() ..

System Hacking Advanced

[dreamhack] Tcache Poisoning

Tcache Poisoning Tcache PoisoningTcache PoisoningDouble Free Bug를 이용하여 tcache_entry를 조작하고 이미 할당된 메모리에 다시 힙 청크를 할당하는 공격 기법이다. tcache에서 사용하는 tcache_put과 tcache_get 함수에서는 old와 p를 검증하지keyme2003.tistory.com [*] '/root/dream/tcache_poison/tcache_poison' Arch: amd64-64-little RELRO: Full RELRO Stack: No canary found NX: NX enabled PIE: No PIE (0x400000)보호기법을 확인하면 Ful..

System Hacking Advanced

[dreamhack] sint

문제풀이#include #include #include #include void get_shell(){ system("/bin/sh");}int main(){ char buf[256]; int size; initialize(); signal(SIGSEGV, get_shell); printf("Size: "); scanf("%d", &size); if (size > 256 || size buf[256], size 선언size를 입력 받고 buf 범위를 벗어나는 size인 경우에는 exit(0) 실행범위를 벗어나지 않는 경우는 size-1 크기의 입력을 받고 buf에 저장size에 대한 검증이 존재하므로 BOF가 불가능해보인다. 진짜 불가능할까?if (size > ..

System Hacking Advanced

[dreamhack] uaf_overwrite

uaf_overwriteUse After Free (UAF) Use After Free (UAF)Use After Free (UAF)Use After Free (UAF) 취약점은 프로그램이 메모리를 해제한 후에도 해당 메모리 위치를 계속 사용하는 경우 발생하는 보안 취약점이다. 운영 체제는 메모리를 효율적으로 사용하기keyme2003.tistory.com UAF 취약점을 실습하는 문제다.void robot_func() { int sel; robot = (struct Robot *)malloc(sizeof(struct Robot)); strcpy(robot->name, "Robot"); printf("Robot Weight: "); scanf("%d", &robot->weight); if (ro..

keyme
'System Hacking Advanced' 카테고리의 글 목록 (4 Page)