Software Security

Table of Contents

Temporal errors

Main types:

Use after free

Sometimes, program retains pointer to freed memory location (“dangling pointer”)

Future allocation/function call can re-use memory.

Sometimes, attacker can craft input to overwrite memory with own data:

  1. Program allocs buffer or variable X
  2. Program uses X to store some data
  3. Program frees X
  4. Program allocates buffer/variable Y overlapping with X
  5. Data written to Y also overwrites relevant part of X
  6. Program uses X, causing incorrect result

Useful to:

Double free

Free can’t efficiently check block validity

Uninitialized variables

Local variables and buffers not automatically initialized to zero. Instead, contain whatever data happened to be on stack/heap before they were allocated.

Sometimes, attacker can craft input to initialize variable;

  1. program allocates buffer/variable X
  2. program uses X to store some data under attacker control
  3. program frees X
  4. program allocs buffer/variable Y overlapping X
  5. program does not initialize (part of) Y, causing attacker’s data from X to remain there
  6. program uses Y causing incorrect result