본문 바로가기

Pwnable

(47)
pwn | dart master write up 보호되어 있는 글입니다.
pwn | building owner write up 보호되어 있는 글입니다.
combination 보호되어 있는 글입니다.
normal_malloc 보호되어 있는 글입니다.
[DreamHack] basic_exploitation_003 Write-Up NX 보호 기법이 켜져있다. 쉘 코드가 실행되지 않다는 뜻이다. Partial RELRO이므로 GOT Overwrite 가 가능하다.#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);}void get_shell() { system("/bin/sh");}int main(int argc, char *argv[]) { char *heap..
[DreamHack] format string bug Write-Up 문서화 기반 : Exploit Tech: Format String Bug | Dreamhack  PIE가 활성화되어 있다.PIE로 인해 코드영역의 주소가 계속 바뀌니까 changeme의 주소도 계속 바뀐다.// Name: fsb_overwrite.c// Compile: gcc -o fsb_overwrite fsb_overwrite.c#include #include #include void get_string(char *buf, size_t size) { ssize_t i = read(0, buf, size); if (i == -1) { perror("read"); exit(1); } if (i 0 && buf[i - 1] == '\n') i--; buf[i] = 0; }}int..
[DreamHack] PIE, RELRO, Out of Bounds Keywords && Quiz Position Independent Executable (PIE) 상대 참조(Relative Addressing): 어떤 값을 기준으로 다른 주소를 지정하는 방식Position Independent Code (PIC): 어떤 주소에 매핑되어도 실행 가능한 코드. 절대 주소를 사용하지 않으며 일반적으로 rip를 기준으로 한 상대 주소를 사용함.Position Independent Executable (PIE): 어떤 주소에 매핑되어도 실행 가능한 실행 파일. PIE의 코드는 모두 PIC이다. 자체적으로 보호 기법은 아니지만 ASLR이 적용된 환경에서는 시스템을 더욱 안전하게 만드는 효과가 있음. 최신 gcc는 기본적으로 PIE 컴파일을 함.Partial Overwrite: 어떤 값을 일부분만 덮는 공격 ..
[DreamHack] Out of bound Write-Up ASLR이 적용되어 있고, 바이너리에는 NX와 Canary가 적용되어 있고, PIE는 적용 XASLR이 적용되어 있기 때문에 실행 시마다 스택, 라이브러리 등의 주소가 랜덤화NX가 적용되어 있기 때문에 임의의 위치에 셸코드를 집어넣은 후 그 주소의 코드를 바로 실행 XCanary가 적용되어 있기 때문에 스택 맨 위에 존재하는 SFP, RET과 그 뒷 주소 변경불가PIE가 적용되지 않기 때문에 해당 바이너리가 실행되는 메모리 주소가 랜덤화 X (=데이터 영역의 변수들은 항상 정해진 주소에 할당된다.) 문제 코드#include #include #include #include #include char name[16];char *command[10] = { "cat", "ls", "id", "p..