0

I am working on MDM implementation for iOS. I want to know whether there any command using which we can get to know whether iOS device is rooted or jailbroken?

I had seen the MDM protocol reference and I haven't found any field in DeviceInformation command to know this.

How server can know this status from device?

Cœur
  • 37,241
  • 25
  • 195
  • 267
Sapna Maid
  • 89
  • 11
  • Possible duplicate of: http://stackoverflow.com/questions/413242/how-do-i-detect-that-an-ios-app-is-running-on-a-jailbroken-phone and http://stackoverflow.com/questions/1140856/determining-if-an-iphone-is-jail-broken-programatically – KlimczakM Jan 19 '15 at 12:47
  • Possible duplicate of [How do I detect that an iOS app is running on a jailbroken phone?](https://stackoverflow.com/questions/413242/how-do-i-detect-that-an-ios-app-is-running-on-a-jailbroken-phone) – Cœur Nov 03 '17 at 04:41

2 Answers2

1

The Apple MDM protocol does not have a way to check if a device is jailbroken. MDM vendors will usually come up with their own solution for this.

Nobosi
  • 1,066
  • 6
  • 14
0

You can look for Cydia (or similar apps) with NSFileManager. And you should check if you have access to the bash on the phone. You can try something like this:

- (BOOL) isJailbroken
{    
    //If the app is running on the simulator
#if TARGET_IPHONE_SIMULATOR
    return NO;

    //If its running on an actual device
#else
    BOOL isJailbroken = NO;

    //This line checks for the existence of Cydia
    BOOL cydiaInstalled = [[NSFileManager defaultManager] fileExistsAtPath:@"/Applications/Cydia.app"];

    FILE *f = fopen("/bin/bash", "r");

    if (!(errno == ENOENT) || cydiaInstalled) {

        //Device is jailbroken
        isJailbroken = YES;
    }
    fclose(f);
    return isJailbroken;
#endif
}

This code is not really tested.. let me know if it worked.

aofs
  • 247
  • 1
  • 10
  • Actually, I am implementing MDM server using inbuit MDM client of iOS. I am not implementing the iOS MDM application. So, I want to ask whether there is any command which I will send to device from server in .plist form and device inbuilt MDM client will return the flag that will indicate whether device is jailbroken? – Sapna Maid Jan 20 '15 at 04:46