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:PBZX

From ReverseEngineering.wiki
Format
Vendor Apple
Magic 70 62 7A 78 ("pbzx")
Extensions .pbzx, payload files in OTA/pkg
Endianness big-endian
On this wiki Facts · Code · Notes · Topics

pbzx is the chunked xz stream that wraps the payload of Apple OTA updates and some installer packages: the ASCII magic "pbzx", a big-endian block size, then chunks each preceded by two big-endian 64-bit sizes.

Layout

Read from ipsw pkg/ota/pbzx/read.go (blacktop/ipsw, MIT):

char     magic[4];      // "pbzx"
uint64_t blockSize;     // big-endian
// repeated until end of file:
uint64_t inflateSize;   // big-endian: size of this chunk after decompression
uint64_t deflateSize;   // big-endian: size of the chunk data that follows
uint8_t  data[deflateSize];

Rules in that reader: if deflateSize < inflateSize the chunk data is an xz stream that must decompress to exactly inflateSize bytes; if the two are equal the chunk is stored as is; deflateSize > inflateSize is rejected as a bad chunk header. The chunks are concatenated in order to form the output. The decompressor used is an xz reader on each chunk separately (multistream off).

What it contains

Unverified: the concatenated output is a cpio archive in the OTA payload files and in some flat .pkg Payload members (see Format:XAR archive); check the first bytes of the output (070707 or 070701 for cpio) after decompressing.

Identification

First four bytes 70 62 7A 78. ipsw has a pbzx command that checks this magic before decompressing.

Code & repositories