有没有办法在 M1 MacBook 上直接运行 iOS 二进制文件?

tga*_*tga 2 macos ios macos-big-sur apple-silicon apple-m1

由于 M1 MacBook 可以直接运行 iOS 应用程序,我想知道是否有办法直接运行 iOS 二进制文件,而不是只能运行 App Store 中的二进制文件?

\n

我正在使用 C 语言而不使用 Xcode 开发 iOS 应用程序,我当前的工作流程是:

\n
    \n
  • 构建与xcrun -sdk iphonesimulator clang
  • \n
  • 打包成 iOS.app
  • \n
  • 使用xcrun simctl命令复制并在模拟器上运行
  • \n
\n

它工作得很好,但如果我可以以某种方式直接运行构建的二进制文件,那就太好了,如果我直接运行它,它只是说

\n
% file app\napp: Mach-O universal binary with 2 architectures: [arm_v7:Mach-O executable arm_v7] [arm64:Mach-O 64-bit executable arm64]\napp (for architecture armv7):   Mach-O executable arm_v7\napp (for architecture arm64):   Mach-O 64-bit executable arm64\n\n% ./app\nzsh: killed     ./app\n
Run Code Online (Sandbox Code Playgroud)\n

老实说我不知道​​这是怎么回事

\n

App Store 中可运行的 iOS.app似乎具有以下结构:

\n
iOSapp.app\n\xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 WrappedBundle -> Wrapper/iOSapp.app\n\xe2\x94\x94\xe2\x94\x80\xe2\x94\x80 Wrapper\n    \xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 BundleMetadata.plist\n    \xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 iTunesMetadata.plist\n    \xe2\x94\x94\xe2\x94\x80\xe2\x94\x80 iOSapp.app\n
Run Code Online (Sandbox Code Playgroud)\n

但我不知道其中任何一个是否有助于它的运行,并且找不到有关这些的文档

\n

小智 5

是的,Google P0 刚刚找到了一种方法来做到这一点:

因此,在 macOS 上启动 iOS 二进制文件所需的完整步骤是:

Use the posix_spawnattr_set_platform_np API to set the target platform to PLATFORM_IOS

Execute the new process via posix_spawn(2) and start it suspended

Patch dyld to allow library interposing

In the interposed library, claim to possess the com.apple.security.cs.debugger entitlement by replacing xpc_copy_entitlements_for_self

Continue the process by sending it SIGCONT
Run Code Online (Sandbox Code Playgroud)

完整链接为https://googleprojectzero.blogspot.com/2021/05/fuzzing-ios-code-on-macos-at-native.html