The Heap

Memory Heap

  • A portion of memory where dynamically allocated memory (with malloc) resides
  • Data in the program's stack lives until freed or the program is terminated
  • If all references to allocated memory are lost, you have what is called a memory leak

Global Offset Table

  •  A section of a computer program's memory used to enable computer program code compiled as an ELF file to run correctly
  • It maps symbols in programming code to their corresponding absolute memory addresses to facilitate Position Independent Code and Position Independent Executables which are loaded to a different memory address each time the program is started

Position-Independent Code

  • A body of machine code that, being placed somewhere in the primary memory, executes properly regardless of its absolute address
  • Position-independent code can be executed at any memory address without modification
  • Generating position-independent code is often the default behavior for compilers, but they may place restrictions on the use of some language features, such as disallowing use of absolute addresses

Heap Overflows

  • Just like in the stack but globally
  • Usually used to overwrite addresses in the GOT
  • Can lead to major program flow compromise

Use After Free

  • A class of memory corruption bugs that have been very successful in the world of browser exploitation
  • Use-After-Free vulnerabilities are a type of memory corruption flaw that can be leveraged by hackers to execute arbitrary code
  • Use After Free specifically refers to the attempt to access memory after it has been freed, which can cause a program to crash or, in the case of a Use-After-Free flaw, can potentially result in the execution of arbitrary code or even enable full remote code execution capabilities

Some practice now

The Heap

By Ivan Zlatanov

The Heap

  • 21