Determining iPhone Hacked Jail Programmatically

How do you determine (programmatically) if iPhone / iPod:

  • Prison broken
  • Running a fixed copy of your software.

Pinch Media can determine if the phone is in jail or software is running, does anyone know how they do it? Are there libraries?

+78
ios objective-c iphone cocoa-touch jailbreak
Jul 16 '09 at 23:43
source share
4 answers

Here is one way to determine if your application has been hacked.

In short: cracks usually require an Info.plist change. Since it has a regular file that you have access to, it is fairly easy to identify such changes.

+38
Jul 17 '09 at 0:03
source share

Detecting a jailbreak of a phone is as simple as checking for the presence of the /private/var/lib/apt/ folder. Although this does not define users only for Installer, by now most of them have installed Cydia, Icy or RockYourPhone (all of which use apt)

To detect pirated users, the easiest way is to check for the presence of the SignerIdentity key in your Info.plist application. Since advanced crackers can easily find standard checks [[[NSBundle mainBundle] infoDictionary] objectForKey: @"SignerIdentity"] , it is best to eclipse these calls using the Objective-C runtime accessible through #import <objc/runtime.h> , or use alternative equivalents.

+25
Jul 21 '09 at 3:45
source share

Just to expand on zakovyrya to answer, you can use the following code:

 if ([[[NSBundle mainBundle] infoDictionary] objectForKey: @"SignerIdentity"] != nil) { // Jailbroken } 

HOWEVER, a person hacked into your application can run the sixth version of your program and as such, they can edit the @ "SignerIdentity" line to read @ "siNGeridentity" or something else that will return zero and thus pass.

So, if you use this (or any other suggestions from http://thwart-ipa-cracks.blogspot.com/2008/11/detection.html ):

  • Do not expect it to work forever
  • Do not use this information to break / hinder your application in any way (otherwise they will have a reason to use it, so your application will not know that it is jailbroken)
  • It might be wise to obfuscate this bit of code. For example, you can put the base64 string encoded in the source code in your code, and then decode it in the application by changing the process.
  • Confirm your verification later in your code (for example, when I said SignerIdentity, did it really say SignerIdentity or siNGeridentity?)
  • Do not tell people on a public website such as stackoverflow how you do it.
  • Keep in mind that this is just a guide and is not flawless (and has no evidence of safety!) - great responsibility comes with great strength.
+10
Jul 21 '09 at 9:32
source share

To expand the words yonel and Benjie above:

1) The Landon Fuller method , based on the encryption check associated with yonel above, is apparently the only one that has not yet been defeated by automatic cracking tools.I would not worry too much about Apple changing the LC_ENCRYPTION_INFO header status in the near future. This seems to have some unpredictable consequences for jailbroken iphones (even when the user bought a copy ...)

In any case, I would not have taken any rash actions against the user based on this code ...

2) In addition to the comment by Benjie re. obfuscation (an absolute must to deal with any string values ​​in your anti-piracy code): a similar, but perhaps even simpler way is to always check the salt hashed version of the value you are looking for. For example (although this check is no longer effective), you should check each MainBundle key name as md5 (keyName + "some secret salt") against the corresponding constant ... Most likely, but be sure to defeat any attempt to find the string.

Of course, this requires you to indirectly request the value that you want to compare (for example, by going through an array containing it). But this happens most often.

+5
Mar 18 2018-10-18T00:
source share



All Articles