Format:Chrome extension package (CRX3)
| On this wiki | Facts · Code · Notes · Topics |
|---|
The .crx file of Chrome and Chromium extensions: magic Cr24, version 3, a little-endian header length, a protobuf CrxFileHeader holding signature proofs, then an ordinary ZIP archive with manifest.json.
Layout (components/crx_file/crx3.proto, BSD)
| Offset | Size | Field |
|---|---|---|
| 0 | 4 | magic Cr24 (43 72 32 34)
|
| 4 | 4 | format version, little-endian (3) |
| 8 | 4 | N, little-endian: length of the header |
| 12 | N | header: protobuf message CrxFileHeader
|
| 12+N | rest | ZIP archive |
CrxFileHeader fields: sha256_with_rsa (2, repeated AsymmetricKeyProof{public_key=1, signature=2}), sha256_with_ecdsa (3), verified_contents (4, bytes, gzip of UTF-8 JSON), signed_header_data (10000, bytes: a SignedData message whose field 1 crx_id is 16 bytes: the first 128 bits of the SHA-256 of the developer public key). Signatures cover "CRX3 SignedData" 00 | u32le size of signed_header_data | signed_header_data | archive.
CRX2 (version 2) instead has public key and signature lengths in the fixed header (Unverified: from memory).
Extracting
Read the u32 at offset 8, skip 12+N bytes, unzip the rest; or find the ZIP by scanning for PK\x03\x04 (the ZIP central directory works even with the prefix; most unzip tools accept it). Extension id: derived from crx_id, each nibble mapped to letters a-p (Unverified).
manifest.json
manifest_version2 or 3. MV2 usesbackgroundwithscriptsorpage(persistent),browser_action/page_action,permissionsmixing API and host patterns. MV3 uses abackground.service_worker,action, separatehost_permissionsanddeclarative_net_request(Unverified: from memory, not read in a source).- Entry points to read:
background,content_scripts[].js,web_accessible_resources,externally_connectable,permissions. Code is usually a webpack or esbuild bundle: Technique:Reversing bundled JavaScript. - Firefox
.xpiis a plain ZIP with the same manifest (no CRX header).
Code & repositories
- https://github.com/chromium/chromium (BSD-3), components/crx_file/crx3.proto