comex/inject_and_interpose — Issue #6: 32 bit injection process cannot inject 64 bit process and vice versa
Author: rtibdewal
Created: 2011-11-02 16:22:47+00:00
State: open

Hello there,

In file, Inject.c

static kern_return_t get_stuff(task_t task, cpu_type_t *cputype, struct addr_bundle *addrs) {

...
#if defined(__i386__) || defined(__x86_64__) || defined(__ppc__)
// Try to guess whether the process is 64-bit,
bool proc64 = info.all_image_info_addr > 0;
#else
bool proc64 = false;
#endif
mach_vm_address_t dyldImageLoadAddress = proc64 ? u.data64.dyldImageLoadAddress : u.data.dyldImageLoadAddress;

...

}

Above code gives wrong result and thus injection fails at mach_vm_read_overwrite();

I think check for #if defined(__i386__) || defined(__x86_64__) || defined(__ppc__)
is wrong as it will check whether injection process is 64 bit or 32 bit or ppc. It wont check whether task(injectee process) is 32 bit or 64 bit.