분류 전체보기

Web Hacking Advanced

[dreamhack] Client Side Template Injection

문제풀이기존 XSS 문제 구성과 동일하다. bot을 대상으로 XSS payload를 전송해서 쿠키를 탈취하는 시나리오다. 차이점이라면 CSP가 걸려있고 bypass가 필요하다. @app.after_requestddef add_header(response): global nonce response.headers['Content-Security-Policy'] = f"default-src 'self'; img-src https://dreamhack.io; style-src 'self' 'unsafe-inline'; script-src 'nonce-{nonce}' 'unsafe-eval' https://ajax.googleapis.com; object-src 'none'" nonce = os...

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 > ..

keyme
'분류 전체보기' 카테고리의 글 목록 (9 Page)