Jump to content
Setting up an AI agent? ReverseEngineering.wiki skill (works from the command line, no configuration): https://reverseengineering.wiki/skill/rewiki/SKILL.md · setup for every client, including MCP: https://reverseengineering.wiki/llms.txt · REWiki:Connect

Format:Compound File Binary

From ReverseEngineering.wiki
Format
On this wiki Facts · Code · Notes · Topics

Microsoft's Compound File Binary (CFB, OLE2 structured storage) container: magic D0 CF 11 E0 A1 B1 1A E1, a sector-based mini file system with FAT, mini-FAT, DIFAT and a directory of storages and streams; the container of MSI packages and pre-2007 Office files.

The Compound File Binary format (CFB, also called OLE2, structured storage or OLECF; specified in [MS-CFB]) is a small file system inside one file: storages (directories) hold streams (files). It carries Windows Installer packages (Format:Windows Installer MSI), legacy Office documents (.doc, .xls, .ppt) and many caches. Unpack it first, then reverse the streams. Source for the layout: libolecf (libyal, LGPL), olecf_file_header.h, olecf_directory.h, libolecf_definitions.h.in.

Identification

  • Magic D0 CF 11 E0 A1 B1 1A E1 at offset 0. The libolecf header comment also lists the alternative 0E 11 FC 0D D0 CF 11 0E.
  • Tool:Advanced Installer and some Tool:InstallShield setups wrap or append a compound file; search the overlay for the magic.

Header (512 bytes, little endian)

Names follow libolecf; [MS-CFB] names in brackets.

Offset Size Field
0x00 8 signature
0x08 16 class identifier (CLSID), usually zero
0x18 2 minor version
0x1A 2 major version (3 = 512-byte sectors with sector shift 9, 4 = 4096-byte with shift 0xC; read in [MS-CFB] v20240423, which also says minor version SHOULD be 0x003E, byte order MUST be 0xFFFE, mini sector shift MUST be 6, the mini stream cutoff MUST be 0x1000, and in version 4 the 3584 bytes after the 512-byte header must be zero)
0x1C 2 byte order, FFFE = little endian
0x1E 2 sector shift (default 9 = 512 bytes)
0x20 2 mini sector shift (default 6 = 64 bytes)
0x22 10 reserved
0x2C 4 number of SAT [FAT] sectors
0x30 4 sector id of the first directory sector
0x34 4 transaction signature
0x38 4 stream size below which data lives in the mini stream
0x3C 4 first SSAT [mini FAT] sector
0x40 4 number of SSAT sectors
0x44 4 first MSAT [DIFAT] sector
0x48 4 number of MSAT sectors
0x4C 436 first 109 MSAT entries (sector ids of FAT sectors)

Sectors and chains

  • Special sector ids: FFFFFFFC = sector belongs to the MSAT/DIFAT, FFFFFFFD = belongs to the SAT/FAT, FFFFFFFE = end of chain, FFFFFFFF = unused.
  • A stream is a chain: the directory entry holds the first sector, the FAT entry of each sector gives the next. Sector n starts at file offset (n + 1) * sector size (sector 0 begins right after the header sector), and the mini stream cutoff is 4096 bytes: a stream of 4096 bytes or more uses normal FAT sectors, a smaller one the mini FAT (both from [MS-CFB] v20240423). In version 3 files the Number of Directory Sectors header field must be zero.
  • Streams below the cutoff are stored in the mini stream (a stream of the root entry) in 64-byte units chained through the mini FAT.
  • More than 109 FAT sectors: the header's MSAT is continued by the DIFAT chain.

Directory entries (128 bytes)

Offset Size Field
0x00 64 name, UTF-16LE
0x40 2 name size in bytes
0x42 1 type: 0 empty, 1 storage, 2 stream, 3 lock bytes, 4 property, 5 root storage
0x43 1 node colour: 0 red, 1 black
0x44 4 previous directory id
0x48 4 next directory id
0x4C 4 sub-directory id (child tree of a storage)
0x50 16 CLSID
0x60 4 user flags
0x64 8 creation time
0x6C 8 modification time
0x74 4 first sector
0x78 4 size
0x7C 4 reserved

Siblings form a red-black tree through previous/next ids. The first entry is the root storage.

Property sets

Streams whose name starts with the control character U+0005 (for example \x05SummaryInformation) are property sets (title, author, template, code page). libolecf parses them. In an MSI they hold the package summary.

Tools

libolecf (olecfinfo, olecfexport), 7-Zip, msitools (understands the MSI stream-name encoding, see Format:Windows Installer MSI).

Code & repositories

  • https://github.com/libyal/libolecf @ 88674c272cbf39b31b011f0c0e719e4dcacae7d7 · license: LGPL-3.0
    libyal C library and tools (olecfinfo, olecfexport) for the OLE compound file format; headers define the file header, directory entry, sector ids and item types.
    Tested on: source read, not run: source reading only · checked 2026-10-18; last activity 2026-10-10

See also

Format:Windows Installer MSI, Format:Microsoft Cabinet, Technique:Identifying the toolchain of a binary.

Also Format:Windows Jump Lists: .automaticDestinations-ms files are compound files holding LNK streams.

Also Format:Outlook MSG: Outlook .msg messages are compound files with __substg1.0_* property streams.