PointerSearcher-X icon indicating copy to clipboard operation
PointerSearcher-X copied to clipboard

Cannot inject process on macOS 13.4.1 on M1 device

Open leochou0729 opened this issue 1 year ago • 4 comments

Hello, I've been using this inject tool for a long time without any problem. https://github.com/LIJI32/MIP Recently I found that it cannot inject processes successfully on macOS 13.4 on M1 device, which would cause target processes to crash immediately. Then I came across your inject tool, but it also failed to inject and print this error: Error: Other("invalid file") Could you please take a look at this problem? Or would you like to contribute any fix to the MIP code? Thanks!

leochou0729 avatar Jul 07 '23 08:07 leochou0729

Can you make sure your file is an aarch64 dylib, and that the target process is also aarch64?

kekeimiku avatar Jul 07 '23 08:07 kekeimiku

Yes. I inject a demo dylib into the Finder process, which is arm64e. I also cannot inject into other arm64 processes. SIP is disabled on my system. The inject tool is code-signed with proper entitlements and run as root user.

leochou0729 avatar Jul 07 '23 09:07 leochou0729

I can launch the target process manually to load my dylib using the DYLD_INSERT_LIBRARIES environment variable, but I also need to inject running processes.

leochou0729 avatar Jul 07 '23 09:07 leochou0729

#include <stdlib.h>

void install(void) __attribute__((constructor));

void install()
{
    system("sh -c 'open -a Calculator'");
}

build clang -shared main.c -o libhello.dylib

Can you try this code?

kekeimiku avatar Jul 07 '23 09:07 kekeimiku