3

Just wondering. Or is it even technically impossible to write me, e.g. because iOS may prevent jumps to the area where the unpacked code resides?

MrMage
  • 7,282
  • 2
  • 41
  • 71

3 Answers3

2

You can't use it, iOS doesn't allow you to create executable pages or to run custom binaries from a file.

JustSid
  • 25,168
  • 7
  • 79
  • 97
1

Unpackers such as UPX need to place the unpacked image somewhere. If it is placed in memory, the CPU needs to start executing the instructions in the image, which was heretofore treated as data. IIRC, executing data isn't allowed by iOS.

Paul Lalonde
  • 5,020
  • 2
  • 32
  • 35
0

As far as i know, the compiled executable binary cannot be packed because it must be signed with Xcode and tools. After the deployment of signed code to a iOS device it cannot be modified in any way (only the OS can load it different to the RAM).

You can try to pack your resource files and load them in a different way.

Jonas Schnelli
  • 9,965
  • 3
  • 48
  • 60
  • 2
    This is an incorrect assumption. The build process (from Xcode) is separate from codesigning and you can manipulate the binary after is it built and before it is signed. There is even a "postbuild custom build script" field in the settings of the project. – kuba Apr 24 '12 at 21:01
  • Yes. But codesing (the binary) is also part of Xcode and tools (written so). So for packing the binary with a non-xcode tool, you also need the counterpart in the iOS subsystem. So, in my eye: no chance. – Jonas Schnelli Apr 24 '12 at 21:02
  • 1
    Well, no. UPX and other packers embed the unpacker into the binary itself, so it is still a standalone binary with no additional requirements. However it may be impossible for other reasons (inability to allocate executable pages at runtime, as suggested in other posts). – kuba Apr 24 '12 at 21:53
  • Sorry if I misinterpreted you, if you were talking about the "can't malloc executable code at runtime" problem from the beginning. I thought you suggested that the packed binary can't be signed from XCode. – kuba Apr 24 '12 at 21:55