본문 바로가기

pwnable/heap3

house of botcake how2heap에 있는 코드를 보자 static uint64_t victim = 0; int main() { setbuf(stdin, NULL); setbuf(stdout, NULL); char *x[7]; for(int i=0; i 이제 임의의 주소로 할당 가능 malloc(0x100); // b 할당됨 char *target = malloc(0x100); //적어준 임의의 주소 할당!!! printf("Before attack, victim's value: 0x%lx\n", victim); *(uint64_t*)target = 0xdeadbeef; printf("After attack, victim's value: 0x%lx\n", victim); return 0; } 디버깅을 해보자! 힙주소 7개를.. 2021. 2. 10.
how2heap - fastbin_dup into stack 저번에 fastbin_dup를 봤는데 이제 fastbin_dup에서 조금 업그레이드 된 fastbin dup into stack을 번역하면서 따라가 보도록 하자. 먼저 코드를 보자 int main() { fprintf(stderr, "This file extends on fastbin_dup.c by tricking malloc into\n" "returning a pointer to a controlled location (in this case, the stack).\n"); unsigned long long stack_var; fprintf(stderr, "The address we want malloc() to return is %p.\n", 8+(char *)&stack_var); fprintf.. 2018. 9. 13.
how2heap - fastbin_dup 미루고 미뤘던 힙 공부를 하는데 아무리 다른 블로그들을 봐도 그냥 how2heap 번역이랑 malloc.c 분석이 가장 도움이 될거 같아서 how2heap 번역을 한다.... 그래서 그나마 젤 쉬운 fastbin_dup에 관해서 한번 봐 보려고 한다. fastbin은 32bit는 64byte 까지, 64bit는 128byte까지의 크기를 가진다.스택처럼 LIFO 방식을 사용하며 단일 연결리스트로 이루어져 있다. int main() { fprintf(stderr, "This file demonstrates a simple double-free attack with fastbins.\n"); fprintf(stderr, "Allocating 3 buffers.\n"); int *a = malloc(8); i.. 2018. 9. 12.