Linkers, Loaders & Executables

What is the purpose of ASLR (address space layout randomization)?

  1. ATo change the addresses of the stack, heap, libraries and so on every run, making target addresses hard for attackers to predict
  2. BTo pick memory addresses at random to raise the cache hit rate
  3. CTo free unused memory at random to increase free space
Show answer and explanation

Answer: A. To change the addresses of the stack, heap, libraries and so on every run, making target addresses hard for attackers to predict

Attacks that exploit bugs such as buffer overflows depend on knowing the addresses of library functions or data on the stack. ASLR shifts where the stack, heap, shared libraries and the executable are placed every time a process starts, so attackers cannot hard-code addresses. It is not a complete defence on its own and is combined with other measures such as separating writable and executable memory.

  • A. Correct. It is a countermeasure that makes attacks harder.
  • B. It is not a performance feature.
  • C. It does not free memory.
Practice this topic Back to topic

More Linkers, Loaders & Executables questions

  1. What is the main reason to build an executable as a PIE (position-independent executable)?
  2. What does the OS loader do when a program is started (for example by execve on Linux)?
  3. In a C program, which statement is correct about the address where the OS first starts execution (the entry point)?
  4. When a C main function ends with "return 3;", what generally happens to the value 3?
  5. What happens when the strip command is applied to an executable?