Explore our new Cybersecurity Terms Glossary, explained by our experts.

View the Glossary View the Glossary
PRIVIA

Cybersecurity Terms Glossary

What Are ASLR and DEP?

ASLR randomises where code and data land in memory, while DEP marks data pages non-executable. Together they turn most memory corruption bugs from reliable exploits into crashes.

Illustration for the cybersecurity term ASLR and DEP
Home / Blog / Cybersecurity Terms / What Are ASLR and DEP?
17 November 2026

What Are ASLR and DEP?

What Are ASLR and DEP?

Two mitigations shipped two decades ago still do most of the work that stands between a memory corruption bug and a working exploit. Data Execution Prevention marks memory that holds data as non-executable, so a payload written onto the stack or the heap cannot simply be jumped to. Address Space Layout Randomisation moves the pieces of a process to unpredictable addresses at load time, so an attacker cannot hard-code where anything is. Neither fixes the underlying bug. Both raise the cost of weaponising it enormously.

DEP and the NX Bit

DEP is a hardware feature exposed by the operating system. AMD introduced the NX bit in 2003 and Intel followed with XD; the processor refuses to fetch instructions from a page marked as data. Microsoft enabled DEP in Windows XP Service Pack 2 in 2004, and Linux had equivalent support through PaX and later the mainline kernel.

The practical effect is that the classic exploit of the 1990s stopped working. A buffer overflow that places shellcode in a stack buffer and redirects execution to it now triggers an access violation instead. The compiler side matters too: a binary must be linked with /NXCOMPAT on Windows, and on Linux the GNU stack note must not request an executable stack. Just-in-time compilers are the awkward exception, because they legitimately generate code at runtime and must map pages writable then executable, which is why hardened JIT engines now use dual mappings and W^X policies.

What ASLR Randomises

ASLR shifts the base address of the executable image, the loaded libraries, the heap, the stack, and on Linux the mmap region. The PaX project shipped the first implementation in 2001; Windows gained it in Vista in 2007 and macOS followed in 10.5. Modern kernels randomise their own layout too, under the name KASLR.

The protection is statistical and depends entirely on entropy. A 32-bit Windows process historically had around 8 bits of randomness for library bases, meaning one guess in 256 succeeded and a service that restarts after a crash could be brute-forced in minutes. On 64-bit systems the figure rises to 17 to 30 bits depending on platform and region, which makes guessing impractical. The catch is that ASLR is per-module on Windows: one executable or DLL linked without /DYNAMICBASE sits at a fixed address and hands the attacker a reliable anchor. Force ASLR and Mandatory ASLR in Exploit Protection exist to cover exactly that case. On Linux, a binary must be compiled as a position-independent executable for the main image to move at all.

How Attackers Get Past Them

These mitigations are defeated together rather than separately, and the standard route is an information disclosure followed by code reuse.

What to Check on Your Estate

Both controls are effectively free and are frequently switched off by accident. On Windows, confirm that Exploit Protection has DEP, Mandatory ASLR, and Bottom-up ASLR enabled system wide, and audit third-party software for modules missing /DYNAMICBASE or /NXCOMPAT using a tool such as Microsoft’s BinSkim. On Linux, check that kernel.randomize_va_space is set to 2 and that your own builds use -fPIE -pie, -Wl,-z,noexecstack, and -Wl,-z,relro,-z,now.

Then add the generation that followed: Control Flow Guard and Intel CET shadow stacks on Windows, pointer authentication on ARM, and stack canaries everywhere. Our Penetration Test Services include build configuration reviews that report which of your binaries ship without these flags.

FAQ – Frequently Asked Questions

Do ASLR and DEP Fix Memory Safety Bugs?

No. They are exploit mitigations, not fixes. The underlying overflow or use-after-free is still present and still causes memory corruption; the mitigations make it far harder to turn that corruption into reliable code execution, and the usual outcome becomes a crash instead. Patching the defect, or moving the component to a memory-safe language, remains the actual remedy.

Why Does One Unprotected DLL Matter?

Because ASLR is applied per module on Windows. If a single library in the process loads at a fixed address, every gadget inside it is at a known location, which gives an attacker the predictable anchor needed to build a return-oriented programming chain. Mandatory ASLR can force relocation of such modules, though it fails for binaries stripped of relocation data.

Is DEP Enough on Its Own?

Not against a competent attacker. DEP stops injected shellcode but not code reuse, and return-oriented programming exists precisely to work within it. DEP only becomes effective when combined with ASLR, so the attacker cannot locate the gadgets, and with control flow integrity, so the chain cannot be assembled even when addresses are known.

How Do I Verify These Mitigations Are Active?

On Windows, the Exploit Protection pane in Windows Security shows the system-wide settings, and Process Explorer or the Get-ProcessMitigation cmdlet reports per-process status. For individual binaries, BinSkim and dumpbin report the DYNAMICBASE and NXCOMPAT flags. On Linux, read kernel.randomize_va_space from sysctl and run checksec or hardening-check against each binary.

Related Terms

You May Be Interested In These

What Is Checkov?

Cybersecurity Terms

17 November 2026

What Is Checkov?

Read More
What Is Malware?

Cybersecurity Terms

17 November 2026

What Is Malware?

Read More
What Skills Does a Forensics Examiner Need?

Cybersecurity Terms

17 November 2026

What Skills Does a Forensics Examiner Need?

Read More