Your iPhone has been storing general data about it’s location since at least last September.

It has been doing this in an unencrypted data file that is stored on your phone and in your backup files on your computer. That file is easily accessible to anyone with physical access to your phone or your computer.

That information used to be in the inaccessible system partition of the iPhone previous to the release of iOS 4.0. This information was not contained in iPhone backups and was ostensibly accessible only to Apple or people that had Jailbroken iPhones.

Now, the information resides in a section of your iPhone’s memory that is contained in iPhone backups and that is easily accessible to programs like the iPhone Tracker. Both GSM and CDMA iPhones record this location data.

Those are the facts. Anything else is conjecture or based off of unsubstantiated inside information.

The creators of the iPhone Tracker app made a short video demonstrating the way that the iPhone records your movements.

Washington DC to New York from Alasdair Allan on Vimeo.

Where is the information stored?

The fact that the iPhone was collecting and keeping this data was originally discovered last September by iPhone security expert Alex Levinson. The file, called consolidated.db is stored on the User partition within the iPhone’s file structure, making it accessible and allowing it to be contained in iPhone backups.

The file where this data used to be collected pre-iOS 4.0, was called h-cells.plist and it was located in the system partition and, while still accessible with enough effort, was much harder to get to and was not contained in backups.

Why was the data moved?

Some conjectures have been made that Apple moved this data in order for it to be easier for Apple itself or government officials to track iPhone users.

The fact of the matter is that the data was most likely moved for a much less nefarious reason. Developers needed access to the data to use in Multitasking and background location APIs. With the data behind the system partition, developers would not have been able to take advantage of cell tower triangulation in addition to GPS location to determine the iPhone’s location.

Why is it being gathered?

There are two main possibilities for the data collection. First, it’s obvious that making the data available to developers who are using location based services in their apps is necessary.

If you’ve ever used Google Maps and had the blue dot pop up a couple of blocks away from where you are with a large blue circle around it, that location was obtained using the same data that’s stored in this file. Your exact location is then determined by the GPS radio in your phone. If you’re indoors or have the GPS turned off, this data is used to approximate your location for apps that need it.

The other main reason that it could be being collected is that Apple is gathering information on the distance between, strength and positioning of cellular towers. A recent update to the iPhone Location app has determined that the information is recorded on both CDMA and GSM phones.

We’ve contacted Apple to confirm the exact reason that it’s being gathered but have not heard back from them yet. If we receive more information we will let you know immediately.

Why is it being kept?

This is the question that many who understand what we’ve discussed above are asking. If your iPhone only needs it for basic positioning, then why is the data being stored long term?

One theory has been posed by John Gruber of Daring Fireball.

I don’t have a definitive answer, but my little-birdie-informed understanding is that consolidated.db acts as a cache for location data, and that historical data should be getting culled but isn’t, either due to a bug or, more likely, an oversight.

The supposition here is that Apple always intended for the data to be erased a short time after it was recorded. After it was used for whatever positioning purposes that it was gathered for, it would be erased from the log file. Most likely this would happen on a revolving time-frame. Once data passed out of the time frame of usefulness, it would be deleted from the end of the database.

The answer as to why it is being kept can only be answered by Apple at this point, another item that we have reached out to them for comment on.

Is the information being sent?

Here is the important question. Apple has already acknowledged publicly that they do record and transmit data about cell phone towers in a letter to congress. In that letter, prompted by an inquiry from Congressmen Edward J. Markey and Joe Barton, Apple explains that they do gather this data and that it is transmitted but that it is done so in an encrypted packet.

Whether or not the data is sent encrypted remains to be seen, but the file is certainly not encrypted on your hard drive or the iPhone itself.

Although there was never any official confirmation of this, there is a strong possibility that the mysterious data transmissions many users have seen their iPhones performing in the wee hours of the night do, in fact, contain this location tracking information. The file size of the consolidated.db file and the amount of data being transmitted are similar enough to posit a possible link.

You can read the full thread of information about those strange nocturnal transmissions here, all 86 pages worth.

Can I stop it from being recorded?

Currently the only way to stop it from being recorded is to jailbreak your iPhone and use a jailbreak app written specifically for the purpose. Turning off location services will not disable the recording of this data as it’s considered diagnostic information.

You can also encrypt your iPhone backups which will protect the file from anyone attempting to access it on your machine. Doing this will not protect the file on your phone itself however.

In order for the file itself to be protected from access it would either need to be moved back to the system partition, where it is still possible to find but much more difficult for the average user, or encrypted by Apple on-device.

Should I be worried?

At worst the gathering of location data from GSM and CDMA cellular towers should be of mild concern to anyone who is in danger of their iPhone or computer being accessed by people that could be in a position to use your location to harm you.

This cross-section of people should be fairly limited.

That doesn’t mean that Apple shouldn’t have to do something about this file though. It’s unnecessary to have all of your movements for the past 8 months just sitting on your phone. A software update that either aggressively culled the file of old data or made it more secure will most likely be incoming.

We will be sure to inform you immediately if Apple responds to our inquiries regarding the iPhone recording your location and whether or not it is in fact being transmitted.