
click
click
Home version features:
The Randomized Memory Allocations seem to be working fine, sample program:
{
char *p;
int i;
unsigned int espvalue;
_asm { mov [espvalue], esp }
printf("esp: %X\n", espvalue);
for ( i = 0; i < 7; i++) {
p = malloc(2000);
printf("%p\n", p);
}
}
Output:
C:\tmp>test
esp: 5708FED8
572F0758
572F0758
572F0758
572F0758
572F0758
572F0758
572F0758
C:\tmp>test
esp: 372CFED8
37510758
37510758
37510758
37510758
37510758
37510758
37510758
C:\tmp>test
esp: 4151FED8
41790758
41790758
41790758
41790758
41790758
41790758
41790758
C:\tmp>test
esp: 48CDFED8
48F70758
48F70758
48F70758
48F70758
48F70758
48F70758
48F70758
C:\tmp>
This was tested on a WinXP SP2. Running the test without wehntrust shows
the same addresses on every execution (for both esp and heap address).
I did not test PEB randomization because it is already done in XP SP2 and I
didn't care much for it anyways. You can observe that how randomization
is performed is pretty clear.
To test the "Randomized Image Files (DLLs, EXEs with relocations)" feature
I wrote this simple program:
void main()
{
printf("%x\n", LoadLibrary("kernel32.dll"));
printf("%x\n", LoadLibrary("ntdll.dll"));
printf("%x\n", LoadLibrary("advapi32.dll"));
printf("%x\n", LoadLibrary("wsock32.dll"));
printf("%x\n", GetModuleHandle(NULL));
}
Output:
C:\tmp>test3
1b0a0000
1ac30000
1b230000
1ddd0000
400000
C:\tmp>test3
1b0a0000
1ac30000
1b230000
1ddd0000
400000
C:\tmp>test3
1b0a0000
1ac30000
1b230000
1ddd0000
400000
The product documentation says it only randomizes PE files with relocations, and my
PE file (as almost any regular EXE PE file) does not have relocation info, so
getting 400000 for GetModuleHandle(NULL) is expected. For the other dlls, the
address shown is in fact not the default one for the dlls, but as you can see,
the address does not change on a per execution basis.