Introduction
A .crx file packages an extension for
Google Chrome and other Chromium-based
browsers. It is a ZIP archive of the extension’s
files, with a header in front that holds the public keys and signatures. The
extension’s description, permissions and scripts are in a
manifest.json at the top of the archive.
The format has had two versions. CRX3 is the current one. CRX2 was simpler, a single key and a signature. Chromium’s verifier today accepts only version 3.
Structure
Both versions start with the four bytes Cr24 and a 32-bit
little-endian version number. A .crx dropped on any page of this site
opens in the explorer, which shows the header field by field, the manifest, and every
member of the archive.
0Magic number43 72 32 34,Cr244 bytes4Version 3 (or, in old files, 2)4 bytes8Header proofs and signed data (CRX3), or a public key and a signature (CRX2)varies…ZIP archivemanifest.jsonand the extension’s filesvaries
Offsets inside the ZIP archive count from the start of the archive, not from the start of the file. So a ZIP reader that looks for the end record finds the archive, and the header in front looks like a prefix.
The rest of the format is described on these pages:
- CRX3 header – the current format, byte by byte
- CRX2 header – the old format, byte by byte
- Signing and IDs – what is signed, and how the extension ID comes from the key
Not described
Known, not yet covered
- Viewer: the
verified_contentssignatures over the individual files (a gzip-compressed JSON document, the signed hashes the Chrome Web Store adds) are shown as a size, not decoded or checked. The CRX3 and CRX2 signatures themselves are verified; what the explorer checks lists what is and is not decided. - Viewer: trust is not decided. A valid signature shows the file is what its key signed; the page marks the Chrome Web Store’s key by its hash, but whether Chrome would install the file is up to Chrome’s own key list. Keys that are not RSA or P-256, and archives over 256 MB, show as not checked.
- Reference: the files an extension holds are not described here:
_locales/<language>/messages.json(the translated strings that__MSG_name__values in the manifest resolve through), the update manifest atupdate_url, and how Chrome installs a package from the Chrome Web Store or by policy. The manifest.json pages describe the manifest. - Viewer: the few manifest keys that Chromium’s feature list names but no reference page describes are listed as raw JSON in an “Other keys” table; the manifest.json page names them.
Links
Software
- Google Chrome – Google’s browser, which installs extensions from .crx packages (Windows, macOS, Linux)
- Chromium – the open-source browser Chrome is built on, with the code that verifies these files
Reference
- crx3.proto – Chromium’s definition of the CRX3 header
- components/crx_file – Chromium’s code that reads and verifies the format
- Chrome extensions documentation – Google’s guides to building extensions