bugsnag / bugsnag-cocoa

BugSnag error monitoring & exception reporter for iOS, macOS, tvOS and watchOS
https://docs.bugsnag.com/platforms/ios
MIT License
232 stars 127 forks source link

Bugsnag fails to identify jailbroken device #913

Closed zbencz3 closed 3 years ago

zbencz3 commented 3 years ago

Describe the bug

Device jailbroken with Checkra1n or Unc0ver is not marked as jailbroken by Bugsnag.

Steps to reproduce

  1. Jailbreak the device with one of the above mentioned jailbreaks.
  2. Use Bugsnag to send an event.
  3. Inspect the Event > Device > jailbroken property.
  4. Observe the property being false.

Expected outcome: the jailbroken property should be set to true.

Environment

Additional details

Bugsnag uses the MobileSubstrate image string to determine whether a device is jailbroken.

With the above mentioned jailbreaks the MobileSubstrate image might not necessarily be there. See the list of loaded images: Checkra1n_iPhoneSE1_iOS14.0.1_loaded_images.txt Unc0ver_iPad1_iOS12.4.6_loaded_images.txt It seems the MobileSubstrate image is loaded depending on the tweak used, e.g. Kill Switch 2 would load it and then Bugsnag would mark the device as jailbroken, but having OpenSSL, Cydia, etc would not mark the device as jailbroken.

To improve detection I suggest adding additional image strings like SubstrateBootstrap, substitute-inserter, and possibly others for Procursus (OdysseyRa1n), libhooker (Chimera).

Also, if possible please expose the isJailbroken method to avoid having to replicate this basic detection.

Thanks.

EDIT:

KillSwitch2 related log with loaded frameworks: Checkra1n_iPhoneSE_iOS14.0.1_KillSwitch2.txt Note the /Library/MobileSubstrate/DynamicLibraries/SSLKillSwitch2.dylib which would trigger the detection because of the substring MobileSubstrate.

mattdyoung commented 3 years ago

Hi @zbencz3

Thanks for the info! We have some planned work coming up to improve jailbroken/rooted detection on both iOS and Android so we'll look into factoring in your suggestions as part of that.

zbencz3 commented 3 years ago

v6.6.4 includes More robust jailbreak detection https://github.com/bugsnag/bugsnag-cocoa/pull/1000

mattdyoung commented 3 years ago

Yes. This has been addressed in v6.6.4.