Explore our new Cybersecurity Terms Glossary, explained by our experts.
Cybersecurity Terms Glossary
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.

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 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.
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.
These mitigations are defeated together rather than separately, and the standard route is an information disclosure followed by code reuse.
ret, typically to call VirtualProtect or mprotect and make a data page executable after all.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.
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.
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.
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.
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.
You May Be Interested In These
We use a few cookies that are needed to make this website work, and they are always on. We would also like to set analytics cookies, to see which pages are useful; functional cookies, so that our live chat works; and advertising cookies, to measure our campaigns. We will not set any of those until you say yes, and you can change your mind at any time from the Cookie Settings link in the footer.
Choose the cookies you are happy for us to use. Strictly necessary cookies are always on; everything else is off until you turn it on.
These cookies keep the website working: they hold your security checks, your form submissions and the choice you make here. The site cannot run without them, so they are always on.
These let our live chat open and remember your conversation, and let the newsletter sign-up work. Switch them off and the chat window will not appear.
These tell us which pages are read and how people find us, so that we can improve the site. The reports are about groups of visitors, never about you personally.
These let us measure our advertising and show you our adverts on other websites, such as LinkedIn, Google and Meta. Switch them off and you will still see adverts, but they will be less relevant.