Memory Safety and Violations Flashcards
\what do hardening techniques need to be?
reliable and fast
What does a NX bit do?
block execution of writable sections on a hardware level
What do stack canaries do?
> generate random value (x)
when a function is called, save x on the stack
when the function returns, check if x has been tampered with
What are the advantages of stack canaries?
they are fast, reliable and ominous
What does ASLR stand for?
Address Space Layout Randomization
How do ASLRs work?
> add a random offset to data sections / dynamic libraries
> for a ret2libc, the attacker needs to know x
What are the advantages of ASLR?
fast, reliable, ominous
What do hardening techniques aim to do?
Bock an attack in case of a memory vulnerability.
What is full memory safety a combination of?
Spatial Memory Safety and Temporal Memory Safety
What is the principle of memory safety in space?
code should never read or write outside the memory area
What is the principle of memory safety in time?
memory should not be accessed before or after its lifetime
Explain a simplified process start
> place binary sections in memory
create a stack
main() starts
What pointers does a stack use?
stack pointer at the end, base pointer at the start
How does call work?
> saves location of last instruction
saves base pointer
sets base pointer to stack pointer
goes to start of new function
Give a quick summary of hacking the stack
> stack overflow
overwrite saved instruction pointer
attacker can choose what code executes next