Mozilla Firefox 3 History File Format

From ForensicsWiki
Revision as of 14:14, 15 April 2008 by Kevin (Talk | contribs) (moz_historyvisits: Added details of what the visit_types mean)

Jump to: navigation, search

Starting in Firefox 3, a new file format was used to record browser history information. Rather than storing this information in a flat file using the mork file format (as was done in previous versions of Firefox), the information is kept in sqlite tables within a file.

File Locations

On linux systems, the history file is located in the users home folder in the .mozilla/firefox/<profile folder>/ folder and is named places.sqlite. On Windows systems, the history file is located in C:\Documents and Settings\<username>\Application Data\Mozilla\firefox\Profiles\<profile folder> and is named places.sqlite.

File Header

Firefox 3 history files start with
 53 51 4C 69 74 65 20 66 6F 72 6D 61 74 20 33
which represents the ascii string SQLite format 3. This is normal for any Sqlite database file, so it may be more appropriate to verify that the file is a Firefox 3 history file by looking for the database tables within the file. For example, at offset 120701 (0x1D77D) the hex value
43 52 45 41 54 45 20 54 41 42 4C 45 20 6D 6F 7A 5F 62 6F 6F 6B 6D 61 72 6B 73
can be found. This represents the ascii string CREATE TABLE moz_bookmarks. At offset 120973 (0x1D88D) the hex value
43 52 45 41 54 45 20 49 4E 44 45 58 20 6D 6F 7A 5F 62 6F 6F 6B 6D 61 72 6B 73 5F 69 74 65 6D 69 6E 64 65 78
can be found. This represents the ascii string CREATE TABLE moz_bookmarks_itemindex.

Database Tables

The places.sqlite file is essentially a database with multiple tables:

  moz_favicons (actually stored the favicons in a BLOB within the table)
  moz_places (See Below)
  moz_historyvists (See Below)



The moz_places table holds some of the information necessary to reconstruct the browser history.

  url LONGVARCHAR (The whole URL string)
  title LONGVARCHAR (The title presented from the TITLE tags on the page)
  rev_host LONGVARCHAR (this is the host name from the URL in reverse)
  visit_count INTEGER
  hidden INTEGER
  typed INTEGER
  favicon_id INTEGER
  frequency INTEGER


The moz_historyvisits table holds the other information that you need to link up with moz_places to reconstruct the browser history.

  from_visit INTEGER
  place_id INTEGER
  visit_date INTEGER 
  visit_type INTEGER
  session INTEGER

The place_id column of the moz_historyvisits table corresponds to the id column of the moz_places table. The visit_date column keeps time in Unix time format (number of seconds since January 1, 1970). However, there are additional digits appended to the end of the number. Therefore, only the first 11 digits of the number should be used to calculate the actual visit date.

The visit_type column is an integer that represents one of seven types.

1TRANSITION_LINKThis transition type means the user followed a link and got a new toplevel window.
2TRANSITION_TYPEDThis transition type means that the user typed the page's URL in the URL bar or selected it from URL bar autocomplete results, clicked on it from a history query (from the History sidebar, History menu, or history query in the personal toolbar or Places organizer.
3TRANSITION_BOOKMARKThis transition is set when the user followed a bookmark to get to the page.
4TRANSITION_EMBEDThis transition type is set when some inner content is loaded. This is true of all images on a page, and the contents of the iframe. It is also true of any content in a frame, regardless of whether or not the user clicked something to get there.
5TRANSITION_REDIRECT_PERMANENTSet when the transition was a permanent redirect.
6TRANSITION_REDIRECT_TEMPORARYSet when the transition was a temporary redirect.
7TRANSITION_DOWNLOADSet when the transition is a download.

Gathering browser history

Browser history for Firefox 3 can be gathered by connecting to the Sqlite database and performing simple queries. For example, the URLs visited and the date and time of the visit can be gathered with this query:
SELECT moz_places.url, moz_historyvisits.visit_date 
FROM moz_places, moz_historyvisits 
WHERE = moz_historyvisits.place_id