locked
How to enable Force ASLR in Visual Studio 2013 RRS feed

  • Question

  • So, the ability of a process to force ASLR on for all DLL's loaded into the process is a touted new feature in Windows 8.  According to...

    http://support.microsoft.com/kb/2639308

    there is a path for Windows 7 that can allow forced ASLR as well.  However, I can't find any documentation for Windows or Developer Studio on how to turn this feature on.  Does anyone know?  It's not just setting /DYNAMICBASE... that will work for a particular DLL, but not force every DLL in the process to load at a random address, ignoring the lack of the  /DYNAMICBASE switch.

    Thanks,

    Phil

    Friday, November 1, 2013 11:09 PM

Answers

  • It looks like there are three ways to force ASLR:

    1. For all processes with the specified name: MitigationOptions value under the Image File Execution Options Registry key, as documented in KB2639308.  Available in Windows 8 and in Windows 7 + KB2639308.
    2. For a child process: UpdateProcThreadAttribute with PROC_THREAD_ATTRIBUTE_MITIGATION_POLICY.  The attribute itself is available in Windows 7 but the ASLR settings appear to require Windows 8; I don't know whether installing KB2639308 on Windows 7 changes this.
    3. For the current process: SetProcessMitigationPolicy.  Available in Windows 8.  Not available in Windows 7 + KB2639308.
    Monday, November 4, 2013 6:35 PM

All replies

  • It looks like there are three ways to force ASLR:

    1. For all processes with the specified name: MitigationOptions value under the Image File Execution Options Registry key, as documented in KB2639308.  Available in Windows 8 and in Windows 7 + KB2639308.
    2. For a child process: UpdateProcThreadAttribute with PROC_THREAD_ATTRIBUTE_MITIGATION_POLICY.  The attribute itself is available in Windows 7 but the ASLR settings appear to require Windows 8; I don't know whether installing KB2639308 on Windows 7 changes this.
    3. For the current process: SetProcessMitigationPolicy.  Available in Windows 8.  Not available in Windows 7 + KB2639308.
    Monday, November 4, 2013 6:35 PM
  • Thanks ranta!
    Tuesday, August 5, 2014 9:43 PM