Hola a todos, estoy intentando desempaquetar un programa, este tiene
antidump,tengo la siguiente duda.
si voy a la Memoria del programa
dumpeado veo lo siguiente:
Memory map
Address Size Owner Section Contains Type Access Initial Mapped as
00010000 00001000 Priv RW RW
00020000 00001000 Priv RW RW
0012C000 00001000 Priv RW Guar RW
0012D000 00003000 stack of mai Priv RW Guar RW
00130000 00003000 Map R R
00140000 00001000 Priv RWE RWE
00150000 00006000 Priv RW RW
00250000 00006000 Priv RW RW
00260000 00003000 Map RW RW
00270000 00016000 Map R R \Device\HarddiskVolume1\WINDOWS\system32\unicode.nls
00290000 00041000 Map R R \Device\HarddiskVolume1\WINDOWS\system32\locale.nls
002E0000 00041000 Map R R \Device\HarddiskVolume1\WINDOWS\system32\sortkey.nls
00330000 00006000 Map R R \Device\HarddiskVolume1\WINDOWS\system32\sorttbls.nls
00340000 00041000 Map R R
00390000 00001000 Priv RW RW
003A0000 00001000 Priv RW RW
003B0000 00004000 Priv RW RW
si veo el programa
empaquetado veo lo siguiente:
Memory map
Address Size Owner Section Contains Type Access Initial Mapped as
00010000 00001000 Priv RW RW
00020000 00001000 Priv RW RW
0012C000 00001000 Priv RW Guar RW
0012D000 00003000 stack of mai Priv RW Guar RW
00130000 00003000 Map R R
00140000 00001000 Priv RWE RWE
00150000 0000A000 Priv RW RW
00250000 00006000 Priv RW RW
00260000 00003000 Map RW RW
00270000 00016000 Map R R \Device\HarddiskVolume1\WINDOWS\system32\unicode.nls
00290000 00041000 Map R R \Device\HarddiskVolume1\WINDOWS\system32\locale.nls
002E0000 00041000 Map R R \Device\HarddiskVolume1\WINDOWS\system32\sortkey.nls
00330000 00006000 Map R R \Device\HarddiskVolume1\WINDOWS\system32\sorttbls.nls
00340000 00041000 Map R R
00390000 00001000 Priv RW RW
003A0000 00001000 Priv RW RW
003B0000 00005000 Priv RW RW
el problema surge que el dumpeado intenta acceder al address:
00157E78 que lógicamente no está en el dumpeado, por lo que investigando debo liberar tal sección en la memoria con
VirtualFree y luego con
VirtualAlloc crearla nuevamente pero con el size correspondiente, luego de eso injertar lo que falta, el problema es que se cita lo siguiente:
en mi maquina la sección del
antidump empieza en 150000 y alli el sistema creo un heap y tiene valores
necesarios para correr el programa si solo borramos y copiamos lo del
antidump no correra
The VirtualFree function releases or decommits (or both) a region of pages within the virtual address space of the calling process.
BOOL VirtualFree(
LPVOID lpAddress, // address of region of committed pages
DWORD dwSize, // size of region
DWORD dwFreeType // type of free operation
);
The VirtualAlloc function reserves or commits a region of pages in the virtual address space of the calling process. Memory allocated by this function is automatically initialized to zero.
LPVOID VirtualAlloc(
LPVOID lpAddress, // address of region to reserve or commit
DWORD dwSize, // size of region
DWORD flAllocationType, // type of allocation
DWORD flProtect // type of access protection
);
hago el siguiente injerto(aquí mi duda):
push 4000
push ???????
push 150000
call VirtualFree
nop
push 4
push 2000
push ??????
push 150000
call VirtualAlloc
nop
push 4
push 1000
push ??????
push 150000
call VirtualAlloc
(el injerto lo tomé del tutorial de ricardo narvaja)
el problema es el
size no sé cuanto colocar, debido que no sé que es un
heap y cuanto espacio debo colocar y por qué ese espacio, otra cosa es por que se hace dos llamados a VirtualAlloc con diferencia en el parámetro
type of access protectionSi pudieran aclararme esas dudas de manera explicativa, se los agradecería demasiado,Saludos