sensepost / objection

📱 objection - runtime mobile exploration
GNU General Public License v3.0
7.46k stars 854 forks source link

[bug] Objection cannot patch IPA after updating applesign #428

Closed weev3 closed 3 years ago

weev3 commented 3 years ago

Step to reproduce the bug

  1. Patch ipa with below command. objection patchipa --source DVIA-v2-swift.ipa --codesign-signature 8B5538759C2C1C0EX2427753X38ED7646E7932B7 -P embedded.mobileprovision

  2. After that unzip the ipa.

    
    unzip DVIA-v2-swift-frida-codesigned.ipa

3. Then deploy the IPA with ios-deploy and error is occured as below. 

kmt@celtron-mbp16 ios % ios-deploy --bundle Payload/*.app -vWd
[....] Waiting for iOS device to be connected Handling device type: 1 Already found device? 0 Hardware Model: N51AP Device Name: XXX’s iPhone Model Name: iPhone 5s (GSM) SDK Name: iphoneos Architecture Name: arm64 Product Version: 12.4.9 Build Version: 16H5 [....] Using 5a7e222004d874922247fcdca2f358b1743fca21 (N51AP, iPhone 5s (GSM), iphoneos, arm64) a.k.a. 'XXX’s iPhone'.

......... ......... .........

[ 52%] CreatingStagingDirectory [ 57%] ExtractingPackage [ 60%] InspectingPackage [ 60%] TakingInstallLock [ 65%] PreflightingApplication [ 65%] InstallingEmbeddedProfile [ 70%] VerifyingApplication 2020-12-08 14:45:30.398 ios-deploy[30091:873131] [ !! ] Error 0xe800003a: The application could not be verified. AMDeviceSecureInstallApplication(0, device, url, options, install_callback, 0)

If I managed to signed manually. I saw the problem is came from **applesign**.  if I add `-c` option in applesign. The application can successfully install with ios-deploy. If not it throws an error and singing error is occurred. 

applesign -m embedded.mobileprovision -i 8B5538759C2C1C0EX2427753X38ED7646E7932B7 -c -o patched_codesign.ipa patchedapp.ipa

leonjza commented 3 years ago

Just to be clear, are you saying the signing works fine when adding -c?

weev3 commented 3 years ago

Hi @leonjza, Yes. When I tried to sign with applesign (without -c) option, I cannot deployed with ios-deploy. But if I add -c option, I can deploy ipa file smoothly.

julepka commented 3 years ago

I had exactly the same issue and adding -c resolved it for me. Thanks @weev3

leonjza commented 3 years ago

bb33bce3ca9c36482951081e3d3721645f963124 added the -c option. Will be available in the next release.