How do I use private system API? - ios

I'd like to use a private/hidden iOS method, for example clearIdleTimer from the SpringBoard class (example here). How do I do this? A lot of information references much older iOS versions.
This is just for experimentation, I recognize that private API's are not App Store approved. Also, my iOS device is registered for development but not jailbroken.
Edit: I found these iOS-Runtime-Headers but the samples are not working for me.

Not all private APIs are the same.
Some of them you can use in any app ... you just won't get them approved for the App Store.
Some of them you can use, but only if your app runs with root privileges, which requires a jailbroken phone (plus other steps).
Some of them you can use, but you need to grant your app an entitlement, which I believe also requires a jailbroken phone.
In the case of this API:
#interface SpringBoard <UIApplicationDelegate, SBWiFiManagerDelegate>
{
}
- (void)clearIdleTimer;
You are trying to directly invoke a method in the SpringBoard application. You normally can't directly invoke other apps' methods.
One way you can do this is to use Mobile Substrate (now called Cydia Substrate). This is a powerful code injection platform that would allow you to hook into the SpringBoard application, and use clearIdleTimer. But, using Mobile/Cydia substrate requires jailbreaking your phone.
Some SpringBoard-type features are designed to be invoked by other apps, and those live in SpringBoardServices, which is different from the SpringBoard application. You can try searching SpringBoardServices for equivalent functionality. Those APIs are private, but might not require jailbreaking (I can't recall ... my phone is jailbroken so I don't have to worry about it).
Not the answer you wanted, I suspect :(

Related

iOS - Security concerns installing a self-signed 3rd party app via Cydia Impactor

Pretty much what the title says.
I would like to install a 3rd party app on my iOS 11 device, but the only way to do so is by self-signing the .ipa and installing it via Cydia Impactor.
What are the possible security concerns in doing so?
How much control and access would said app have over my device once trusted?
There's no way of saying for certain.
Private APIs
iOS 11 fixed a number of vulnerabilities that allowed access to personal info such as SMS messages without user knowing. There might be other vulnerabilities but it looks like iOS 11 is pretty good in regards to private API access. Pretty much every known personal info leak was fixed.
The problem here is you can't do anything about it. Only way is to disassemble the application and see for yourself.
Permissions
Of course, there're many ways third-party app can steal your personal info if you give it the access. For example, contacts, calendar, call history (without phone number but still), microphone, photo library - once given permission to access, can be accessed at any point even when running in the background without you knowing it. Application can run in the background indefinitely, it's still not fixed by Apple.
Accessing location will always display an icon in the status bar so that's fine. But there're ways you can fool iOS to access location once and not display the icon. It's not reliable but it works.
If application is running in the foreground then it can access camera, microphone, location and iOS will not tell you anything about it. Recently there was an article about camera specifically. You can't tell when it's recording and that's a real problem.
Solution here is simple - don't give the permission.
Jailbreak
Jailbreaking relies on a number of vulnerabilities to modify kernel to disable security measures. No one is stopping you from using these exploits to be executed from a third-party app not meant for jailbreaking. In fact, all recent jailbreaks are done by installing an application using Cydia Impactor. And there's an actual example of that - Filza. It's a file manager that can access root file system. It does that by executing exploits used in jailbreak.
Solution here is to make sure your iOS is up to date and has no jailbreak for it. Of course there's a possibility of unknown exploits. Serious vulnerabilities found regularly in iOS. You can disassemble the application to see what it's actually doing but I don't think you would asking this question if you knew how do that.

Detect which app is in foreground on iOS9 without jailbreak

I'm trying to log users individual app usage on iOS9.
I'd rather prefer that it wouldn't use jailbreak limited solutions, self explanatory. Doing the variation of this app on a jailbroken phone shouldn't be hard.
This will certainly not be released on the App Store as Apple wouldn't allow it.
I'm looking for any private API that can do this, any hidden iOS API's that can be used to do this. ANYTHING.
What I've already looked through:
how to determine which apps are background and which app is foreground on iOS by application id
How to know about app launched and details jailbreak iOS 7
Is there a private API to be able to detect what is current foreground app on iOS?
How to monitoring App running in the foreground in iOS8?use the PrivateFrameworks SpringBoardServices
which proved to be relatively helpful - we now can assume that there is some sort of additional access requirement, probably an entitlement, but we don't really know how it should look like
Can you find individual app usage duration using SpringBoard services framework or other private framework?
Find out active application or if on Springboard
Programmatically detect which iOS application is visible to user
However all of these proved to be unhelpful because Apple fixed this security flaw with iOS8 and the method to copy/access the currently front most app bundle identifier no longer works.
Question is: Is there someone who knows a workaround using different tools/exploits that do not require jailbreak?
Ideas:
inspecting the processes running on the device and devising an algorithm that would be able to recognize spikes that mean an app has been launched, which potentially could work, but it probably would be a major pain in the ass. Questions mentioning this solution:
Detect which app is currently running on iOS using sysctl,
Return a list of running background apps/processes in iOS
How to get Names of Background Running Apps
Find Background running apps in iphone
inspecting the phones traffic somehow?
not sure if there is some kernel stuff that I could do
Here is my Reddit version of this question if anyone wants to check it out. Also if it's of any value, here are the runtime headers for iOS9 and list of Apple's private API's.
Unfortunately, I was looking for a similar solution and have come to the conclusion that, at least at this point in time, there are no known methods that will allow you to determine app usage on iOS. Even the MDM providers such as Good, Airwatch, MobileIron, etc. don't seem to be able to do this. If anyone is able to come up with a solution, I'd love to see it.
For now, however, I think we would have seen a solution if someone had one that worked on the latest iOS.
sysctl is still open but they block certain combinations of selectors. I did this on iOS 7 and gave Apple Product Security the code. They won't patch iOS 7 but rely on App Review. iPhone 4 is wide open.

Auto restart iOS app for enterprise, not jailbroken

I'm currently developing an app using enterprise account for internal purposes only.
I heard something about daemon for jailbroken devices in order to make my app just like an android service.
Is there anything I can do when not jailbroken?
Maybe 3rd party framework or piece of codes? Maybe private framework?
Something like this maybe: Make the application restart by itself on a jailbroken device
But for non-jailbroken.
P.S. - The app of course is not for app store and could not be on app store.
I agree with Tander. But we have achieved almost similar effect using combination of SLC (Significant Location Change), Background fetch and Silent push notifications. Whole point is that app periodically trigger call to API to let know it is alive.
If this fails, we sent normal Push Notification. I was looking into this for fair amount of time and didn't come up with nothing better. But note that you get very limited process time to execute code using this options.
Unless the device is jail broken the short answer is no.

How to jump to system settings on iOS?

If my app detects that the network is disabled, I want to jump to the system network settings. How can I do this in iOS?
There is no way to do this with the current version of the API, and Apple specifically disallows this in their HIG. Presumably this means that if you find a way, your app will be rejected.
There are no documented public APIs allowing you to do this. You can however use Apple's private frameworks, but you won't get an app accepted on the app store this way. It can, however, be used for Ad Hoc distribution and even Cydia for jailbroken apps.
Here's a quick way to get started with the private frameworks.

Programmatically executing the application out of sandbox in iPhone

How to build an application which is capable of executing outside the sandbox in non-jail broken devices? Because I need to access the files and other informations like sms, call history etc ...
I'm afraid you will probably not be able to do this. The provided SDK, and terms of using the SDK do not allow you to operate outside of the sandbox.
Even if you were able to access the information, then the app would only ever be for your own use (unless you are an enterprise developer) as it would most likely get a rejection from the App Store approvals process.
The only access outside the sandbox that is allowed is mediated through Apple's SDK. You will only be able to access specific items, such as the Address Book or Photo library, through the iPhone OS framework.
If you have a more specific question about what you want to accomplish, perhaps we can answer based on what is currently allowed.
There's no method that I know of to perform access outside the sandbox that is defined by the iPhone SDK.
Even if there were, your app would not be available for non-jailbroken phones, as it wouldn't be approved by the app store.

Resources