Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

If you're an iOS app developer...

The correct way to check if your app has been pirated requires two steps:

1) You must be running on a jailbroken system. Check this by trying to read from outside the sandbox.

2) Check if your app's signature is invalid. Checking this is fairly involved. Look around for code.

If either of these two are false, then you've not been pirated (point (2) will be true when your app is checked by Apple but point (1) will be false).

For Mac App Store apps, only point (2) is required.

The author of the app in the article has only checked point (1) (and additionally checked an irrelevant point by checking for Installous).

Incidentally, the preferred action if you've detected a pirate situation is to exit(173).



Even if both are true, the app still may not have been pirated. I wouldn't take any action based on this information beyond perhaps gathering statistics (and keep in mind that those statistics could be way off).


Apple explicitly suggest an exit(173) if the certificate check fails for Mac App Store apps.

Although I've definitely had non pirate users report this error to me because they've drag and dropped the app onto another machine instead of reinstalling from the App Store -- so you're right, it's not a guarantee that they're a pirate in an absolute sense.


Apple suggests it for Mac apps because you can copy a purchased app to another computer manually, and the exit(173) signals the system to go do an authorization check and re-authorize that copy to run on its new computer if it passes. iOS has no equivalent mechanism.


You can normally read from outside the sandbox on iOS: there are data in /usr/lib and /usr/share that are important to libraries shipped as part of the dyld cache (also incidentally found outside of the app container.)

The main question is: what exactly lays outside the sandbox? A good thing to search for could be Cydia, but there are alternative package managers. MobileSubstrate isn't a sure bet either, but I suppose it's a far cry safer than Cydia. An additional method could be trying to map a page you can both write to and execute, which should fail unless specific kernel patches indicative of a jailbreak have been applied (or you're a webview with Nitro enabled.)

The best method, however, is to not care, because if you do it's for the sake of either tracking/analytics or screwing over your users.


Does checking for those things slow down the load time of the app? Wouldn't that punish paid users?


The files you're reading are already cached by the OS (to perform the exact same work). The only processing involved is computing a hashes and a small RSA encryption.

Less than half a millisecond?


You could also use access(), which will not incur any file reading overhead or exchange of encryption keys.


(and additionally checked an irrelevant point by checking for Installous)

Nit: I'm almost certain that they checked for MobileSubstrate.


Checking these things wont get you disapproved from the App Store?




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: