Tuesday, August 9, 2016

How to Hack Mechanism Android Backup Copy

In  the last article  we examined the exemplary implementation of a backup copy of data on the example of Apple iOS devices. And how things are on other platforms? Today, we will study the main antagonist iOS - Google Android platform and find out how to save the data with as root and without, like them a way to restore data from a backup, and how to pick open a local or a foreign cloud backup. 
maxresdefault.jpg

How to hack mechanism backup copy Android.

Just define some terminology. In this article we will write exclusively about the kind of Android that comes with Google. Third-party firmware, we are not particularly interested in: the number of users is minimal, thus create and restore backups of your data at the next firmware "kastomov" These people are good at. No, today we'll talk about the other 99% of users who want to open the box, enter the username and password of an account and get something workable.
The article is based on a study in which we used about ten devices from ASUS, Google Nexus, LG, Motorola , Oppo and Sony. It was tested as the restoration of data on the same device after a reset to factory settings, and the migration of data to another device.
SOFT BY MANUFACTURER
Device manufacturers often release proprietary utilities for the backup copy of data. Some (eg, Sony) offer to install software on a computer, others (ASUS, LG) is inserted into the appropriate functionality in firmware. Samsung provides the ability to back up in its own cloud. In short, the confusion and vacillation.
c8c7eec4ae05ba938c78760fb35bceec.png
Sony PC Companion Official App

It combines solutions from manufacturers of two things. First, create backup copy will be sufficiently complete that enables you to recover data after a device reset, firmware updates or upgrades. Second, restore the backup from the phone to the Sony tablet from ASUS (and vice versa), you will not succeed: the same need to restore the software on the model from the same manufacturer.

c95dd84218952cc174943d6be3eba986.png
Backup created firmware from ASUS

However, if you plan to use the device for a long time, why not create a backup? Yes, it's not always convenient, and yes, it is neither a not automated, but that the possibility of something.And if with your phone that something happens and if you decide to replace it with a device from the same manufacturer, then you may even be able to restore the data to it. Confidence, of course, not as a second: the manufacturer guarantees a successful recovery is only a device of the same model, with which the data was copied.

BACKUP: VERSION OF GOOGLE

Devices running Android - this motley zoo platforms, architectures, manufacturers of hardware and software configurations. It is difficult to make sure that backups created with one phone manufacturer, does not destabilize the smartphone on a completely different architecture. Perhaps this is the main reason, with how Google is developing a second speed gear backupcopy .
Except existed with the first version of the Android mechanism s synchronization of contacts, calendar and other Google applications to the cloud, and settings appear only in the Android 4.3. It was available only in development mode, and only through the Android Debug Bridge. In other words, for "ordinary" users it did not exist. 

In a second, then Google the beginning of sync some data to the cloud. When you restore the device proposed and restore data (shortcuts, applications, and settings) from one of the previous devices. This functionality is, strictly speaking, it is not part of Android, and is implemented in the proprietary Google.
With Android 6.0 cloud backup settings officially became a part of the operating system. Now, the application developer is sufficient to include in the application manifest box, allowing backup data, and the system will automatically copy them to the cloud. Of course, the cloud is from Google, and the data attached to the Account Google account, so that users AOSP-assemblies without Google services remain on the sidelines. Well, let's look at the mechanism 's details. By breaking the chronology, let's start with the most modern and interesting mechanismas presented in Android 6.0.
ANDROID 6.0: We did it!
Starting with Android 6.0, the system automatically saves the system settings and applications to Google Drive user. I decided to upgrade the device? Your new smartphone will automatically pick up the settings from the cloud, he will install the application that you used on the old device, and automatically adjust them to your usual way. Almost like at Apple! And so it all and worked in the pre-assembly to the Android M release.

But the official version of Android 6.0, developers dramatically changed the record. If the pre-assembly automatic backup work for all applications in which the authors have not blocked this possibility explicitly (opt-out flag in the manifest), then the official version of the system to back up only created for applications in which the authors explicitly requested a service ( opt-in through the manifest) and have registered support for Android 6.0 (target API level 23).
Do you think there are many developers take this opportunity spine? In a remarkable article  Android 6.0 has a great auto backup system that no one is using (yet)  journalists Ars Technica reviewed in detail, how s applications use, as well as the s do not use the built-in Android 6.0 the mechanism of backup copy .

... The results were unexpected. Primarily built mechanism th backup copy Do not use Google Apps. Yes, the developer of this magnificent system decided to do without it. Restores the basic system settings, alarm clocks, "silent mode", but the data of Google applications - no. But social networking clients, mail clients, games, and other popular applications are in no hurry to add support. Of course, the situation will change over time, but so far that's it. After resetting the editorial Nexus 6 and the recovery from the cloud, the following happened:
  • Restore all applications. At the same time they were installed from Google Play, that is recovered is always the last version;
  • restore some settings, language built-in keyboard, setting "silent mode", alarm clocks;
  • not to reconstruct the history of calls and SMS;
  • Facebook settings are not restored;
  • not recovered data most applications (eg, gReaderPro had to be reset).
In other words, the system has installed all previously installed applications, but does not restore the data of the overwhelming majority of them. However, contacts and email started off out of the cloud, access to photos - too. A newly set up a couple of dozen applications - we are used to. More details about the Android Backup Service work can be found in Google Help.
CAN retrieve data from the cloud?
If Google can save data to the cloud, we can remove them, is not it? Let's see what we can do.
Firstly, just like in the previous issue described in the example of downloading data from iCloud, you need a login and password to a Google Account. That's not all; if enabled two-factor authentication (and its activated more often) need and the one-time code that will be generated by the application Google Authenticator, Microsoft Authenticator, FreeOTP or any of a variety of third-party (they work on the same principle and differ only cryptographic initialization code, which is given to the user a color QR-code).

Still, we need the appropriate software (you can do without it - more on that below). As the software we used  Elcomsoft Cloud eXplorer . Run the application, authorizing a Google account, select the data for download:

e0e7acc1b8f81bb7cff4b3f8fc1d0265.png
Downloads? enjoy:

15510b282e3772933b1dd0eb2c1f4535.png
The amount of information that the Google collects, frankly, shocking. Yes, in the abstract, we know that we were being watched. We know that carefully saves every page we visit, each tab in the browser (of course, for our own convenience - Synchronize!). Of course, every search query is saved, addressed to "the Corporation good" (you already knew what to look for on the internet recipe for vigorous bondby - not a good idea?):

40cdc9e9e0bb712a2bdad1015def2896.png
Available list of devices installed on their applications and application data itself: 
 c9e2ac1d72bacad9d589e2e4d7d3320d.png
 
Of course, there is access to the photos (hello, iCloud!):

3c550d51265954aff132d5005969adf9.png
For our own convenience stores detailed history of movements:

ad7c17d8d6704b8d2e7dc68bc1e9ee1b.png
Not bad traveled! And here the same in the text:
  4ea85148f7e6a077c1ea9bae2a187781.pngAT
Generally, a lot of interesting. To be honest, a Google account, you can find much more likely than ever dared to maintain solutions from Apple.

Where and how they are extracted properly, all these data? But this is perhaps the most interesting. "Corporation goodness" has a policy of maximum transparency. You can always view and download all the information that the corporation has collected about you. You can delete any data, and do not need to destroy your account for this. Finally, you can disable the collection of certain types of data (for example, set your phone so that the location of your information will not be sent to Google).
We are also interested in this context that point, according to which you are entitled to download all the information collected about you to Google. The official way to do this - through the service  the Google Takeout . Here you can choose how s data types we want to download:
  42ec7e52aca3f46dbf36a566b9033334.png

Selected data will be packed into the file and made available as an archive: 
5f3c33c96900d5ffe38ef458a544f24e.png

As you can see, nothing complicated. What's the catch? Why do I need Elcomsoft Cloud eXplorer? Is not it easier to download data directly from the Google Takeout?

Trick as a such, in general, no. And you can download the data. A small problem arises with the analysis of the information received. For the storage and export of data Google uses a lot of different formats (mainly - open). For example, data about their movements you will receive a file in JSON format - do with it what you want, you are not the Google Assistant. Do not he and assistant special services: according to the official position of the companies, Google obeys and sends the data in an open manner and in a standardized format ... that will make them more - not the slightest way concern the company. But the fact of providing information security services Google will record, save and  publish.

Another point. When downloading via the Google Takeout service user will be notified sure: such and such data were downloaded from such and such IP. If you do not need it, contact the party instruments: their use does not cause Google alert. And for a snack - the most interesting. Google Takeout for a second reason, does not download the Chrome synced passwords.But Elcomsoft Cloud eXplorer removes them without any problems:
 9908cedaf1baf6f142217c2711b839fd.png
Magic? No, Google and provides access to this information. All you need to do - to gain access to the synchronized data of the Chrome browser, after which they will be downloaded in the form of XML-file. Web interface to view your synced passwords available  here.
Backup via ADB
Starting with Android 4.3 system appeared in the regular way of creating a backup through the Android Debug Bridge interface (ADB). To create a backup you need to use something like this command:
adb backup -apk -shared -system -all -f C: \ backup.ab
Why is "about"? Yes, by virtue of the same "zoo" devices. We tested a large number of devices from different manufacturers running different versions of Android from 4.4 to 6.0.1 inclusive. On both of the devices, the team worked in a form other indication -system keys or -shared led to the creation of an empty file, and still others refused to accept a key -all. Can any logic in the adb command behavior we could not catch; one can say for sure: from the Android version of its behavior depends little. Most are dependent on the settings specified by a specific manufacturer.
For example, the editorial Nexus 6 running Android 6.0.1 has passed the following command:
adb backup -all -fc: \ nexus6.ab
But the option -noapk «broke» backup: an empty file is created. And adb backup may not work, if enabled data encryption section. Recall that encryption is enabled by default on Nexus line, as well as (at the request of Google) on all devices that come with preinstalled Android 6 and equipped with 64-bit processors.

e53bd3e3c06960d8357eeda35903653d.png
Another point. Adb backup designed so that the backup created on one device can be easily restored to another. And the key word here is not "restore" and "no problem": reconditioned device must and must not fail. Accordingly, it is saved and restored, only the data and settings that are not exactly harm the stable operation even when the data is transferred to the 32-bit smartphone chipset MediaTek 64-bit tablet with Intel Atom.

Restore data from a backup is easy using adb restore command.

What gets into these backups? Again, the answer depends on the device manufacturer. For example, smartphones Sony contacts, call log and SMS in the backup does not get the ADB, and Samsung phones, these data are stored. The same applies to the device settings (which are often unique to a particular manufacturer) and data system applications.

The backup copy exactly gets the list of installed applications. APK-files are extracted and stored (if that option has been specified at the time of making a copy). But the application data can be stored, and can not: it depends on developers who allowed or not allowed to back up in the manifest-file applications.

From a practical point of view, we were not able to benefit greatly from such backups. Restoring through adb restore still have to log in to Gmail, Facebook, and other email clients and social networking. Not preserved FBReader and Nova Launcher settings (which, by the way, has its own mechanism to back up data). And what remained? Hardly remember that on some machines failed to restore call log and archive SMS.

Android's built-in mechanism for th backup copy use some third-party applications. They are innumerable, so consider all we do not. The principle of all these programs is similar, and they differ only added features. The most popular program of this type - of H elium AppSync and the Backup  from the famous team of developers ClockworkMod (custom rekaveri CWM - their development).
What is inside?
Backups created through ADB, - the thing is quite simple. The output - file containing application data (depending on the configuration - and the actual .apk). They are stored in the form in which they store the application itself. Typically, applications use SQLite format, at least - the XML, is even rarer - the binary data in a proprietary format.

For SQLite analysis tools invented so much that for the briefest ob-
would require a separate article Auditor. Let me just say that with the help of these tools, you can get the deleted records. Example? You are welcome. If you are lucky and your phone manufacturer is permitted to copy log calls and SMS, then you can restore messages and phone calls that have been deleted by the user.
Custom backup RECOVERY AND NANDROID

Talking about the system backup copy Android, not to mention such a thing as a backup  Nandroid . The term is derived from the words NAND (flash memory type) and Android, and is used most often in the context of creating a copy of all custom (and often systemic) section entirely with rekaveri of a custom (often CWM or  TWRP ). Portability Nandroid backup is limited. It is recommended to restore to the same device from which they were made, and preferably on the same firmware.
What is inside?
Backup Nandroid - thing quite abstract. Each rekaveri that its format. Moreover, the format may differ depending on the device (remember: rekaveri custom - is, in fact, a separate operating system with its own characteristics for each supported model).

What do we get? Most often, the output - the file system image (along with the original file system that has been used on a particular device). The analysis is simple: install image (need a driver corresponding to the file system) and wander through the file system.

In some cases, we give a set of ZIP-archives with application data. Here, too, everything is simple: go to the archives and look; Data format is the same as the case with adb backup, but the much more complete set of data. Sometimes there is a single file with a set of files inside. We came across a simple .zip, and .tar.gz (extension may be different).

A common feature Nandroid backups that none tested custom rekaveri (and we tested dozens of options) does not create a complete image data. By "complete" we mean an image that contains both the original file system and unoccupied units - space. Analysis of free blocks would allow to scan for deleted files search. Unfortunately, not work. If you want just that, you have to use other methods. (In parenthesis, I note that the majority of the image of the system partition is created rekaveri whole, with all the "guts".)

Quote


It stands somewhat apart Titanium Backup app - the most popular program for creating backup copies, available in Google Play. With its help, we were able to create a backup copy of the data of all installed applications (including .apk), and then successfully restored them to a new device. Notice: Titanium copies the binary data from the sandbox application, so it is not recommended to use it to transfer data system Android applications. When you restore them to another device, the system can become unstable.
CONCLUSION
Today we learned of the mechanism s backup copy available on devices running Android. The fragmentation of the platform does not allow to consider all existing processes and applications, designed to ease backup and data migration, even those that have been described, demonstrate quite restrictive as the compatibility and on the completeness of the data being copied.

In general, our conclusion is this. You use "katabatic» Android? Plug cloud sync contacts and photos. Cloud Backup can partially restore a previously installed applications, and if very lucky, in some applications may partially recover and how s some data. If the device with which was created and which was restored backup is Android 6.0 or higher, then the clouds will recover more data compared to the older versions of Android.

Built-in mechanism adb backup may help to restore some data to users of older versions of Android. Third-party applications are only effective in the presence of root access. The use of a custom creation and rekaveri Nandroid backup will solve most of the problems, but this mode is available measly number of users.
As a result, the system backup copy on the Android gets a rating of "better than nothing" from us. Android surpass the inconvenience could not anyone: even in old Windows Phone 8 backup is much more successful.
And how affairs with backup from the market outsiders, phones running Windows Mobile and BlackBerry running version 10? This - in the next article!


0 Comments:

Post a Comment