Friday, May 23, 2014

Daily Blog #334: More on Encrypted iPhone backups

Hello Reader,
       Today we have a guest post from Brian Moran. Brian saw our Sunday Funday challenge based on Hal's recent testing for the SANS OSX Forensics class and generously followed up with some knowledge of his own! Check this out, very cool stuff.

I am sure you guys already know this, but there is something I wanted to add to your Sunday Funday challenge about encrypted iOS backups and the absolute joy that I personally find every time that I come across a system with encypted backups :) 


When iOS encrypts the data in the keychain, which stores passwords for the system and applications, it uses a unique key to that iOS device (if memory serves, the length of that key is 64bits, and the password is AES256 encrypted using that key. I might be wrong on the key length and encryption mechanism, but I believe that is correct). 


iPhone Keychain Backups
In iOS, an application always has access to its own keychain items and does not have access to any other application’s items. The system generates its own password for the keychain, and stores the key on the device in such a way that it is not accessible to any application. When a user backs up iPhone data, the keychain data is backed up but the secrets in the keychain remain encrypted in the backup. The keychain password is not included in the backup. Therefore, passwords and other secrets stored in the keychain on the iPhone cannot be used by someone who gains access to an iPhone backup. For this reason, it is important to use the keychain on iPhone to store passwords and other data (such as cookies) that can be used to log into secure web sites.



However, when a user choose to encrypt their backups, the data in the keychain in the iOS backup is no longer encrypted with that key, it is instead encrypted with the user's iOS backup password. So, by utilizing a tool like elcomsoft's Phone Password Breaker (shoutout to Vladimir Katalov) you can load the encrypted iOS backups into the EPPB tool and attempt to break the password for the backups. Once you (hopefully) recover this password, on top of getting ALL the data from the backups, you now also have passwords saved in the keychain for things like email, wifi connections, applications passwords, etc.



I believe the intent of this was to allow a more seamless integration into restoring your iOS device from an encrypted backup (I honestly have no idea why you would take a potentially strong(er) password (device specific) and change it to a potentially weak(er) (user supplied) password, but hey, that is what makes Apple devices so fun to forensicate!) So just be sure that if you choose to encrypt your iOS backups that you use really strong passwords, otherwise, the potential is there to get even MORE data from an encrypted iOS backup than a non-encrypted iOS backup :)