1. fast chunk 2개 할당
2. 첫번째 fast chunk를 free
3. large bin size의 chunk 하나 할당
-malloc_consolidate()함수가 trigger되고, (2)번에서 free한게 unsorted bin으로 감.
-즉, (2)번에서 free한걸 한번 더 free해도 fastbin의 보호기법이 작동하지 않음.
-fast-top에서 unsorted bin으로 갔기 때문.
4. (2)번에서 free했던 chunk 한번 더 free (DFB)
5. 다음 두번의 malloc은 (2)번에서 free한 주소와 같음.
-unsorted bin에서 한번, fast bin에서 한번 꺼내서 총 두번까지 꺼내올 수 있음
1 2 3 4 5 6 7 8 9 10 11 12 13 | first = malloc(0x30) // malloc two fast chunk second = malloc(0x30) free(first) // fast bin third = malloc(0x100) // malloc one small chunk // now, first in unsorted bin free(first) // Double Free Bug!! fourth = malloc(0x30) // address first fifth = malloc(0x30) // address first | cs |
'System Hacking (pwnable) > ETC' 카테고리의 다른 글
[pwn] SROP(Sigreturn Return Oriented Programming) (0) | 2020.01.07 |
---|---|
[HackTheBox] Dream Diary : Chapter 1 ( write-up ) (0) | 2019.11.20 |
[pwn] _rtld_global overwrite ( _dl_fini overwrite ) (0) | 2019.11.09 |
[RootMe] Stack buffer overflow basic 1 ( write-up ) (0) | 2019.08.22 |
[Heap] fastbin dup-into stack (0) | 2019.08.01 |