본문 바로가기

unshorted bin

(3)
[Wargame] uaf_overwrite 1. 실습 코드 C 코드, 바이너리 파일, libc-2.27.so가 주어진다. // Name: uaf_overwrite.c // Compile: gcc -o uaf_overwrite uaf_overwrite.c #include #include #include #include struct Human { char name[16]; int weight; long age; }; struct Robot { char name[16]; int weight; void (*fptr)(); }; struct Human *human; struct Robot *robot; char *custom[10]; int c_idx; void print_name() { printf("Name: %s\n", robot->name); } ..
[Practice] Use After Free 1. Use After Free (UAF) 해제된 메모리에 접근할 수 있는 취약점으로, 메모리에 남아있던 데이터를 유출하거나 사용할 수 있다. 참고 : 2022.08.20 - [Dreamhack/Lecture & Practice] - [Lecture] Use After Free 2. 실습 코드 // Name: uaf_overwrite.c // Compile: gcc -o uaf_overwrite uaf_overwrite.c #include #include #include #include struct Human { char name[16]; int weight; long age; }; struct Robot { char name[16]; int weight; void (*fptr)(); }; struct ..
Malloc(2) - Bin (glibc의 ptmalloc2) 1. Bin Free chunk는 크기와 히스토리에 따라 다양한 목록에 저장되는데, 이를 "bins"라고 한다. 할당자는 할당 요청을 충족시키기 위해, 적합한 청크를 bins에서 신속하게 찾아 재할당한다. 종류 : Fast bin, Small bin, Large bin, Unsorted bin 2. Fast bin "fastbin"에 포함되는 chunk크기의 범위는 0 ~ 80*sizeof(size_t)/4까지이다. M_MXFAST(1)라는 매개변수를 사용해서 "fastbin"에 포함되는 chunk 범위를 설정한다. "fastbin"의 기본 범위는 0 ~ 64*sizeof(size_t)/4이다. 32bit : 64byte (64 * 4/4) 64bit : 128byte (64 * 8/4) 해당 크기보다 ..