Introduction
Thumbs.db is the hidden file in which Windows Explorer kept the thumbnails
of a folder’s pictures, in Windows Me, Windows 2000 and Windows XP. It sits beside the
pictures, and is not updated when they are moved or deleted, so it can still hold
thumbnails of pictures that have gone.
Microsoft has not published the format. It is a Microsoft Compound File, the container of older Office documents, which is documented; the streams inside are known only from reverse engineering, chiefly Vinetto, and from what 372 distinct real Thumbs.db files show.
Windows Vista and later normally keep their thumbnails in per-user files instead,
in %LocalAppData%\Microsoft\Windows\Explorer: an index,
thumbcache_idx.db, and one cache file for each size,
thumbcache_32.db, thumbcache_96.db,
thumbcache_256.db, thumbcache_1024.db,
thumbcache_sr.db and others. They are not Compound Files but a format
of their own, whose signatures are CMMM (the cache files) and
IMMM (the index). Both are described here, under
Cache files and
Index file. Some later Thumbs.db files
(with streams named by a size and a hash, and no Catalog) are also found in picture
folders.
A Thumbs.db or thumbcache_*.db dropped on any page opens in
the explorer, which shows the thumbnails as pictures, each with its file name and
modified date from the catalogue (Thumbs.db) or its identifier and checksum state (the
cache files), the structure of the file, and a table of every entry. For a Thumbs.db it
also recovers the thumbnails of deleted pictures left in free sectors. When a folder of
thumbnail caches is opened instead of a single file, the index file follows each row into
the cache files beside it and shows the pictures, and each cache file shows which index row
holds each of its entries. A file named like one of these that is not one, such as a text
file, is reported as not a thumbnail cache.
Structure
The file is a Compound File holding
one stream for each thumbnail. In the usual form there is also a stream called
Catalog, which lists the pictures: the
Catalog page describes it. Each
thumbnail stream has a small header,
then a JPEG or PNG image. A second form has no Catalog, and each stream is named by a
size and a hexadecimal hash.
0Compound File header version, sector sizes, where the FAT and the directory are512512Sectors the FAT, the directory and the streams, in any ordervaries…Catalog stream a header, then one entry per picturevaries…Thumbnail streams named by the entry’s number reversed, each a short header and an imagevaries
Structure of the Windows Vista and later files
A cache file is a 24-byte header
(CMMM, a format version from 20 to 32, a cache type, the offset of the
first entry and of the first free one) followed by entries. Each entry has a 48 or
56-byte header (a size, a 64-bit hash, the sizes of the identifier, padding and picture,
and two CRC-64 checksums), the identifier as UTF-16 text, and the picture as a whole
BMP, JPEG or PNG file. The index file
(IMMM) is a header and a table with a row for each picture: its hash,
flags and the offset of its entry in each cache file.
0Header CMMM, version, cache type, first entry, first free entry2424Entry header with the hash and two CRC-64s, identifier, padding, pictureEntry size…More entries back to back; the last one is free spacevaries
thumbcache_*.db).Not described
The pages follow Vinetto, libwtcdb, thumbcache_viewer and the real files named on each page. The parts below are not yet described, or not yet decoded by the file explorer, which labels them in its tree and views and shows their bytes instead of guessing. This page’s ratings stay partial.
Known, not yet covered
- Viewer: the file names of Vista and later thumbnails are read from the
Windows Search index (
windows.edb, an Extensible Storage Engine database, which the explorer now reads) when it is dropped with the cache files: theSystem_ThumbnailCacheIdcolumn holds the same number as the entry hash. That lookup was written from the column names and values of a real Windows.edb and from this page’s findings; no real thumbnail cache from the same machine as a Windows.edb was available to check it end to end. Without a Windows.edb the viewer shows the identifier only (the copy on a running Windows is locked by the Windows Search service). - Reference and viewer: the Windows 8 (version 30) layouts of the index file, and versions 26 and 28 of the cache file: from the sources only, no real file (Windows Vista, 7, 8.1, 10 and 11 files were checked). The dissect.thumbcache test data holds Vista, 7, 8.1, 10 and 11 only, and the test machine is Windows 11.
Unknown
- Reference and viewer: how the thumbnail cache ID, and so the entry hash, is computed. Searched: libwtcdb (marks it unknown), thumbcache_viewer, Vinetto, dissect.thumbcache, Velociraptor’s ThumbCache artifact, forensics.wiki, Microsoft’s property page, and Yogesh Khatri’s 2012 post, which gives the Windows 7 algorithm (shown on the cache page). That algorithm does not reproduce the IDs of a real Windows 11 machine, which were measured for 43 pictures and for files with one property changed at a time; they show the inputs are the volume, file ID, extension (case-sensitive) and the modification time to the 100-nanosecond tick, not the name or folder. The hash of the entries named by a string (shell folders, paths) is not that function over the string either. Windows 11’s own code was read (the public symbols of thumbcache.dll, windows.storage.dll and windows.storage.search.dll, from the Windows 11 machine): the hash function and its starting value are still Khatri’s, the inputs are the volume’s 16 bytes, the file reference number, the extension and some words of the item’s own data, and the Thumbs.db hashed streams use the same function from another starting value (details); the exact set and order of inputs, and how the modification time to the tick enters, were not reproduced. The viewer shows the number and, for pictures, says it is the ID; it computes none.
- Reference and viewer: the unknown words: the word at entry offset 36 (zero in every sample), the word after the flags in Windows 8 and later index rows, the index flag bits beyond the lowest, the word at 12 of a cache header and the word before an index header’s signature. They are shown as numbers.
- Reference and viewer: what the
sr,wide,exif,wide_alternateandcustom_streamcaches hold: they are empty (24 bytes) in every real file checked, including a Windows 11 machine after thumbnails of 43 pictures had been made. Theiconcache_*.dbfiles written by that machine do have the cache layout (all their entries and checksums read), and the viewer reads anyCMMMfile the same way. - Reference: the meaning of the Catalog’s four versions (4, 5, 6 and 7), the three extra words of the 24-byte thumbnail header, and the fourth channel of the older thumbnails (shown as ignored). Searched: Vinetto’s source (reads the version and ignores it), the libforensics Thumbs.db documentation, the Multimedia Wiki, PRONOM, forensics.wiki, LEADTOOLS’ TDB page and the Microsoft thumbnail cache API pages (IThumbnailCache): none gives the numbers a meaning.
Also used for
- SQLite 2 database – SQLite 2.6 to 2.8’s file: 1,024-byte pages in the machine’s byte order, every value text.
- SQLite 3 database – A whole SQL database in one file: pages of b-trees, typed values, UTF-8 or UTF-16 text.
Links
Software
- Windows Explorer – writes and reads these files in picture folders (Windows)
- Vinetto – forensic tool that lists and extracts Thumbs.db and thumbcache thumbnails (Python)
- thumbcache_viewer – extracts and checks the pictures in thumbcache_*.db files (Windows)
Reference
- MS-CFB – Microsoft’s specification of the Compound File container
- Thumbs.db on the Forensics Wiki – notes on the format
- libwtcdb: Windows Explorer Thumbnail Cache database format – Joachim Metz’s document on the thumbcache files
- libolecf: OLE Compound File format – the container of Thumbs.db
- Windows thumbcache on the Forensics Wiki – notes and file locations