Binary Exploitation

Binary exploitation is the act of attacking compiled programs.

The information here will be written for Linux x86/x86-64 unless something else is specified. It's also in progress.

Topics
  • Stack
  • Stack Guards
  • Buffer Overflow
  • ROP
  • Heap


Good To Know

An important thing to remember is that the CPU is quite basic and doesn't know if a memory location is a string or a number. Therefore a specific number may be read in other pieces of code as text. This goes both ways.

Stack

The stack is a way to interact with memory and is an integral part of the processors runtime.
It's used by the processor to remember where to return after a function call, and other variables/information locally stored in a function.

The stack is essentially normal memory (as far as I know). There is a register/variable in the processor that tracks the current top stack position in memory. This is tracked by the RSP register on 64-bit x86 systems and ESP on 32-bit (SP -> Stack Pointer)

There is also a register named RBP/EBP (BP -> Stack Base Pointer). This tracks the base memory location of the current stack frame. A stack frame is a collection of information on the stack related to a particular function call.

Stack Guards

Stack guards is a security mechanism used by some compilers to decrease the impace of buffer overflow attacks.