Mar 6, 2016 02:06 AM
(This post was last modified: Mar 6, 2016 02:16 AM by Ozedath.)
This thread is a continuation of this one:
https://hackforums.net/showthread.php?tid=5193244
In the following code:
Why isn't the stub size computed correctly?
The dwStubSize is 0xffffff56, for example, for _end being loaded at 0x00d515a0 and _xor_block at 0x00d51450.
Why isn't the correct value of the difference being set?
https://hackforums.net/showthread.php?tid=5193244
In the following code:
Code
void _xor_block(unsigned char *pblock, unsigned int blocksize)
{
unsigned int i;
for(i = 0; i < blocksize; i++)
pblock[i] ^= i;
return;
}
int _xor_chunk(unsigned char* pchunk, unsigned long chunksize, unsigned int blocksize)
{
if(chunksize % blocksize || blocksize % 8)
return -1;
unsigned long index = 0;
while(index < chunksize)
{
_xor_block(pchunk + index, blocksize);
index += blocksize;
}
return 0;
}
__declspec(naked) void __stdcall _stub(void)
{
__asm
{
push 0xFEFEFEFE //blocksize
push 0xFDFDFDFD //chunksize
push 0xFCFCFCFC //pchunk
call _xor_chunk //decrypt
mov eax, 0x7FFFFFFF //oep
jmp eax //go go
}
}
__declspec(naked) int _end(void)
{
__asm ret 8
}Why isn't the stub size computed correctly?
Code
DWORD dwStubSize = (DWORD) _end - (DWORD) _xor_block;The dwStubSize is 0xffffff56, for example, for _end being loaded at 0x00d515a0 and _xor_block at 0x00d51450.
Why isn't the correct value of the difference being set?


