snappy-java icon indicating copy to clipboard operation
snappy-java copied to clipboard

Enable ASLR and DEP on snappyjava.dll

Open djelinski opened this issue 3 years ago • 2 comments

ASLR is a technique designed to make various types of buffer overruns more difficult to exploit, by moving segments around a bit. The stack could be shifted a few bytes (or pages), the sections of your program (and even the libraries your code uses) can be loaded at different addresses, etc.

Data Execution Prevention (DEP) is a security feature that can help prevent damage to your computer from viruses and other security threats. DEP can help protect your computer by monitoring your programs to make sure that they use system memory safely.

ASLR and DEP are not enabled on snappyjava.dll files contained in jar downloaded from mavencentral:

PS D:\test> Import-Module .\Get-PESecurity.psm1
PS D:\test> get-pesecurity -file .\snappyjava.dll


FileName         : D:\test\snappyjava.dll
ARCH             : AMD64
DotNET           : False
ASLR             : False
DEP              : False
Authenticode     : False
StrongNaming     : N/A
SafeSEH          : N/A
ControlFlowGuard : False
HighentropyVA    : False

djelinski avatar Aug 30 '21 06:08 djelinski

Do you mean adding -Wl,dynamicbase, -Wl,nxcompat compiler flags?

xerial avatar Oct 01 '23 04:10 xerial

I think so; these two, and also -Wl,--high-entropy-va.

djelinski avatar Oct 01 '23 05:10 djelinski