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 Region | Whatβs Randomized | Example |
|---|---|---|
| Executable base | Programβs load address | /bin/bash loads at different addresses each run |
| Stack | Stack start address | Prevents predictable stack-smashing offsets |
| Heap | Heap base | Stops heap spraying reliability |
| Shared libraries | libc, etc. | Mapped at different offsets each run |
ASLR Compliance Meaning
Being ASLR compliant means:
- The OS supports ASLR, and
- 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
/DYNAMICBASElinker 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
0ASLR disabled1Conservative randomization2Full randomization
With value 1, Linux randomizes these user-space memory areas:
| Memory area | Randomized with value 1? | Notes |
|---|---|---|
| mmap base address | Yes | Affects shared libraries and memory mappings created with mmap() |
| Shared libraries | Yes | Because shared libraries are usually loaded through mmap() |
| Stack | Yes | Main thread stack location is randomized |
| VDSO page | Yes | Kernel-provided virtual syscall page is randomized |
| Heap / brk area | Usually No | Full 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