Inject dynamic library into enterprise app (ipa)
Asked Answered
M

4

7

I want to inject my library into an existing enterprise app (ipa file).

I found mach_inject, but thats only for MacOSX.

Its possible because https://www.mocana.com is doing so.

Please help. Any ideas, suggestion would be really helpful.

Manometer answered 18/2, 2014 at 5:2 Comment(3)
Do you mean at runtime? or are you trying to alter a different app? Perhaps a better example of what you're trying to do would help.Kilogrammeter
not at runtime on device.. I have a portal wherein the user will upload ipa file. Then I need to inject my library into the ipa and return the updated ipa for user.Manometer
shouldn't you just be packaging it as a normal enterprise app upgrade?Arc
A
3

It is not clear what you want to do but mach_inject is a way for user apps to interface with the MAC OS kernel using the Mach ports it is not relevant at all to IPAs which are essentially an archive - similar to zip or Tar.

I suspect that based on what you are describing that you have a library that you want link edited / included in a user app but you don't want them to see your source code and vice versa. I am not familiar with Mocana but based on what you described it uses an IPA for distribution, that is entirely possible, but so is using a precompiled object module which is what Facebook SDK gets distributed in.

In anycase, prior to distribution whether by enterprise distribution server or the app store, the entire package needs to be signed before the devices can download and run it.

Arc answered 21/2, 2014 at 8:6 Comment(0)
I
2

Yes, You will be able to inject a library in to an existing ipa and then resign it with your enterprise certificate. Below is the brief of how I do this

View the executable in MachOView and find the address of load commands. Then using the address edit the hex and increase the load command count by 1 (assuming i am injecting one library) also I'll have to increase the command offset.

There are tools available to inject the library into the hex with which you can now inject the library at the new offset that you referenced in the load command.

Also have a look at dyci-main in git which is a dynamic library injection project.

Impeccable answered 1/9, 2014 at 18:10 Comment(0)
S
0

.ipa files and executables are signed, and the signatures have to match. iOS will refuse to run the app if the signatures are mismatched or otherwise invalid. Even if you re-sign the ipa with your credentials, the signature won't match the credentials on the executable. In order for the signatures to match, either you would need to sign the .ipa with their private key, or they would have to sign the executable with your private key. Private keys are not meant to be used this way...

Sutter answered 21/2, 2014 at 18:38 Comment(0)
T
0

There is a way to unpack and resign existing .ipa see answers here How to re-sign the ipa file?

So is possible to change content of .ipa, another part of problem is write some wrapper app that load original application and inject dynamic lib, I sure that is not easy to do, but should be possible at lest.

Thanh answered 26/2, 2014 at 23:6 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.