Home Upgrade Search Memberlist Extras Hacker Tools Award Goals Help Wiki Contact

C 

Computing the stub size of a crypter

You're a fucking dumb ass.
size of _xor_block function = (DWORD) _end < address of _end function - (DWORD) _xor_block < address of _xor_block function;
You don't need to disable optimisation. You can simple use the noinline attribute.
Regardless if padding is applied, he's getting a negative distance, 0xffffff56

You're running this with debugging mode, therefore it's not actually pointing at a function, it's pointing at a relative JMP instruction.
To avoid this run it in release mode or by disabling incremental linking. (Be careful, when disabling incremental linking the code structure will not be aligned, you'd have to enable optimization and modify reference settings, it's alot of unnecessary setting configurations)
Code
Link Incrementally is not selected (/INCREMENTAL:NO)
/OPT:REF is selected
/OPT:ICF is selected
/OPT:LBR is selected
/ORDER is selected

For example

printing &_end in debugging mode, won't actually be the &end function, rather an address that executes a relative jmp instruction to your function.


I'd leave the incremental linking to default settings and use this function on debugging mode, possibly with some optimization:

Code
__declspec(naked) unsigned long _end()
{
    __asm
    {
        call foo
foo:
        pop eax
        sub eax, 5+_xor_block
        ret
    }
}

printf("%2X\n", _end());
if he need to use return then he can define it as unsigned int


Possibly Related Threads...
Thread / Author Replies Views Last Post
[C] by sonnyJul 2, 2021 02:17 PM 0 223 Jul 2, 2021 02:17 PM
Last Post: sonny
[.NET] by Alx0Dec 17, 2018 09:28 AM 7 201 Dec 17, 2018 09:28 AM
Last Post: Nick (Name)
[C] by Das KartoffelJan 13, 2017 06:48 PM 9 281 Jan 13, 2017 06:48 PM
Last Post: aeiro