6

Is there any way to detect in tvOS app if the apple tv is jailbroken or not ? Tried same method as used in iPhone to detect jailbroken but it does not work as per the reference link - How do I detect that an iOS app is running on a jailbroken phone?

NSString *filePath = @"/Applications/Cydia.app";
if ([[NSFileManager defaultManager] fileExistsAtPath:filePath])
{
   // do something useful
}

This method does not work, any API specific for tvOS app to detect jailbroken ?

Matteo Pacini
  • 21,796
  • 7
  • 67
  • 74
Manisha
  • 372
  • 3
  • 13
  • is it possible to detect or not ? – cybergeeeek Jun 17 '19 at 11:41
  • 1
    If there were a highly reliable way to detect this, Apple would use it in tvOS to prevent jailbreaking in the first place. Any detection you add is going to be easily bypassed. That doesn't make it useless, but it means you shouldn't spend too much time on it, unless you have a team that you believe is of similar magnitude to the Apple security team (some companies have this, it's not infinite or anything, but if you don't, then you need to adjust your expectations accordingly). – Rob Napier Jun 17 '19 at 19:35

1 Answers1

2

You can check if any of these files exist (Cydia stuff):

  • /private/var/lib/cydia
  • /var/cache/apt
  • /var/lib/apt
  • /var/lib/cydia

Many people also install OpenSSH on their jailbroken devices, so check for:

  • /usr/sbin/sshd
  • /usr/bin/sshd

If Cydia is not installed - check the root partition permissions - /.

If you can read/write, the device is most likely jailbroken.

You could also try fork() - the sandbox won't allow it, hence it will succeed in a jailbroken environment.


Note: Keep in mind there's plenty of tools in Cydia and on the Internet to bypass jailbreak checks.

Matteo Pacini
  • 21,796
  • 7
  • 67
  • 74
  • Trying `fork()` doesn't even compile. I get the error "'fork()' is unavailable: Please use threads or posix_spawn*()". How can I add a check for `fork()` that can compile and allow me to build and run the app? – alobaili Nov 05 '20 at 11:40