0001-01-01
In Linux operating systems, the function prologue is the one in charge of creating the canary and adding it to the stack. The epilogue is the one in charge of comparing the canary.
Let’s see the stack layout:
[...] -> 0xffffffff
RET ADDRESS
BASE EBP
CANARY
VALUE -> 0x00000000
Canary is after base EBP and return address, in order to guard them both. Note: Canary first byte is always null byte -> The printf function cannot be exploited to leak the canary. Libc stores canary info in its own libc memory space, unless threads are created. In that case, the canary is independent per thread and each thread has its own stack canary.
