House of Spirit
Last updated
Last updated
Learn & practice AWS Hacking:HackTricks Training AWS Red Team Expert (ARTE) Learn & practice GCP Hacking: HackTricks Training GCP Red Team Expert (GRTE)
Be able to add into the tcache / fast bin an address so later it's possible to allocate it
This attack requires an attacker to be able to create a couple of fake fast chunks indicating correctly the size value of it and then to be able to free the first fake chunk so it gets into the bin.
Create fake chunks that bypasses security checks: you will need 2 fake chunks basically indicating in the correct positions the correct sizes
Somehow manage to free the first fake chunk so it gets into the fast or tcache bin and then it's allocate it to overwrite that address
The code from guyinatuxedo is great to understand the attack. Although this schema from the code summarises it pretty good:
Note that it's necessary to create the second chunk in order to bypass some sanity checks.
CTF https://guyinatuxedo.github.io/39-house_of_spirit/hacklu14_oreo/index.html
Libc infoleak: Via an overflow it's possible to change a pointer to point to a GOT address in order to leak a libc address via the read action of the CTF
House of Spirit: Abusing a counter that counts the number of "rifles" it's possible to generate a fake size of the first fake chunk, then abusing a "message" it's possible to fake the second size of a chunk and finally abusing an overflow it's possible to change a pointer that is going to be freed so our first fake chunk is freed. Then, we can allocate it and inside of it there is going to be the address to where "message" is stored. Then, it's possible to make this point to the scanf
entry inside the GOT table, so we can overwrite it with the address to system.
Next time scanf
is called, we can send the input "/bin/sh"
and get a shell.
Gloater. HTB Cyber Apocalypse CTF 2024
Glibc leak: Uninitialized stack buffer.
House of Spirit: We can modify the first index of a global array of heap pointers. With a single byte modification, we use free
on a fake chunk inside a valid chunk, so that we get an overlapping chunks situation after allocating again. With that, a simple Tcache poisoning attack works to get an arbitrary write primitive.
Learn & practice AWS Hacking:HackTricks Training AWS Red Team Expert (ARTE) Learn & practice GCP Hacking: HackTricks Training GCP Red Team Expert (GRTE)