2

I am developing an application for a jailbroken iPhone 5s (iOS 7.1.1) to fetch call logs and messages stored in the respective .db files.I have certain queries:

  1. I have a valid certificate, provisioning profile and my app is signed using this profile, so is it necessary to remove this profile and sign the app with ldid (if so why and what are the steps?)

  2. Does my app needs to have root permission to access the databases (/var/wireless/Library/CallHistory/call_history.db) and (/var/mobile/Library/SMS/sms.db), if so how to grant root permission to my app. I have tried the solution: Gaining root permissions on IOS for NSFilemanager jailbreak but my app installed using this method just shows a blank screen on click and then fades away (I have signed my app using a valid developer certificate and provisioning profile)

  3. Any code related to fetching call_logs and sms would be helpful,i tried some of the codes suggested but none of them worked,may be due to above issues.

Community
  • 1
  • 1
user3932883
  • 35
  • 1
  • 6
  • Please read [Stack Overflow's guide on asking questions](http://stackoverflow.com/help/how-to-ask). Your question violates a few general rules for good questions. Telling us "i tried some of the code suggested" doesn't help us. **Which** code did you try? Also, please don't place more than one question in a post. Separate them into multiple questions. Thanks. – Nate Aug 14 '14 at 04:53
  • Thanks,will take care next time. – user3932883 Aug 14 '14 at 13:57
  • I have used the following code to read the sms.db file but with no success http://stackoverflow.com/questions/11177685/reading-iphone-messages-inbox-in-my-app – user3932883 Aug 14 '14 at 20:29

2 Answers2

2

Problem with accessing these is not root permissions but sandbox rules. As long as you're out of the sandbox you can read them. Don't know why your root application couldn't read it but it should. There is no other restrictions apart from the sandbox. Root permissions are needed to write to those databases but everybody can read them. I even rememeber reading them from inside of regular AppStore app on jailbroken phone. Jailbreak breaks some of the sandbox rules so you can read I think anywhere in the file system. That's how some jailbreak detectors work, for example.

creker
  • 9,400
  • 1
  • 30
  • 47
  • I have used pangu tool to jailbreak the device and it does not violate sandbox rules and so my app is still in its sandbox. – user3932883 Aug 14 '14 at 14:02
  • Probably has to do with iPhone 5S. For some reason arm64 has more restrictive sandbox. I tested it on iPhone 5. But that's about AppStore apps on jailbroken phone. Root applications has no problem accessing what you need. You don't even need to sign them. There is definately something you did wrong. – creker Aug 14 '14 at 20:08
  • So is it necessary to use self sign certificate to gain root access or i can use my valid apple sign certificates and should i follow the above link again to gain root acess? – user3932883 Aug 14 '14 at 20:11
  • As I said, problem is not with root access but with the sandbox. There is a specific sandbox profile used for all applications inside `/var/mobile/Applications`. As long as your application is outside that directory no sandbox rules are applied by default. You can set it to run as "mobile" user or as "wireless" user, doesn't matter. As long as you're out of the sandbox you're fine. Without the sandbox UNIX permissions are used and they allow any user to read what you want (read permissions are set for world). – creker Aug 14 '14 at 20:20
  • Furthemore, you don't even need to sign your app if it's outside that directory. Jailbreaking disables code signing checks for non-AppStore binaries. – creker Aug 14 '14 at 20:20
  • Hi creker,can you provide me the link to run the application as root on a jailbreak device.(outside the sandbox profile so that i can read the db files).To read the sms.db i am using this code: http://stackoverflow.com/questions/11177685/reading-iphone-messages-inbox-in-my-app – user3932883 Aug 14 '14 at 20:24
  • For the sake of the test just read it using `NSData dataWithContentsOfFile` to see if you can read anything. Your sqlite code may be wrong. – creker Aug 14 '14 at 20:41
  • this is a standard method to read a .db file,anyways i will try your suggestion,but please provide some link to run app out of sandbox profile(root access),may be that is the issue why my app is unable to read the sms.db file – user3932883 Aug 14 '14 at 20:47
  • The link you gave is fine. It's actually much simpler than that - just put your app into `/Applications`, give app binary execution permissions and that's all. All those setuid and bash script stuff is not needed in your case. You don't actually need root permissions, just need to escape the sandbox which is what you're doing by placing your app inside `/Applications` directory. – creker Aug 14 '14 at 20:51
  • thanks creker,i will try once again the and come back. – user3932883 Aug 14 '14 at 20:55
  • Hey Creker,I got to know the issue,actually when i was pushing the app to /Applications folder,one of the closing quotes in the script changed to some weird character,i manually changed it back to quote(") symbol.Now the app is running from /Applications folder and i am able to read sms.db with success.Thanks for your inputs,it really helped. – user3932883 Aug 23 '14 at 08:44
  • @Nate, sorry. I have a full time job and don't need anything else right now. – creker Oct 02 '14 at 08:15
1

It's impossible to access the user's SMS messages on both the simulator and on the real device (unless it's jailbroken). Unlike on Android, Apple's privacy constraints don't allow developers the right to access the users' personal data such as text messages, phone calls, etc. You can see various examples for this. For example, try Whatsapp registration process on both iPhone and Android. On both, you'll receive a text message with the code, but while on the Android the code will be magically inputted and verified by the app, on the iPhone you'll see the received text message and be asked to manually type the code.

Mr. Bond
  • 427
  • 1
  • 4
  • 18