ASLR/DEP -enabled 2.4.0 Windows installer available
Hi,
There's now a 2.4.0 Windows installer where all executables and libraries have ASLR/DEP enabled:
<https://build.openvpn.net/downloads/temp/openvpn-install-2.4.0-I602-aslr-dep.exe>
<https://community.openvpn.net/openvpn/ticket/325>
I ran the installer through the Windows test suite and did not encounter any obvious issues.
More testing would be welcome - especially on 32-bit Windows - before we make this the default.
Samuli
Quoted 5 lines · Samuli Seppänen
Hi,
There's now a 2.4.0 Windows installer where all executables and libraries have ASLR/DEP enabled:
Quoted 8 lines
<https://build.openvpn.net/downloads/temp/openvpn-install-2.4.0-I602-aslr-dep.exe>
<https://community.openvpn.net/openvpn/ticket/325>I ran the installer through the Windows test suite and did not encounter any obvious issues.
More testing would be welcome - especially on 32-bit Windows - before we make this the default.
I have tested this on Win10Pro x86_64 as server and concurrent client. For 24 hours .. so far without error.
Task manager shows DEP enabled while Windows is configured for DEP on Windows processes only but the machine has Hardware enabled DEP and shows DEP for 2.4.0-i601 as well . so not a very good test.
I don't have a 32bit windows compatible with 2.4
Regards.
Il 19/01/2017 22:46, debbie10t ha scritto:
Quoted 19 lines · Samuli Seppänen
Quoted 5 lines
Hi,
There's now a 2.4.0 Windows installer where all executables and libraries have ASLR/DEP enabled:
Quoted 8 lines
<https://build.openvpn.net/downloads/temp/openvpn-install-2.4.0-I602-aslr-dep.exe>
<https://community.openvpn.net/openvpn/ticket/325>I ran the installer through the Windows test suite and did not encounter any obvious issues.
More testing would be welcome - especially on 32-bit Windows - before we make this the default.
I have tested this on Win10Pro
x86_64as server and concurrent client. For 24 hours .. so far without error.
Quoted 7 lines
Task manager shows DEP enabled while Windows is configured for DEP on Windows processes only but the machine has Hardware enabled DEP and shows DEP for 2.4.0-i601 as well . so not a very good test.
I don't have a 32bit windows compatible with 2.4
Regards.
Thanks for testing! I think we just have to merge the ASLR/DEP change in openvpn-build and see what happens.
Signature · 5 lines
Samuli Seppänen Community Manager OpenVPN Technologies, Inc irc freenode net: mattock
Quoted 11 lines · Samuli Seppänen
Quoted 7 lines
Task manager shows DEP enabled while Windows is configured for DEP on Windows processes only but the machine has Hardware enabled DEP and shows DEP for 2.4.0-i601 as well . so not a very good test.
I don't have a 32bit windows compatible with 2.4
Regards.
Thanks for testing! I think we just have to merge the ASLR/DEP change in openvpn-build and see what happens.
For ASLR we may have to add some option to get reloc information into the exe? As per discussion under GUI PR 123 (
https://github.com/OpenVPN/openvpn-gui/pull/123) mingw does not do this by default. There --export-all-symbols is used, which I think is a terrible hack.
Checking aslr is enabled or not using process explorer may help -- openssl dll has to be checked too.
Selva
Hi,
Quoted 6 lines · Selva Nair
On Fri, Jan 20, 2017 at 9:43 AM, Samuli Seppänen <[email protected]...>
Quoted 4 lines
wrote:
Thanks for testing! I think we just have to merge the ASLR/DEP change in openvpn-build and see what happens.
Quoted 8 lines
For ASLR we may have to add some option to get reloc information into the exe? As per discussion under GUI PR 123 (https://github.com/OpenVPN/
openvpn-gui/pull/123) mingw does not do this by default. There --export-all-symbols is used, which I think is a terrible hack.Checking aslr is enabled or not using process explorer may help -- openssl dll has to be checked too.
Checked this on win7. Process explorer shows ASLR flag is set on the executable. But ASLR is not really active. The GUI is loaded at the same address each time (as per vmmap from sysinternals). I see no address randomization.
Recompiling by exporting at least one function fixes this so the linker is indeed not adding reloc section to the exe otherwise.
The build option does make ASLR work for openssl dll so the only thing missing there was the flag in the header. Not so for the executables.
We need to find some fix for this, else I fear this will be ASLR in name only.
Selva
Il 21/01/2017 05:11, Selva Nair ha scritto:
Quoted 30 lines
Hi,
On Fri, Jan 20, 2017 at 11:42 AM, Selva Nair <[email protected]... <mailto:[email protected]...>> wrote:On Fri, Jan 20, 2017 at 9:43 AM, Samuli Seppänen <[email protected]... <mailto:[email protected]...>> wrote:
Thanks for testing! I think we just have to merge the ASLR/DEP change in
openvpn-build and see what happens.For ASLR we may have to add some option to get reloc information into the exe? As per discussion under GUI PR 123
(https://github.com/OpenVPN/openvpn-gui/pull/123
<https://github.com/OpenVPN/openvpn-gui/pull/123>) mingw does not do this by default. There --export-all-symbols is used, which I think is a terrible hack.Checking aslr is enabled or not using process explorer may help -- openssl dll has to be checked too.
Checked this on win7. Process explorer shows ASLR flag is set on the executable. But ASLR is not really active. The GUI is loaded at the same address each time (as per vmmap from sysinternals). I see no address randomization.
Recompiling by exporting at least one function fixes this so the linker is indeed not adding reloc section to the exe otherwise.
Quoted 7 lines
The build option does make ASLR work for openssl dll so the only thing missing there was the flag in the header. Not so for the executables.
We need to find some fix for this, else I fear this will be ASLR in name only.
Selva
So we need a small code change in OpenVPN to get ASLR actually working, like in OpenVPN GUI?
<https://github.com/OpenVPN/openvpn-gui/pull/123/>
In particular something like this:
<https://github.com/OpenVPN/openvpn-gui/pull/123/files#diff-2045016cb90d1e65d71c2407a2570927R72>
Correct?
Signature · 5 lines
Samuli Seppänen Community Manager OpenVPN Technologies, Inc irc freenode net: mattock
Hi,
Quoted 21 lines · Samuli Seppänen
Quoted 9 lines
Checked this on win7. Process explorer shows ASLR flag is set on the executable. But ASLR is not really active. The GUI is loaded at the same address each time (as per vmmap from sysinternals). I see no address randomization.
Recompiling by exporting at least one function fixes this so the linker is indeed not adding reloc section to the exe otherwise.
Quoted 8 lines
The build option does make ASLR work for openssl dll so the only thing missing there was the flag in the header. Not so for the executables.
We need to find some fix for this, else I fear this will be ASLR in name only.
Selva
So we need a small code change in OpenVPN to get ASLR actually working, like in OpenVPN GUI?
Quoted 8 lines
<https://github.com/OpenVPN/openvpn-gui/pull/123/>
In particular something like this:
<https://github.com/OpenVPN/openvpn-gui/pull/123/files#diff-
2045016cb90d1e65d71c2407a2570927R72>Correct?
There are many suggestions online including add --export-all-symbols to LDFLAGS, mark main() with dllexport etc. I thought --export-all-symbols is an overkill and suggested to just export a dummy variable for the GUI.
I don't fully understand how ASLR is implemented on Windows but my tests show code, stack, heap and PEB addresses are randomized if dynamicbase flag is on and there is a .reloc section in the exec (ld appears to add this only if something is exported). So I can only say this works, not sure its the best workaround.
I wrote a small program to see ASLR in action: it prints some representative pointers to code, stack, heap etc to see how they change between runs. The program and test results are here <
https://gist.github.com/selvanair/c8ffa0fe60710e05c0e38f7d0097468d>
Selva