Skip to content

Keystone

Keystone's published firmware, checked against its published source with cverif. No device has a verification target yet: below are our research notes on the release channel, image format and build.

About Keystone's firmware ​

Repository: https://github.com/KeystoneHQ/keystone3-firmware. Facts below were checked against master at commit bd06fe2e (2026-11-26), tag 4.0.2 (commit 5db5cf2e), and the published 4.0.2 Bitcoin-only file. Research date: 2026-12-04.

Verdict: possible, low priority. The application image can be extracted from the release file and matches the vendor's published build hash (checked here), and the build is reproduced by WalletScrutiny. But the MCU is a Chinese security MCU with closed parts, the bootloader is closed and travels inside the release file, most of the wallet logic is Rust, and the build is heavy and only loosely pinned. cverif would cover the C side: FreeRTOS, drivers, UI, secure-element drivers, the BIP-39/SLIP-39 code and the firmware-update code.

1. Device, MCU, published images ​

itemvaluesource
deviceKeystone 3 Pro (firmware "G3"); three editions: Multi-coin ("web3"), Bitcoin-only, Cypherpunkbuild.py (-t btc_only, -t cypherpunk), release notes
MCUMegaHunt MH1903, built as Cortex-M4 with FPv4-SP, hard-float ABIREADME.md; firmware.cmake (-mcpu=cortex-m4 -mfloat-abi=hard -mfpu=fpv4-sp-d16)
application address0x01081000 (external QSPI flash, executed in place)mh1903b.ld (FLASH ORIGIN = 0x01081000); src/boot_update.c (APP_ADDR)
bootloaderat 0x01001000, not open sourcesrc/boot_update.c (BOOT_ADDR)
secure elementsMicrochip ATECC608A, Maxim DS28C50, Maxim MAX32520README.md

Whether the MH1903 core is an Arm Cortex-M4 or a licensed Arm core sold under another name (SecurCore) was not established here; the compiler is told cortex-m4 with an FPU, which is what cverif will use.

Published images: only the application update file keystone3.bin, one per edition. It contains the application and, appended, a signed bootloader update (boot.sig) that is not in the public repository (section 3). Secure-element firmware is the chip vendors' and is not published.

2. Release channel ​

  • Download: https://keyst.one/firmware (a script-driven page) links to https://keyst.one/contents/KeystoneFirmwareG3/v<version>/<edition>/keystone3.bin with <edition> in web3, btc_only, cypherpunk (for 4.0.2; 3.9.9 also has legacy_ota, purpose not checked). During this research the CDN (CloudFront) answered HTTP 403 to requests with curl's default User-Agent and served the files to a browser-like one.
  • GitHub releases (https://github.com/KeystoneHQ/keystone3-firmware/releases) have no assets: the body gives, per edition, the sha256 of the signed keystone3.bin and a "Source Code SHA-256 Checksum", which is the sha256 of the build output mh1903.bin (checked below). The device can display the same value (guide.keyst.one/docs/verify-checksum; computation in src/ui/gui_model/gui_model.c).
  • Tags: plain version numbers (4.0.2, 3.2.2, …), lightweight (not annotated, not signed). Release branches release/vX.Y.Z exist for some versions. No release names a commit; the tag is the only link. 3.9.9, 4.0.0 and 4.0.2 were all published on 2026-11-24.
  • No detached signature or PGP; the vendor signature is inside the file.

Checked on 4.0.2 Bitcoin-only: the downloaded file (3667811 bytes) has sha256 155ac40a…dd147c2, as in the GitHub release body.

3. Image format ​

From tools/code/firmware-maker/src/main.rs (the open-source "OTA maker"), tools/code/firmware-checker/src/main.rs, tools/padding_bin_file/padding_bin_file.py, build.py, and the published file:

keystone3.bin = u32 LE header length (348)
              ‖ header
              ‖ 0x00
              ‖ QuickLZ level-3 stream, one block per 16 KiB of mh1903_full.bin

header        = "~fwdata!"
              ‖ u32 BE compressed size ‖ u32 BE original size
              ‖ sha256(compressed stream) ‖ sha256(mh1903_full.bin)
              ‖ u32 BE encode = 1 ‖ u32 BE unit = 16384 ‖ u32 BE encrypt = 0
              ‖ signature, 256 ASCII hex characters (empty in an unsigned file)

mh1903_full.bin = mh1903.bin                       (the application, at 0x01081000)
                ‖ "mh1903bootupdate" ‖ u32 BE len(boot.sig) ‖ sha256(boot.sig)
                ‖ boot.sig[0:0x134] ‖ 0xFF to a 4 KiB boundary
                ‖ boot.sig[0x134:] ‖ 0xFF to a 4 KiB boundary
  • The signature's algorithm and what it covers are decided by the closed bootloader; not determined here. The unsigned file the vendor tool makes differs from the release in the header length and the signature only.
  • boot.sig (the bootloader update, 404188 bytes in 4.0.2) is copied in by build.py from tools/boot.sig if present; it is not in the public tree, so a local build gives mh1903_full.bin = mh1903.bin and the release's appended part cannot be reproduced. The running application installs it (src/boot_update.c, which looks for the mh1903bootupdate marker in flash at 4 KiB steps).
  • To compare with a local build: decompress, check both header hashes, cut at the 4 KiB-aligned mh1903bootupdate record (the first match in the data is a string inside the application, at an unaligned offset), compare the part before it with mh1903.bin.

Checked on 4.0.2 Bitcoin-only, with a small QuickLZ decompressor written for this: both header hashes match; the decompressed image is 5812224 bytes; the boot-update record starts at 0x526000; the 5398528 bytes before it have sha256 e340360f…6fdc465, the release's "Source Code SHA-256 Checksum" for Bitcoin-only. The vector table gives initial SP 0x20005e10 and reset handler 0x0112ded5, inside the application range.

4. Build ​

  • Documented procedure (docs/verify.md): clone, git -c submodule.keystone3-firmware-release.update=none submodule update --init --recursive (that submodule is private), docker pull keystonehq/keystone3_baker:1.0.2 (or build the Dockerfile), git checkout tags/<tag>, then docker run -v $(pwd):/keystone3-firmware keystonehq/keystone3_baker:1.0.2 python3 build.py -e production [-t btc_only | -t cypherpunk]; compare sha256sum build/mh1903.bin with the release's source checksum. A machine with 16 GB RAM (32 GB recommended) is required.
  • Environment (Dockerfile): ubuntu:22.04 with unpinned apt packages, Rust installed with rustup and the toolchain from rust-toolchain (nightly-2026-05-22 at master), cbindgen and bindgen-cli installed without version pins, GNU Arm 9-2019-q4-major downloaded by URL (no hash check). The image is referenced by tag (1.0.2), not digest. On Docker Hub that tag was last pushed on 2024-04-28 (digest sha256:9d54ee99…), while rust-toolchain has changed since (2025-03, 2025-07, 2026-04, 2026-07): the image's rustup presumably installs the newer nightly named in the repository at build time (network access during the build); not checked.
  • Build system: build.py → CMake (-DLIB_RUST_C=ON -DBUILD_PRODUCTION=true -DRU_SUPPORT=true, plus -DBTC_ONLY / -DCYPHERPUNK) → make -j; Cargo builds librust_c.a (rust/rust_c), linked with the C objects and the prebuilt external/mh1903_lib/MHSCPU_Driver/lib/MH1903_QRDecodeLib.a. C flags: -Os (from MCU_FLAGS), -ffunction-sections-style section flags, --gc-sections, newlib nano.
  • Reproducibility: claimed by the vendor (docs/verify.md). WalletScrutiny (https://old.walletscrutiny.com/hardware/keystone3.pro) reports 1.6.0 (2024-08), 1.7.12 (2024-12-10) and 2.0.0 (2025-02-21) as reproducible; the current page (https://walletscrutiny.com/hardware/keystone3.pro/, dated 2026-10-30) says its reviewers built 3.2.0 Multi and Bitcoin-only and that the payloads matched (as read from the page; not reproduced here).

5. Language split ​

Rough line counts at master: about 130k lines of first-party C and headers in src/ (plus about 127k lines of generated image/font tables in src/ui/gui_assets), about 140k lines of Rust in rust/, and about 730k lines of vendored C in external/ (LVGL, SQLite, FreeRTOS, cryptoauthlib, cJSON, ctaes, FatFs, safec, the MH1903 drivers and USB stack).

  • Rust (out of scope): per README.md, "most of the blockchain-related functionality … including transaction signing, address generation, and cryptographic operations" (rust/apps/*, rust/keystore, rust/rust_c). Its dependency tree includes secp256k1-sys (libsecp256k1 in C, compiled by the cc crate), so some C ends up inside the Rust static library.
  • C (in scope): FreeRTOS and tasks, drivers (src/driver, including the secure-element drivers such as drv_atecc608b.c), key storage and settings (src/managers/keystore.c), BIP-39 and SLIP-39 (src/crypto/bips, src/crypto/slip39), firmware and bootloader update (src/boot_update.c), USB/WebUSB protocol, the LVGL UI and its assets.
  • Closed: the bootloader, MH1903_QRDecodeLib.a, the MCU's ROM, the SE firmware.

Best cverif targets: src/managers/keystore.c, the SE drivers, SLIP-39/BIP-39, and the update path (boot_update.c), which decides what gets written to the bootloader area.

6. Plan for targets/keystone/keystone3-btc.sh (and -multi, -cypherpunk) ​

stepwhat to do
t_releasesGitHub releases API (tags), keeping those whose body has the checksum sections
t_fetchdownload keyst.one/contents/KeystoneFirmwareG3/v<ver>/<edition>/keystone3.bin; record its sha256 and the two hashes from the GitHub release body for that edition; check the file hash
t_sourceclone tag <ver> with public submodules (skip keystone3-firmware-release); the tag is lightweight and no commit is published, so record the resolved commit only
t_buildpython3 build.py -e production -t <edition> in keystonehq/keystone3_baker:1.0.2, compare mh1903.bin with the release's source checksum; instrumented rebuild with wrappers for arm-none-eabi-gcc/ar (CMake and Cargo's cc crate)
t_extractnew fwimage.py keystone3 parser: header, QuickLZ decompression (level 3, 16 KiB blocks; about 60 lines of Python), both header hashes, split at the aligned boot-update record; code.bin at 0x01081000; the boot-update record reported as unverified (closed bootloader); cpu = cortex-m4 with FPv4, hard-float
t_verify, t_reportas usual; report Rust and closed bytes separately

Expected difficulties:

  • The bootloader is closed and the release file carries a new one each time; nothing in this pipeline can say anything about it, and the signature check that protects the device is in it.
  • Most of the wallet logic is Rust; as for BitBox02, C objects from cc inside the Rust static library need special handling in the bundle exporter.
  • Build environment: unpinned tools, a mutable image tag, a nightly Rust, network access during the build, and a large memory footprint. Old releases may not rebuild identically; the fallback is --discover with the bundle.
  • The MH1903 is not an ST or Microchip part: no public reference manual was checked here for its memory map, and peripheral accesses through vendor driver code (external/mh1903_lib) are verified as written in C only.
  • Three editions per release, each a separate build and target.

Priority: low. After KeepKey, BitBox02 and the Coldcard bootloader.

Results are produced by scripts anyone can re-run. MIT licensed.