ASLR (Address Space Layout Randomization)

ASLR (Address Space Layout Randomization) is a security feature that randomizes the memory addresses used by key data areas of a process — such as the stack, heap, libraries, and executable code.

🔍 Purpose:

To make it harder for attackers to predict memory locations during an exploit (e.g., buffer overflow, return-oriented programming).

Without ASLR, attackers can rely on fixed addresses to inject or jump to malicious code.
With ASLR, every reboot or process restart changes memory layout, invalidating most static exploits.

How ASLR Works

Memory RegionWhat’s RandomizedExample
Executable baseProgram’s load address/bin/bash loads at different addresses each run
StackStack start addressPrevents predictable stack-smashing offsets
HeapHeap baseStops heap spraying reliability
Shared librarieslibc, etc.Mapped at different offsets each run

ASLR Compliance Meaning

Being ASLR compliant means:

  1. The OS supports ASLR, and
  2. The application, driver, or firmware image is built and linked to use ASLR.

In other words:

The binary and its runtime environment both must support and not disable ASLR.

Windows

  • ASLR is enabled system-wide via /DYNAMICBASE linker flag.
  • You can verify by running:

dumpbin /headers myapp.exe | find "Dynamic base"

→ If Dynamic base is listed → ASLR enabled.

Policies: Controlled via Exploit Protection or Group Policy.

Windows 10+ also support Force ASLR for all executables.

Linux

  • Controlled via /proc/sys/kernel/randomize_va_space
    • Value Meaning
    • 0 ASLR disabled
    • 1 Conservative randomization
    • 2 Full randomization

With value 1, Linux randomizes these user-space memory areas:

Memory areaRandomized with value 1?Notes
mmap base addressYesAffects shared libraries and memory mappings created with mmap()
Shared librariesYesBecause shared libraries are usually loaded through mmap()
StackYesMain thread stack location is randomized
VDSO pageYesKernel-provided virtual syscall page is randomized
Heap / brk areaUsually NoFull heap randomization needs value 2

randomize_va_space = 1
stack + mmap/libs + VDSO randomized

randomize_va_space = 2
stack + mmap/libs + VDSO + heap/brk randomized

About the Author

Yogi

24 years of experience in various layers of software. Primarily experienced in system side software design and development on server management software. Interested in linux development in x86 and arm architecture.