googleprojectzero / p0tools

Project Zero Docs and Tools
https://googleprojectzero.blogspot.com
Apache License 2.0
715 stars 113 forks source link

I got an error when try iOS on Mac #3

Open paradiseduo opened 3 years ago

paradiseduo commented 3 years ago

M1 Mac mini macOS 11.6

> make
clang runner.c -o runner
# Replace this identity, find available certificates usign `security find-identity`
codesign -s "560DD5E3C43BCB88276E4A46407F87AF26997823" --entitlements entitlements.xml --force runner
runner: replacing existing signature
clang interpose.c -arch arm64 -o interpose.dylib -shared -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk
# Can link against existing frameworks/libraries here by copying them onto ./Frameworks and adding `-F /Users/minim1/Desktop/Code/p0tools/iOSOnMac/Frameworks -framework AME_OF_FRAMEWORK -Wl,-rpath,/Users/minim1/Desktop/Code/p0tools/iOSOnMac/Frameworks
clang main.c -arch arm64 -o main -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk interpose.dylib

> ./runner main
[*] Preparing to execute iOS binary main
[+] Child process created with pid: 94407
[*] Patching child process to allow dyld interposing...
[*] _amfi_check_dyld_policy_self at offset 0x56874 in /usr/lib/dyld
task_for_pid failed. Is this binary signed and posesses the com.apple.security.cs.debugger entitlement?
[*] Sending SIGCONT to continue child
[*] Child exited with status 9

> codesign -d --entitlements - runner
Executable=/Users/minim1/Desktop/Code/p0tools/iOSOnMac/runner
��qq<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
        <key>com.apple.security.cs.debugger</key>
        <true/>
</dict>
</plist>
saelo commented 3 years ago

Hi! Is SIP disabled on the machine: https://developer.apple.com/documentation/security/disabling_and_enabling_system_integrity_protection? You could also try running runner as root to see if that works.

paradiseduo commented 3 years ago

I have a question. There is a new way to run iOS APP on M1 mac with enable SIP.(Converter or IPA-to-App-M1) Is there any difference between them?