Microsoft Compound File


 * "OLE" redirects here. See also OLE 1.0 object.

Microsoft Compound File is a complex container format used by some versions of Microsoft Office, and other Windows-centric applications. It has features similar to those of a filesystem format.

Its name has many variations, including:
 * Compound File Binary File Format (CFBF or CFB)
 * Microsoft Compound Document File Format
 * OLE Compound Document Format
 * OLE2 Compound Document Format
 * Composite Document File
 * DocFile

The format was not publicly documented by Microsoft until 2008.

It is (or was?) unofficially known as LAOLA File Format.

Identification
Files begin with signature bytes.

Identifying the specific document type can be difficult. Some, but not all, document types can be identified by the CLSID field in the "root storage" directory entry. This field is usually located at file offset 512×(1 + {the 32-bit integer at offset 48}) + 80.

Some files have a stream named " " containing metadata, which may include information about the creating application.

Root storage object CLSIDs
The table below lists some of the root storage object CLSIDs that have been observed in this type of file. Use this information at your own risk, as these identifiers can be unreliable.

Microsoft's documentation says this about the CLSID field:

"This field contains an object class GUID. [...] If not [all zeroes], the object class GUID can be used as a parameter to start applications."

Although every storage object (think subdirectory) can have a CLSID, this table is only concerned with the file's root storage object.

Note that the CLSIDs are stored as GUIDs in little-endian binary format, so they have a strange byte order.

Related formats

 * OLE Property Set

For formats based on this format, see Category:Microsoft Compound File.

Specifications

 * MSDN: Compound File Binary File Format → [MS-CFB] PDF
 * OpenOffice.org's documentation

Programs, libraries, and utilities

 * Structured Storage Viewer
 * libolecf
 * OleFileIO_PL - a Python module to read MS OLE2 files
 * oledump.py beta
 * officeparser
 * python-oletools - python tools to analyze OLE files
 * OpenMCDF
 * Apache POI - Java API for Microsoft documents
 * Re-lab / OLE Toy
 * 7-Zip

Sample files

 * https://telparia.com/fileFormatSamples/archive/msCompound/travel.gal

Links

 * Wikipedia article
 * Forensics Wiki article
 * Joel on Software: Why are the Microsoft Office file formats so complicated?
 * Some (older) reverse engineered information here and a Perl module here
 * Malicious Office macros are not dead
 * MS Office 97-2003 legacy/binary formats security - article with lots of resources on MS Office formats, including analysis techniques, tools and parsing libraries
 * MSDN: Providing Summary Information