Difference between pages "Chrome Disk Cache Format" and "Windows Prefetch File Format"

From ForensicsWiki
(Difference between pages)
Jump to: navigation, search
(External Links)
 
 
Line 1: Line 1:
 
{{expand}}
 
{{expand}}
  
== Cache files ==
+
A Windows Prefetch file consists of one file header and multiple file sections with different content. Not all content has an obvious forensic value.
The cache is stored in multiple:
+
 
 +
As far as have been possible to ascertain, there is no public description of the format. The description below has been synthesised from examination
 +
of multiple prefetch files.
 +
 
 +
== Characteristics ==
 
{| class="wikitable"
 
{| class="wikitable"
 
|-
 
|-
! Filename
+
| <b>Integers</b>
! Description
+
| stored in little-endian
 
|-
 
|-
| index
+
| <b>Strings</b>
| The index file
+
| Stored as [http://en.wikipedia.org/wiki/UTF-16/UCS-2 UTF-16 little-endian] without a byte-order-mark (BOM).
 
|-
 
|-
| data_#
+
| <b>Timestamps</b>
| Data block files
+
| Stored as [http://msdn2.microsoft.com/en-us/library/ms724284.aspx Windows FILETIME] in UTC.
 
|-
 
|-
| f_######
 
| (Separate) data stream file
 
 
|}
 
|}
  
== Cache address ==
+
== File header ==
The cache address is 4 bytes in size and consists of:  
+
The file header is 84 bytes of size and consists of:
 
{| class="wikitable"
 
{| class="wikitable"
 
|-
 
|-
! offset
+
! Field
! size
+
! Offset
! value
+
! Length
! description
+
! Type
 +
! Notes
 
|-
 
|-
| <i>If file type is 0 (Separate file)</i>
+
| H1
|
+
| 0x0000
|
+
| 4
|
+
| DWORD
 +
| Format version (see format version section below)
 
|-
 
|-
| 0.0
+
| H2
| 28 bits
+
| 0x0004
|  
+
| 4
| File number <br> The value represents the value of # in f_######
+
| DWORD
 +
| Signature 'SCCA' (or in hexadecimal representation 0x53 0x43 0x43 0x4)
 
|-
 
|-
| <i>Else</i>
+
| H3
|
+
| 0x0008
|
+
| 4
|
+
| DWORD?
 +
| Unknown - Values observed: 0x0F - Windows XP, 0x11 - Windows 7, Windows 8.1
 
|-
 
|-
| 0.0
+
| H4
| 16 bits
+
| 0x000C
|  
+
| 4
| Block number
+
| DWORD
 +
| Prefetch file size (or length) (sometimes referred to as End of File (EOF)).
 
|-
 
|-
| 2.0
+
| H5
| 8 bits
+
|0x0010
|  
+
| 60
| File number (or file selector) <br> The value represents the value of # in data_#
+
| USTR
 +
| The name of the (original) executable as a Unicode (UTF-16 litte-endian string), up to 29 characters and terminated by an end-of-string character (U+0000). This name should correspond with the one in the prefetch file filename.
 
|-
 
|-
| 3.0
+
| H6
| 2 bits
+
|0x004C
|  
+
|4
| Block size <br> The number of contiguous blocks where 0 represents 1 block and 3 represents 4 blocks.
+
|DWORD
 +
|The prefetch hash. This hash value should correspond with the one in the prefetch file filename.
 
|-
 
|-
| 3.2
+
| H7
| 2 bits
+
|0x0050
|  
+
|4
| Reserved
+
|?
|-
+
| Unknown (flags)? Values observed: 0 for almost all prefetch files (XP); 1 for NTOSBOOT-B00DFAAD.pf (XP)
| <i>Common</i>
+
|
+
|
+
|
+
|-
+
| 3.4
+
| 3 bits
+
|
+
| File type
+
 
|-
 
|-
| 3.7
 
| 1 bit
 
|
 
| Initialized flag
 
 
|}
 
|}
  
=== File types ===
+
It's worth noting that the name of a carved prefetch file can be restored using the information in field H5 and H6, and its size can be determined by field H4.
 +
 
 +
=== Format version ===
 +
 
 
{| class="wikitable"
 
{| class="wikitable"
 
|-
 
|-
 
! Value
 
! Value
! Description
+
! Windows version
 
|-
 
|-
| 0
+
| 17 (0x11)
| (Separate) data stream file
+
| Windows XP, Windows 2003
 
|-
 
|-
| 1
+
| 23 (0x17)
| (Rankings) block data file (36 byte block data file)
+
| Windows Vista, Windows 7
|-
+
| 2
+
| 256 byte block data file
+
|-
+
| 3
+
| 1024 byte block data file
+
|-
+
| 4
+
| 4096 byte block data file
+
 
|-
 
|-
|
+
| 26 (0x1a)
|
+
| Windows 8.1 (note this could be Windows 8 as well but has not been confirmed)
 
|-
 
|-
| 6
 
| Unknown; seen on Mac OS  X 0x6f430074
 
 
|}
 
|}
  
==== Examples ====
+
=== File information ===
{| class="wikitable"
+
The format of the file information is version dependent.
|-
+
! Value
+
! Description
+
|-
+
| 0x00000000
+
| Not initialized
+
|-
+
| 0x8000002a
+
| Data stream file: f_00002a
+
|-
+
| 0xa0010003
+
| Block data file: data_1, block number 3, 1 block of size
+
|}
+
  
== Index file format (index) ==
+
Note that some other format specifications consider the file information part of the file header.
Overview:
+
* File header
+
* least recently used (LRU) data (or eviction control data)
+
* index table
+
  
=== File header ===
+
==== File information - version 17 ====
The index file header (struct IndexHeader) is 256 bytes in size and consists of:
+
The file information – version 17 is 68 bytes of size and consists of:
 
{| class="wikitable"
 
{| class="wikitable"
 
|-
 
|-
! offset
+
! Field
! size
+
! Offset
! value
+
! Length
! description
+
! Type
 +
! Notes
 
|-
 
|-
| 0
+
|  
 +
| 0x0054
 
| 4
 
| 4
| "\xc3\xca\x03\xc1"
+
| DWORD
| Signature
+
| The offset to section A. The offset is relative from the start of the file.
 
|-
 
|-
 +
|
 +
| 0x0058
 
| 4
 
| 4
| 2
+
| DWORD
 +
| The number of entries in section A.
 +
|-
 
|  
 
|  
| Minor version
+
| 0x005C
 +
| 4
 +
| DWORD
 +
| The offset to section B. The offset is relative from the start of the file.
 
|-
 
|-
| 6
 
| 2
 
 
|  
 
|  
| Major version
+
| 0x0060
 +
| 4
 +
| DWORD
 +
| The number of entries in section B.
 
|-
 
|-
| 8
+
|  
 +
| 0x0064
 
| 4
 
| 4
 +
| DWORD
 +
| The offset to section C. The offset is relative from the start of the file.
 +
|-
 
|  
 
|  
| Number of entries
+
| 0x0068
 +
| 4
 +
| DWORD
 +
| Length of section C.
 
|-
 
|-
| 12
+
|  
 +
| 0x006C
 
| 4
 
| 4
 +
| DWORD
 +
| Offset to section D. The offset is relative from the start of the file.
 +
|-
 
|  
 
|  
| Stored data size
+
| 0x0070
 +
| 4
 +
| DWORD
 +
| The number of entries in section D.
 
|-
 
|-
| 16
 
| 4
 
 
|  
 
|  
| Last created file number <br> The value represents the value of # in f_######
+
| 0x0074
|-
+
| 20
+
 
| 4
 
| 4
|  
+
| DWORD
| Dirty flag <br> Identifier for all entries being changed
+
| Length of section D.
 
|-
 
|-
| 24
 
| 4
 
 
|  
 
|  
| Usage statistics data cache address
+
| 0x0078
 +
| 8
 +
| FILETIME
 +
| Latest execution time (or run time) of executable (FILETIME)
 
|-
 
|-
| 28
 
| 4
 
 
|  
 
|  
| Table size <br> Where 0 represents 0x10000 (is this the same as the file size?)
+
| 0x0080
 +
| 16
 +
| ?
 +
| Unknown ? Possibly structured as 4 DWORD. Observed values: /0x00000000 0x00000000 0x00000000 0x00000000/, /0x47868c00 0x00000000 0x47860c00 0x00000000/ (don't exclude the possibility here that this is remnant data)
 
|-
 
|-
| 32
 
| 4
 
 
|  
 
|  
| Signals a previous crash
+
| 0x0090
|-
+
| 36
+
 
| 4
 
| 4
|  
+
| DWORD
| Identifier of an ongoing test or experiment
+
| Execution counter (or run count)
 
|-
 
|-
| 40
 
| 8
 
 
|  
 
|  
| Creation time
+
| 0x0094
 +
| 4
 +
| DWORD?
 +
| Unknown ? Observed values: 1, 2, 3, 4, 5, 6 (XP)
 
|-
 
|-
| 48
 
| 52 x 8 = 208
 
|
 
| Padding <br> Contains 0-byte values
 
 
|}
 
|}
  
==== Format versions ====
+
==== File information - version 23 ====
 +
The file information – version 23 is 156 bytes of size and consists of:
 
{| class="wikitable"
 
{| class="wikitable"
 
|-
 
|-
! Value
+
! Field
! Description
+
! Offset
 +
! Length
 +
! Type
 +
! Notes
 
|-
 
|-
|2.0
 
 
|  
 
|  
 +
| 0x0054
 +
| 4
 +
| DWORD
 +
| The offset to section A. The offset is relative from the start of the file.
 
|-
 
|-
| 2.1
 
 
|  
 
|  
|}
+
| 0x0058
 
+
| 4
=== Least recently used (LRU) data ===
+
| DWORD
The least recently used (LRU) data (struct LruData) is 112 bytes in size and consists of:
+
| The number of entries in section A.
{| class="wikitable"
+
 
|-
 
|-
! offset
+
|
! size
+
| 0x005C
! value
+
| 4
! description
+
| DWORD
 +
| The offset to section B. The offset is relative from the start of the file.
 
|-
 
|-
| 0
 
| 2 x 4 = 8
 
 
|  
 
|  
| Padding
+
| 0x0060
 +
| 4
 +
| DWORD
 +
| The number of entries in section B.
 
|-
 
|-
| 8
+
|  
 +
| 0x0064
 
| 4
 
| 4
 +
| DWORD
 +
| The offset to section C. The offset is relative from the start of the file.
 +
|-
 
|  
 
|  
| Filled flag <br> Value to indicate if when the cache was filled
+
| 0x0068
 +
| 4
 +
| DWORD
 +
| Length of section C.
 
|-
 
|-
| 12
 
| 5 x 4 = 20
 
 
|  
 
|  
| Array of sizes
+
| 0x006C
 +
| 4
 +
| DWORD
 +
| Offset to section D. The offset is relative from the start of the file.
 
|-
 
|-
| 32
 
| 5 x 4 = 20
 
 
|  
 
|  
| Array of head cache addresses
+
| 0x0070
 +
| 4
 +
| DWORD
 +
| The number of entries in section D.
 
|-
 
|-
| 52
 
| 5 x 4 = 20
 
 
|  
 
|  
| Array of tail cache addresses
+
| 0x0074
 +
| 4
 +
| DWORD
 +
| Length of section D.
 
|-
 
|-
| 72
 
| 4
 
 
|  
 
|  
| Transaction cache address <br> Value to indicate an in-flight operation
+
| <b>0x0078</b>
 +
| <b>8</b>
 +
| <b>?</b>
 +
| <b>Unknown</b>
 
|-
 
|-
| 76
 
| 4
 
 
|  
 
|  
| Operation <br> The in-flight operation
+
| 0x0080
 +
| 8
 +
| FILETIME
 +
| Latest execution time (or run time) of executable (FILETIME)
 
|-
 
|-
| 80
 
| 4
 
 
|  
 
|  
| Operations list <br> The in-flight operations list
+
| 0x0088
 +
| 16
 +
| ?
 +
| Unknown
 
|-
 
|-
| 84
 
| 7 x 4 = 28
 
 
|  
 
|  
| Padding <br> Contains 0-byte values
+
| 0x0098
|}
+
| 4
 
+
| DWORD
=== Array indexes ===
+
| Execution counter (or run count)
The array indexes correspond to the file types.
+
{| class="wikitable"
+
 
|-
 
|-
! Value
+
|
! Description
+
| 0x009C
 +
| 4
 +
| DWORD?
 +
| Unknown
 
|-
 
|-
| 0
+
|  
| Separate file
+
| <b>0x00A0</b>
 +
| <b>80</b>
 +
| <b>?</b>
 +
| <b>Unknown</b>
 
|-
 
|-
| 1
 
| (Rankings) block data file
 
|-
 
| 2
 
| 256 byte block data file
 
|-
 
| 3
 
| 1024 byte block data file
 
|-
 
| 4
 
| 4096 byte block data file
 
 
|}
 
|}
  
=== Index table ===
+
==== File information - version 26 ====
The index table is an array of cache addresses.
+
The file information – version 23 is 224 bytes of size and consists of:
 
+
== Data block file format (data_#) ==
+
Overview:
+
* File header
+
* array of blocks
+
 
+
=== File header ===
+
The index file header (struct BlockFileHeader) is 8192 bytes in size and consists of:
+
 
{| class="wikitable"
 
{| class="wikitable"
 
|-
 
|-
! offset
+
! Field
! size
+
! Offset
! value
+
! Length
! description
+
! Type
 +
! Notes
 
|-
 
|-
| 0
+
|  
 +
| 0x0054
 
| 4
 
| 4
| "\xc3\xca\x04\xc1"
+
| DWORD
| Signature
+
| The offset to section A. The offset is relative from the start of the file.
 
|-
 
|-
 +
|
 +
| 0x0058
 
| 4
 
| 4
| 2
+
| DWORD
 +
| The number of entries in section A.
 +
|-
 
|  
 
|  
| Minor version
+
| 0x005C
 +
| 4
 +
| DWORD
 +
| The offset to section B. The offset is relative from the start of the file.
 
|-
 
|-
| 6
 
| 2
 
 
|  
 
|  
| Major version
+
| 0x0060
 +
| 4
 +
| DWORD
 +
| The number of entries in section B.
 
|-
 
|-
| 8
 
| 2
 
 
|  
 
|  
| File number (or file index) <br> The value represents the value of # in data_#
+
| 0x0064
 +
| 4
 +
| DWORD
 +
| The offset to section C. The offset is relative from the start of the file.
 
|-
 
|-
| 10
 
| 2
 
 
|  
 
|  
| Next file number (or next file index) <br> The value represents the value of # in data_#
+
| 0x0068
 +
| 4
 +
| DWORD
 +
| Length of section C.
 
|-
 
|-
| 12
+
|  
 +
| 0x006C
 
| 4
 
| 4
 +
| DWORD
 +
| Offset to section D. The offset is relative from the start of the file.
 +
|-
 
|  
 
|  
| Block size (or cache entry) size
+
| 0x0070
 +
| 4
 +
| DWORD
 +
| The number of entries in section D.
 
|-
 
|-
| 16
+
|  
 +
| 0x0074
 
| 4
 
| 4
 +
| DWORD
 +
| Length of section D.
 +
|-
 
|  
 
|  
| Number of entries
+
| 0x0078
 +
| 8
 +
| ?
 +
| Unknown
 
|-
 
|-
| 20
 
| 4
 
 
|  
 
|  
| Maximum number of entries
+
| 0x0080
 +
| 8
 +
| FILETIME
 +
| Latest execution time (or run time) of executable (FILETIME)
 
|-
 
|-
| 24
 
| 4 x 4 = 16
 
 
|  
 
|  
| Array of empty entry counters <br> The counters of empty entries for each type
+
| <b>0x0088</b>
 +
| <b>7 x 8 = 56</b>
 +
| <b>FILETIME</b>
 +
| <b>Older (most recent) latest execution time (or run time) of executable (FILETIME)</b>
 
|-
 
|-
| 40
 
| 4 x 4 = 16
 
 
|  
 
|  
| Array of last used position (hints) <br> The last used position for each type
+
| <b>0x00C0</b>
 +
| <b>16</b>
 +
| <b>?</b>
 +
| <b>Unknown</b>
 
|-
 
|-
| 56
+
|  
 +
| 0x00D0
 
| 4
 
| 4
 +
| DWORD
 +
| Execution counter (or run count)
 +
|-
 
|  
 
|  
| Updating <br> Value to keep track of updates to the header
+
| <b>0x00D4</b>
 +
| <b>4</b>
 +
| <b>?</b>
 +
| <b>Unknown</b>
 
|-
 
|-
| 60
 
| 5 x 4 = 20
 
 
|  
 
|  
| User
+
| <b>0x00D8</b>
 +
| <b>4</b>
 +
| <b>?</b>
 +
| <b>Unknown</b>
 
|-
 
|-
| 80
 
| 2028 x 4 = 8112
 
 
|  
 
|  
| Block allocation bitmap
+
| <b>0x00DC</b>
 +
| <b>88</b>
 +
| <b>?</b>
 +
| <b>Unknown</b>
 +
|-
 
|}
 
|}
  
==== Format versions ====
+
== Section A ==
{| class="wikitable"
+
This section contains an array with 20 byte (version 17) or 32 byte (version 23 and 26) metrics entry records.
|-
+
! Value
+
! Description
+
|-
+
| 2.0
+
|
+
|-
+
| 2.1
+
|
+
|}
+
  
=== Cache entry ===
+
A metrics entry records conists of:
The cache entry (struct EntryStore) is 256 bytes in size and consists of:
+
 
{| class="wikitable"
 
{| class="wikitable"
 
|-
 
|-
! offset
+
! Field
! size
+
! Offset
! value
+
! Length
! description
+
! Type
 +
! Notes
 
|-
 
|-
 +
|
 
| 0
 
| 0
 
| 4
 
| 4
|  
+
| DWORD
| Hash <br> The hash of the key
+
| Start time in ms
 
|-
 
|-
 +
|
 
| 4
 
| 4
 
| 4
 
| 4
|  
+
| DWORD
| Next entry cache address <br> The next entry with the same hash or bucket
+
| Duration in ms
 
|-
 
|-
 +
|
 
| 8
 
| 8
 
| 4
 
| 4
|  
+
| DWORD
| Rankings node cache address
+
| Average duration in ms
 
|-
 
|-
 +
|
 
| 12
 
| 12
 
| 4
 
| 4
|  
+
| DWORD
| Reuse count <br> Value that indicates how often this entry was (re-)used
+
| Filename string offset <br> The offset is relative to the start of the filename string section (section C)
 
|-
 
|-
 +
|
 
| 16
 
| 16
 
| 4
 
| 4
|  
+
| DWORD
| Refetch count <br> Value that indicates how often this entry was (re-)fetched (or downloaded)
+
| Filename string number of characters without end-of-string character
 
|-
 
|-
 +
|
 
| 20
 
| 20
 
| 4
 
| 4
|  
+
| DWORD
| Cache entry state
+
| Unknown flags
 
|-
 
|-
| 24
 
| 8
 
 
|  
 
|  
| Creation time
+
| 24
|-
+
| 32
+
 
| 4
 
| 4
|  
+
| DWORD
| Key data size
+
| Unknown
 
|-
 
|-
| 36
+
|  
 +
| 28
 
| 4
 
| 4
|  
+
| DWORD
| Long key data cache address <br> The value is 0 if no long key data is present
+
| Unknown
 +
|}
 +
 
 +
== Section B ==
 +
This section contains an array with 12 byte (version 17, 23 and 26) entry records.
 +
 
 +
The actual format and usage of these entry records is currently not known.
 +
 
 +
== Section C - Filename strings ==
 +
This section contains filenames strings, it consists of an array of UTF-16 little-endian formatted strings with end-of-string characters (U+0000).
 +
 
 +
At the end of the section there seems to be alignment padding that can contain remnant values.
 +
 
 +
== Section D - Volumes information (block) ==
 +
 
 +
Section D contains one or more subsections, each subsection refers to directories on a volume.
 +
 
 +
If all the executables and libraries referenced in the C section are from one single disk volume, there will be only one section in the D section. If multiple volumes are referenced by section C, section D will contain multiple sections.  (A simple way to force this situation is to copy, say, NOTEPAD.EXE to a USB drive, and start it from that volume. The corresponding prefetch file will have one D header referring to, e.g. \DEVICE\HARDDISK1\DP(1)0-0+4 (the USB drive), and one to, e.g. \DEVICE\HARDDISKVOLUME1\ (where the .DLLs and other support files were found).
 +
 
 +
In this section, all offsets are assumed to be counted from the start of the D section.
 +
 
 +
=== Volume information ===
 +
The structure of the volume information is version dependent.
 +
 
 +
==== Volume information - version 17 ====
 +
The volume information – version 17 is 40 bytes in size and consists of:
 +
 
 +
{| class="wikitable"
 
|-
 
|-
| 40
+
! Field
| 4 x 4 = 16
+
! Offset
|
+
! Length
| Array of data stream sizes
+
! Type
 +
! Notes
 
|-
 
|-
| 56
+
| VI1
| 4 x 4 = 16
+
| +0x0000
|  
+
| 4
| Array of data stream cache addresses
+
| DWORD
 +
| Offset to volume device path (Unicode, terminated by U+0000)
 
|-
 
|-
| 72
+
| VI2
 +
| +0x0004
 
| 4
 
| 4
|  
+
| DWORD
| Cache entry flags
+
| Length of volume device path (nr of characters, including terminating U+0000)
 
|-
 
|-
| 76
+
| VI3
| 4 x 4 = 16
+
| +0x0008
|  
+
| 8
| Padding
+
| FILETIME
 +
| Volume creation time.
 
|-
 
|-
| 92
+
| VI4
 +
| +0x0010
 
| 4
 
| 4
|  
+
| DWORD
| Self hash <br> The hash of the first 92 bytes of the cache entry is this used as a checksum?
+
| Volume serial number of volume indicated by volume string
 
|-
 
|-
| 96
+
| VI5
| 160
+
| +0x0014
|  
+
| 4
| Key data <br> Contains an UTF-8 encoded string with an end-of-string character with the original URL
+
| DWORD
|}
+
| Offset to sub section E
 
+
==== Array indexes ====
+
The data stream array indexes correspond to:
+
{| class="wikitable"
+
 
|-
 
|-
! Value
+
| VI6
! Description
+
| +0x0018
 +
| 4
 +
| DWORD
 +
| Length of sub section E (in bytes)
 
|-
 
|-
| 0
+
| VI7
| HTTP response headers
+
| +0x001C
 +
| 4
 +
| DWORD
 +
| Offset to sub section F
 
|-
 
|-
| 1
+
| VI8
| Page contents (Payload)
+
| +0x0020
 +
| 4
 +
| DWORD
 +
| Number of strings in sub section F
 
|-
 
|-
| 2
+
| VI9
|  
+
| +0x0024
 +
| 4
 +
| ?
 +
| Unknown
 
|-
 
|-
| 3
 
|
 
 
|}
 
|}
  
==== Cache entry state ====
+
==== Volume information - version 23 ====
{| class="wikitable"
+
The volume information entry – version 23 is 104 bytes in size and consists of:
|-
+
! Value
+
! Identifier
+
! Description
+
|-
+
| 0
+
| ENTRY_NORMAL
+
| Normal cache entry
+
|-
+
| 1
+
| ENTRY_EVICTED
+
| The cache entry was recently evicted
+
|-
+
| 2
+
| ENTRY_DOOMED
+
| The cache entry was doomed
+
|}
+
  
==== Cache entry flags ====
 
 
{| class="wikitable"
 
{| class="wikitable"
 
|-
 
|-
! Value
+
! Field
! Identifier
+
! Offset
! Description
+
! Length
 +
! Type
 +
! Notes
 
|-
 
|-
| 0x00000001
+
| VI1
| PARENT_ENTRY
+
| +0x0000
| Parent cache entry
+
| 4
 +
| DWORD
 +
| Offset to volume device path (Unicode, terminated by U+0000)
 
|-
 
|-
| 0x00000002
+
| VI2
| CHILD_ENTRY
+
| +0x0004
| Child cache entry
+
| 4
|}
+
| DWORD
 
+
| Length of volume device path (nr of characters, including terminating U+0000)
=== Rankings node ===
+
The rankings node (struct RankingsNode) is 36 bytes in size and consists of:
+
{| class="wikitable"
+
 
|-
 
|-
! offset
+
| VI3
! size
+
| +0x0008
! value
+
! description
+
|-
+
| 0
+
 
| 8
 
| 8
|  
+
| FILETIME
| Last used <br> Contains LRU information?
+
| Volume creation time.
 
|-
 
|-
| 8
+
| VI4
| 8
+
| +0x0010
|  
+
| 4
| Last modified <br> Contains LRU information?
+
| DWORD
 +
| Volume serial number of volume indicated by volume string
 
|-
 
|-
| 16
+
| VI5
 +
| +0x0014
 
| 4
 
| 4
|  
+
| DWORD
| Next rankings node cache address
+
| Offset to sub section E
 
|-
 
|-
| 20
+
| VI6
 +
| +0x0018
 
| 4
 
| 4
|  
+
| DWORD
| Previous rankings node cache address
+
| Length of sub section E (in bytes)
 
|-
 
|-
| 24
+
| VI7
 +
| +0x001C
 
| 4
 
| 4
|  
+
| DWORD
| Cache entry cache address
+
| Offset to sub section F
 
|-
 
|-
| 28
+
| VI8
 +
| +0x0020
 
| 4
 
| 4
|  
+
| DWORD
| Is dirty flag
+
| Number of strings in sub section F
 
|-
 
|-
| 32
+
| VI9
 +
| +0x0024
 
| 4
 
| 4
|  
+
| ?
| Self hash <br> The hash of the first 32 bytes of the rankings node is this used as a checksum?
+
| Unknown
 +
|-
 +
| <b>VI10</b>
 +
| <b>+0x0028</b>
 +
| <b>28</b>
 +
| <b>?</b>
 +
| <b>Unknown</b>
 +
|-
 +
| <b>VI11</b>
 +
| <b>+0x0044</b>
 +
| <b>4</b>
 +
| <b>?</b>
 +
| <b>Unknown</b>
 +
|-
 +
| <b>VI12</b>
 +
| <b>+0x0048</b>
 +
| <b>28</b>
 +
| <b>?</b>
 +
| <b>Unknown</b>
 +
|-
 +
| <b>VI13</b>
 +
| <b>+0x0064</b>
 +
| <b>4</b>
 +
| <b>?</b>
 +
| <b>Unknown</b>
 +
|-
 
|}
 
|}
  
== Data stream ==
+
==== Volume information - version 26 ====
The data stream is stored inside the data block file (data_#), for small amounts of data, or stored as a separate file (f_######). The data stream is stored as a [[gzip|gzip file]].
+
The volume information entry – version 26 appears to be similar to volume information – version 23.
  
Note that the last modification time of the gzip file is set to 0.
+
=== Sub section E - NTFS file references ===
 +
This sub section can contain NTFS file references.
  
== Hash ==
+
For more information see [https://googledrive.com/host/0B3fBvzttpiiSbl9XZGZzQ05hZkU/Windows%20Prefetch%20File%20(PF)%20format.pdf Windows Prefetch File (PF) format].
The hash algorithm used is referred to as SuperFastHash. A pseudo C implementation:
+
<pre>
+
uint32_t SuperFastHash(
+
          const uint8_t *key,
+
          size_t key_size )
+
{
+
    size_t key_index    = 0;
+
    size_t remainder    = 0;
+
    uint32_t hash_value = 0;
+
    uint32_t temp_value = 0;
+
  
    if( ( key == NULL ) || ( key_siz 0 ) )
+
=== Sub section F - Directory strings ===
    {
+
This sub sections contains directory strings. The number of strings is stored in the volume information.
      return( 0 );
+
    }
+
    remainder = key_size % 4;
+
    key_size -= remainder;
+
  
    for( key_index = 0;
+
A directory string is stored in the following structure:
        key_index < key_size;
+
{| class="wikitable"
        key_index += 4 )
+
|-
    {
+
! Field
        hash_value += key[ key_index ] + ( key[ key_index + 1 ] << 8 );
+
! Offset
        temp_value  = key[ key_index + 2 ] + ( key[ key_index + 3 ] << 8 );
+
! Length
 
+
! Type
        temp_value = ( temp_value << 11 ) ^ hash_value;
+
! Notes
 
+
|-
        hash_value  = ( hash_value << 16 ) ^ temp_value;
+
|
        hash_value += hash_value >> 11;
+
| 0x0000
    }
+
| 2
 
+
| DWORD
    switch( remainder )
+
| Number of characters (WORDs) of the directory name. The value does not include the end-of-string character.
    {
+
|-
        case 3:
+
|
            hash_value += key[ key_index ] + ( key[ key_index + 1 ] << 8 );
+
| 0x0002
            hash_value ^= hash_value<< 16;
+
|
            hash_value ^= key[ key_index + 2 ] << 18;
+
| USTR
            hash_value += hash_value >> 11;
+
| The directory name as a Unicode (UTF-16 litte-endian string) terminated by an end-of-string character (U+0000).
            break;
+
|-
 
+
|}
        case 2:
+
            hash_value += key[ key_index ] + ( key[ key_index + 1 ] << 8 );
+
            hash_value ^= hash_value << 11;
+
            hash_value += hash_value >> 17;
+
            break;
+
 
+
        case 1:
+
            hash_value += key[ key_index ];
+
            hash_value ^= hash_value << 10;
+
            hash_value += hash_value >> 1;
+
            break;
+
    }
+
 
+
    /* Force "avalanching" of final 127 bits */
+
    hash_value ^= hash_value << 3;
+
    hash_value += hash_value >> 5;
+
    hash_value ^= hash_value << 4;
+
    hash_value += hash_value >> 17;
+
    hash_value ^= hash_value << 25;
+
    hash_value += hash_value >> 6;
+
 
+
    return hash_value;
+
}
+
</pre>
+
  
 
== See Also ==
 
== See Also ==
* [[Google Chrome]]
+
* [[Prefetch]]
* [[gzip]]
+
  
 
== External Links ==
 
== External Links ==
* [http://www.chromium.org/developers/design-documents/network-stack/disk-cache Disk Cache], The Chromium Projects
+
* [https://googledrive.com/host/0B3fBvzttpiiSbl9XZGZzQ05hZkU/Windows%20Prefetch%20File%20(PF)%20format.pdf Windows Prefetch File (PF) format], by the [[libssca|libssca project]]
* [https://e366e647f8637dd31e0a13f75e5469341a9ab0ee.googledrive.com/host/0B30H7z4S52FleW5vUHBnblJfcjg/Docs/Chrome%20Cache%20file%20format.pdf Chrome Cache file format], by the [[plaso|plaso project]], April 2014
+
* [http://bitbucket.cassidiancybersecurity.com/prefetch-parser/wiki/Home Windows Prefetch file format], by the [http://bitbucket.cassidiancybersecurity.com/prefetch-parser prefetch-parser] project.
  
 
[[Category:File Formats]]
 
[[Category:File Formats]]

Revision as of 10:57, 22 June 2014

Information icon.png

Please help to improve this article by expanding it.
Further information might be found on the discussion page.

A Windows Prefetch file consists of one file header and multiple file sections with different content. Not all content has an obvious forensic value.

As far as have been possible to ascertain, there is no public description of the format. The description below has been synthesised from examination of multiple prefetch files.

Characteristics

Integers stored in little-endian
Strings Stored as UTF-16 little-endian without a byte-order-mark (BOM).
Timestamps Stored as Windows FILETIME in UTC.

File header

The file header is 84 bytes of size and consists of:

Field Offset Length Type Notes
H1 0x0000 4 DWORD Format version (see format version section below)
H2 0x0004 4 DWORD Signature 'SCCA' (or in hexadecimal representation 0x53 0x43 0x43 0x4)
H3 0x0008 4 DWORD? Unknown - Values observed: 0x0F - Windows XP, 0x11 - Windows 7, Windows 8.1
H4 0x000C 4 DWORD Prefetch file size (or length) (sometimes referred to as End of File (EOF)).
H5 0x0010 60 USTR The name of the (original) executable as a Unicode (UTF-16 litte-endian string), up to 29 characters and terminated by an end-of-string character (U+0000). This name should correspond with the one in the prefetch file filename.
H6 0x004C 4 DWORD The prefetch hash. This hash value should correspond with the one in the prefetch file filename.
H7 0x0050 4 ? Unknown (flags)? Values observed: 0 for almost all prefetch files (XP); 1 for NTOSBOOT-B00DFAAD.pf (XP)

It's worth noting that the name of a carved prefetch file can be restored using the information in field H5 and H6, and its size can be determined by field H4.

Format version

Value Windows version
17 (0x11) Windows XP, Windows 2003
23 (0x17) Windows Vista, Windows 7
26 (0x1a) Windows 8.1 (note this could be Windows 8 as well but has not been confirmed)

File information

The format of the file information is version dependent.

Note that some other format specifications consider the file information part of the file header.

File information - version 17

The file information – version 17 is 68 bytes of size and consists of:

Field Offset Length Type Notes
0x0054 4 DWORD The offset to section A. The offset is relative from the start of the file.
0x0058 4 DWORD The number of entries in section A.
0x005C 4 DWORD The offset to section B. The offset is relative from the start of the file.
0x0060 4 DWORD The number of entries in section B.
0x0064 4 DWORD The offset to section C. The offset is relative from the start of the file.
0x0068 4 DWORD Length of section C.
0x006C 4 DWORD Offset to section D. The offset is relative from the start of the file.
0x0070 4 DWORD The number of entries in section D.
0x0074 4 DWORD Length of section D.
0x0078 8 FILETIME Latest execution time (or run time) of executable (FILETIME)
0x0080 16  ? Unknown ? Possibly structured as 4 DWORD. Observed values: /0x00000000 0x00000000 0x00000000 0x00000000/, /0x47868c00 0x00000000 0x47860c00 0x00000000/ (don't exclude the possibility here that this is remnant data)
0x0090 4 DWORD Execution counter (or run count)
0x0094 4 DWORD? Unknown ? Observed values: 1, 2, 3, 4, 5, 6 (XP)

File information - version 23

The file information – version 23 is 156 bytes of size and consists of:

Field Offset Length Type Notes
0x0054 4 DWORD The offset to section A. The offset is relative from the start of the file.
0x0058 4 DWORD The number of entries in section A.
0x005C 4 DWORD The offset to section B. The offset is relative from the start of the file.
0x0060 4 DWORD The number of entries in section B.
0x0064 4 DWORD The offset to section C. The offset is relative from the start of the file.
0x0068 4 DWORD Length of section C.
0x006C 4 DWORD Offset to section D. The offset is relative from the start of the file.
0x0070 4 DWORD The number of entries in section D.
0x0074 4 DWORD Length of section D.
0x0078 8 ? Unknown
0x0080 8 FILETIME Latest execution time (or run time) of executable (FILETIME)
0x0088 16  ? Unknown
0x0098 4 DWORD Execution counter (or run count)
0x009C 4 DWORD? Unknown
0x00A0 80 ? Unknown

File information - version 26

The file information – version 23 is 224 bytes of size and consists of:

Field Offset Length Type Notes
0x0054 4 DWORD The offset to section A. The offset is relative from the start of the file.
0x0058 4 DWORD The number of entries in section A.
0x005C 4 DWORD The offset to section B. The offset is relative from the start of the file.
0x0060 4 DWORD The number of entries in section B.
0x0064 4 DWORD The offset to section C. The offset is relative from the start of the file.
0x0068 4 DWORD Length of section C.
0x006C 4 DWORD Offset to section D. The offset is relative from the start of the file.
0x0070 4 DWORD The number of entries in section D.
0x0074 4 DWORD Length of section D.
0x0078 8  ? Unknown
0x0080 8 FILETIME Latest execution time (or run time) of executable (FILETIME)
0x0088 7 x 8 = 56 FILETIME Older (most recent) latest execution time (or run time) of executable (FILETIME)
0x00C0 16 ? Unknown
0x00D0 4 DWORD Execution counter (or run count)
0x00D4 4 ? Unknown
0x00D8 4 ? Unknown
0x00DC 88 ? Unknown

Section A

This section contains an array with 20 byte (version 17) or 32 byte (version 23 and 26) metrics entry records.

A metrics entry records conists of:

Field Offset Length Type Notes
0 4 DWORD Start time in ms
4 4 DWORD Duration in ms
8 4 DWORD Average duration in ms
12 4 DWORD Filename string offset
The offset is relative to the start of the filename string section (section C)
16 4 DWORD Filename string number of characters without end-of-string character
20 4 DWORD Unknown flags
24 4 DWORD Unknown
28 4 DWORD Unknown

Section B

This section contains an array with 12 byte (version 17, 23 and 26) entry records.

The actual format and usage of these entry records is currently not known.

Section C - Filename strings

This section contains filenames strings, it consists of an array of UTF-16 little-endian formatted strings with end-of-string characters (U+0000).

At the end of the section there seems to be alignment padding that can contain remnant values.

Section D - Volumes information (block)

Section D contains one or more subsections, each subsection refers to directories on a volume.

If all the executables and libraries referenced in the C section are from one single disk volume, there will be only one section in the D section. If multiple volumes are referenced by section C, section D will contain multiple sections. (A simple way to force this situation is to copy, say, NOTEPAD.EXE to a USB drive, and start it from that volume. The corresponding prefetch file will have one D header referring to, e.g. \DEVICE\HARDDISK1\DP(1)0-0+4 (the USB drive), and one to, e.g. \DEVICE\HARDDISKVOLUME1\ (where the .DLLs and other support files were found).

In this section, all offsets are assumed to be counted from the start of the D section.

Volume information

The structure of the volume information is version dependent.

Volume information - version 17

The volume information – version 17 is 40 bytes in size and consists of:

Field Offset Length Type Notes
VI1 +0x0000 4 DWORD Offset to volume device path (Unicode, terminated by U+0000)
VI2 +0x0004 4 DWORD Length of volume device path (nr of characters, including terminating U+0000)
VI3 +0x0008 8 FILETIME Volume creation time.
VI4 +0x0010 4 DWORD Volume serial number of volume indicated by volume string
VI5 +0x0014 4 DWORD Offset to sub section E
VI6 +0x0018 4 DWORD Length of sub section E (in bytes)
VI7 +0x001C 4 DWORD Offset to sub section F
VI8 +0x0020 4 DWORD Number of strings in sub section F
VI9 +0x0024 4  ? Unknown

Volume information - version 23

The volume information entry – version 23 is 104 bytes in size and consists of:

Field Offset Length Type Notes
VI1 +0x0000 4 DWORD Offset to volume device path (Unicode, terminated by U+0000)
VI2 +0x0004 4 DWORD Length of volume device path (nr of characters, including terminating U+0000)
VI3 +0x0008 8 FILETIME Volume creation time.
VI4 +0x0010 4 DWORD Volume serial number of volume indicated by volume string
VI5 +0x0014 4 DWORD Offset to sub section E
VI6 +0x0018 4 DWORD Length of sub section E (in bytes)
VI7 +0x001C 4 DWORD Offset to sub section F
VI8 +0x0020 4 DWORD Number of strings in sub section F
VI9 +0x0024 4  ? Unknown
VI10 +0x0028 28 ? Unknown
VI11 +0x0044 4 ? Unknown
VI12 +0x0048 28 ? Unknown
VI13 +0x0064 4 ? Unknown

Volume information - version 26

The volume information entry – version 26 appears to be similar to volume information – version 23.

Sub section E - NTFS file references

This sub section can contain NTFS file references.

For more information see Windows Prefetch File (PF) format.

Sub section F - Directory strings

This sub sections contains directory strings. The number of strings is stored in the volume information.

A directory string is stored in the following structure:

Field Offset Length Type Notes
0x0000 2 DWORD Number of characters (WORDs) of the directory name. The value does not include the end-of-string character.
0x0002 USTR The directory name as a Unicode (UTF-16 litte-endian string) terminated by an end-of-string character (U+0000).

See Also

External Links