securing / IOSSecuritySuite

iOS platform security & anti-tampering Swift library
https://www.securing.biz/
Other
2.27k stars 272 forks source link

Blocks Low Power Mode Updates/State changes on iOS 16 #106

Closed flodaniel closed 4 months ago

flodaniel commented 6 months ago

We use IOSSecuritySuite in our flutter app through a wrapper plugin (https://github.com/jeroentrappers/flutter_jailbreak_detection). on iOS 16.* any changes to the lower power mode are no longer picked up at runtime and only a force close and restart gets the correct state. When we downgrade our flutter_jailbreak_detection to a version before it uses IOSSecuritySuite, the issue is no longer reproducable.

This is how we read the low power mode: result(@([[NSProcessInfo processInfo] isLowPowerModeEnabled]));

We had other third party vendors that suffered from the same bug and they came back to us with this info on how they identified and fixed the bug:

we added some logic that creates an instance of ProcessInfo as opposed to using ProcessInfo.processInfo. We believe this causes iOS to assign an invalid ProcessInfo to an internal singleton, which processInfo always returns. So when any other code in the app requests the process info via processInfo, it receives this invalid instance, which has its values “frozen”. As we understand it, if we don’t create this independent ProcessInfo instance, then calling ProcessInfo.processInfo internally creates a “correct” singleton instance that’s properly hooked up to system changes (i.e. not frozen). It’s a strange behaviour, and could be some kind of overlooked/buggy implementation in iOS.

On iOS 17. this is resolved, but as some iPhones stop getting updates with iOS 16., it would be great to resolve this.

r3ggi commented 4 months ago

Thx for the info, it should be fixed in https://github.com/securing/IOSSecuritySuite/releases/tag/1.9.11