Processes
Intel CPU Registers
rax -> for values to return
rbx -> base addressing
rbp -> base pointer
rsp -> stack pointer
Memory Layout: The Stack in x64
... 8th parameter 7th parameter return address saved rbp local variables red zone ...
Buffer Overflow: Code Execution
- Saved rip will blindly be interpreted as address to return to upon ret
NOP sleds
- write many nop’s and then hopefully code is executed
Canaries
- before ret compare to actual canary
Random Canaries, Terminator Canaries
Limitations of Stack Canaries
Non-Executable Stack
Shadow Stack
Format Strings Attack
- with input as %p (pointers) %n (stores data on stack) we can manipulate
Code-Reuse Attacks
Address Space Layout Randomization (ASLR)
Fine-Grained ASLR
- shuffles instructions within a function
JIT-ROP
- uses JIT environment to read code pages and find pointer etc.
Execute-no-Read
Control Flow Integrity CFI
Uninitialized Stack Variables
Overwriting Function Pointers
Use-after-Free (Dangling Pointers)