Skip to content
Back to Blog
Fundamentals

Inside Rootstock's powHSM security model

Read Time: 9 mins
Inside Rootstock’s powHSM security model: Lessons from recent hardware wallet attacks

₿ Summary

Rootstock’s PowPeg uses powHSM to protect the private keys involved in Bitcoin peg-outs. Unlike consumer hardware wallets, powHSM does not display or export recovery phrases, and signing a peg-out requires authorization backed by proof of work. No single device controls the peg: moving pegged bitcoin takes a threshold of signatures from PowPeg members, each running its own powHSM.

Two recent hardware wallet incidents highlight two different risks. In October 2026, implants hidden inside Ledger devices sold through one authorized reseller read the 24-word recovery phrase off the screen during setup. In July 2026, a Coldcard firmware bug produced seeds with as little as 40 bits of entropy, which attackers guessed offline.

Neither of the reported attack mechanisms applies to powHSM. It never produces, displays or exports a recovery phrase, so there is nothing on the screen to read. Its seed mixes the secure element’s hardware RNG with 32 bytes from the host’s cryptographic RNG, so a weakness in one source does not make it guessable. Even an attacker able to send commands to the device would not get peg-out signatures without a Bridge release event backed by cumulative proof of work.

This article links each claim to the powHSM source code at commit 42fffae. 


₿ Recent hardware wallet security incidents

Ledger: implant inside the device

On October 9, 2026, owners of Ledger devices bought through an authorized reseller in Southeast Asia reported drained wallets. On-chain researchers estimate up to $93.2 million stolen from more than 300 wallets; Ledger has not confirmed totals (CoinDesk).

Ledger’s investigation update describes the mechanism (CoinDesk):

  • A microcontroller was placed inside the device enclosure.
  • When the device showed the recovery phrase during setup, the implant read and decoded the words from the screen.
  • It sent the words to the attacker over LTE using an eSIM.
  • It did not modify the secure element, the operating system, transactions or signatures.

Ledger’s own update is clear on the limits of the attack: “There was no flaw in Ledger’s chip, operating system or servers.” The implant went around the secure element, not through it. The attacker never needed the device again: the recovery phrase alone recreates the wallet elsewhere.

That reseller is the only one confirmed so far. Reports of tampered units from other resellers in Singapore and Germany remain unconfirmed (Halborn, Coinpedia).

The attack had one requirement: a secret worth stealing must appear on the screen.

Coldcard: predictable seeds

Starting July 30, 2026, attackers drained about 1,816 BTC from more than 5,200 addresses generated on Coldcard devices (TRM Labs).

Since firmware 4.0.0 (March 2021), seed generation called MicroPython’s pseudo-random generator instead of the device’s hardware RNG. That left as little as 40 bits of entropy on Mk2/Mk3 devices, so attackers enumerated candidate seeds offline and swept the ones holding funds, without ever touching a device (Halborn, Forbes).

Owners who added their own dice rolls at setup were not affected (24/7 Wall St.).

₿ What powHSM is

powHSM protects the private keys of the Rootstock PowPeg members. On Ledger hardware it is a pair of custom apps for the Ledger Nano S, a UI that replaces Ledger’s own dashboard and a Signer, plus host-side middleware (README). It builds on Ledger’s secure element to hold the keys, and on Ledger’s device certificate to prove which code is running.

It is not a consumer wallet. A consumer wallet shows the recovery phrase on purpose: it’s how owners back up their funds and get them back if the device is lost. powHSM does a different job, so it skips that step. There is no recovery phrase, no backup, no on-device PIN entry and no human confirming transactions on the screen. The device is driven entirely by its PowPeg node over USB, and it signs Bitcoin pegout transactions only when the Rootstock chain, validated inside the device, proves they were requested.

powHSM runs on the Ledger Nano S, so it’s fair to ask whether the PowPeg uses hardware from the October attack. It doesn’t. All devices used in the PowPeg were procured directly from Ledger, years before this campaign, and none passed through the resellers involved. More on this in “How the PowPeg devices were sourced” below.

A consumer wallet setup and the institutional-grade powHSM setup differ exactly where the implant operated:

Step Consumer Ledger powHSM (Nano S)
Seed generation On device On device, mixed with host entropy
Recovery phrase Shown on screen for the user to write down Never shown, never stored, zeroized
PIN Typed on device buttons Sent by the host over USB
Screen content Seed words, addresses, amounts Four fixed status strings
What authorizes a signature User presses a button Bridge event + cumulative proof of work

₿ How powHSM protects against screen-based attacks

All links point to commit 42fffae of rsk-powhsm.

1. The seed is generated and stored inside the secure element, and is never displayed or exported

The RSK WIPE command in the UI app does the whole onboarding inside the secure element (onboard.c L70–L102):

  1. os_perso_wipe() erases any pre-existing seed on the device (for example, one set up before purchase or loaded by whoever tampered with it), so powHSM never inherits a seed that someone else may have seen.
  2. cx_rng() draws 32 bytes from the secure element’s RNG and XORs them with 32 host-supplied bytes (set_host_seed, L133–L146).
  3. The result is converted to a mnemonic in RAM, the raw seed is cleared with explicit_bzero, the mnemonic is passed to os_perso_derive_and_set_seed(), and then the mnemonic buffer is cleared too.

No code path writes the mnemonic to the screen, to the USB channel or to flash. The only references to the mnemonic buffer in the UI app are inside this function. The UI does not back up the keys it generates (attestation.md, UI attestation). The secret the Ledger implant harvested does not exist outside the secure element on a powHSM device.

Diagram of powHSM seed generation: os_perso_wipe() clears any existing seed, then 32 bytes from the secure element RNG (cx_rng) are XORed with 32 bytes from the host OS RNG (os.urandom) to form a 256-bit seed inside the secure element. The mnemonic is set with os_perso_derive_and_set_seed() and zeroized. It is never shown on screen, sent over USB or written to flash.

2. The screen shows only fixed status text

The UI and Signer replace Ledger’s dashboard. In release builds, the only text they can draw comes from four static strings:

No seed words, keys, PINs, addresses or transaction data are rendered. A screen-scraping implant on a powHSM device records these four strings and nothing else.

Diagram of the text powHSM can draw on the device screen, all fixed at build time: FAB MODE, UI waiting for update, Processing..., and Signer running... with the version number. Seed words, private keys, PIN, addresses and transaction data are never rendered.

3. The PIN is never typed or shown on the device

The PIN reaches the secure element one byte per APDU from the host (pin.c L49–L62). It must be exactly 8 alphanumeric characters with at least one letter (pin_policy.c L33–L51). Ledger’s recovery screen only accepts numeric PINs, so the only way into it is three wrong PIN attempts, which wipe the device and its keys (attestation.md).

4. Private keys are used inside the secure element and never leave it

Signing derives the BIP32 key with os_perso_derive_node_bip32, signs with cx_ecdsa_sign, and zeroizes the key material before returning (seed.c L91–L131). Only public keys and signatures are returned to the host. Ledger confirmed its implant did not modify or read the secure element.

5. Pegout signatures require proof of work, not a button press

The keys that control PowPeg Bitcoin (the BTC/testnet BTC paths) are on an allowlist that requires authorization (pathAuth.c L74–L113). For those keys the Signer only signs a Bitcoin transaction when:

Diagram of the three checks behind a powHSM peg-out signature: a Bridge release event containing the Bitcoin transaction hash, a receipts-trie proof to a block the device validated, and cumulative merge-mined work of at least MIN_REQUIRED_DIFFICULTY. A button press, the PIN, USB command access or root on the PowPeg host are not enough on their own.

Even with access to the device, its PIN and USB channel, an attacker would still need to satisfy the proof-of-work and Bridge release requirements to obtain a pegout signature.

6. Firmware changes require authorization and can be detected through attestation

The UI only launches an app whose hash matches the authorized Signer hash (ux_handlers.c L40–L58). Changing that hash requires N-of-M signatures from authorizers hardcoded in the UI, with downgrade prevention (signer-authorization.md). The attestation, rooted in Ledger’s issuer certificate and Endorsement Scheme Two, proves which UI and Signer are running on a genuine secure element and which public keys they control (attestation.md). A tampered device with modified firmware cannot produce a valid attestation for the published build.

₿ How powHSM generates unpredictable seeds

powHSM’s seed generation is not exposed to this class of bug:

  • Two independent sources, mixed by XOR. The seed is 32 bytes from the secure element’s RNG (cx_rng) XORed with 32 bytes supplied by the host (onboard.c L73–L78). The result is at least as unpredictable as the stronger of the two inputs. A bug like this in either source alone would not make the seed guessable. This is the same protection that saved Coldcard users who added dice rolls, applied by default.
  • The host side uses the OS cryptographic RNG. The onboarding tool generates the host bytes with os.urandom (admin/onboard.py L205–L206).
  • The device side has no silent fallback. cx_rng is the only randomness source in the onboarding code; there is no software generator it can fall back to.
  • Full 256-bit seed. Both inputs and the result are 32 bytes, encoded as a 24-word mnemonic.
  • No single device holds the peg. Each PowPeg member onboards its own device independently, and moving pegged funds takes a threshold of signatures from the Bitcoin multisig. Guessing one device’s seed would not be enough.

₿ Independent audits

powHSM’s design and code have been reviewed by external firms; the reports are listed in the repository’s audits directory.

Auditor Date Scope Report
Quarkslab Jun–Jul 2025, control audit Dec 2025 Intel SGX implementation (v5.4.0+) 25-07-2216-REP-v1.1.pdf
NCC Group Jun–Oct 2022 Ledger Nano S powHSM, v3.0.0–3.0.1 (UI and Signer) Public report

NCC Group reviewed the Ledger UI and Signer apps this post relies on and reported only low-severity findings, all fixed (Rootstock blog). The Quarkslab audit covers the SGX implementation.

₿ Security against more advanced attacks

The sections above cover the implant Ledger described, which only reads the screen. This section looks at two stronger attack scenarios: an implant on the device’s internal bus and an attacker with root access to the PowPeg host. Under powHSM’s documented security model, neither scenario allows an attacker to extract private keys, authorize pegouts without the required proof of work, or install an unauthorized Signer. Both could, however, obtain signatures from non-authorized keys that do not control Bitcoin funds.

powHSM holds two sets of keys. The authorized keys control the bitcoin in the peg and only sign with proof of work. The non-authorized keys (RSK and MST paths) are protected by the PIN alone and are used for non-critical PowPeg operations, such as signing PowPeg-only transactions on Rootstock (README). They do not control BTC.

Table showing that against a screen-reading implant, a bus-level implant and an attacker with root on the PowPeg host, the seed, private keys, peg-out authorization and Signer authorization stay protected. Non-authorized RSK and MST keys can still sign arbitrary hashes and do not control Bitcoin funds.

Bus-level implant

This is a stronger attack than the one Ledger found. Suppose an implant sat on the internal wiring between the USB port, the Nano S’s general-purpose chip (MCU) and the secure element. It could see the PIN and the host entropy the host sends during setup, and it could send its own commands (APDUs) to the device.

The host entropy is useless on its own, because the secure element mixes it with its own random bytes. The PIN plus the ability to send commands would let it get signatures from the non-authorized keys (RSK and MST paths), which sign any hash by design (README). It still could not sign pegouts (reason 5), extract keys (reason 4) or install a different Signer (reason 6).

Attestation does not see extra hardware. It proves a genuine secure element running the published UI and Signer. It says nothing about additional components inside the enclosure. Detecting those depends on procurement and physical inspection.

Host compromise

A root-level attacker on the PowPeg host is in the same position as the bus-level implant: PIN plus full command channel. It still cannot extract keys or sign pegouts.

The middleware reads the PIN from a plaintext file on the host, or from the PIN environment variable (manager_ledger.py L31–L40, pin.py L66–L74). On first start without a PIN file, the manager replaces the setup PIN with a newly generated one and writes it to disk (protocol.py L189–L205). Before every unlock it checks the remaining PIN retries, so a wrong PIN cannot wipe the device by accident (protocol.py L163–L181).

For the non-authorized keys, the PIN is the only protection. The keys that control bitcoin also need a Bridge release event and cumulative proof of work, so knowing the PIN is not enough to move pegged funds (README).

With host root, an attacker can With host root, an attacker cannot
Sign arbitrary hashes with the non-authorized RSK and MST keys Read or export any private key (reason 4)
Stop the device or the middleware (denial of service) Sign a pegout without a Bridge release event and the required cumulative work (reason 5)
Feed the device a fake chain Make the device accept that chain without real merge-mined work (reason 5)
— Install a different Signer without N-of-M authorizer signatures (reason 6)

This is the threat model RootstockLabs already publishes: the Immunefi program scope treats an attacker with root on the host running the node, middleware and HSM as an in-scope “local” attacker.

How the PowPeg devices were sourced

powHSM runs on the Ledger Nano S with Ledger firmware 1.3.1, the version its UI and Signer are built for; the UI is installed in recovery mode in place of Ledger’s dashboard (firmware/README.md). All devices used in the PowPeg were procured directly from Ledger, years before this campaign, and none passed through the resellers involved. Spare devices, still new and unopened, are kept in separate secure locations.


Sources

powHSM code and docs (commit 42fffae)

Recommended articles

Vetiver 9.0.2: Patch Release

Vetiver 9.0.2: Patch Release

This patch release fixes an issue reported by users after upgrading to Vetiver 9.0.0, which prevents some Testnet nodes from successfully completing a full blockchain synchronization, especially after a node restart. It also introduces minor performance and security improvements. Although this is not a mandatory release, Testnet nodes should be updated to this version to […]

Ecosystem Updates
Cardamom 10.0.0: What to Expect

Cardamom 10.0.0: What to Expect

This blog post outlines the Rootstock Improvement Proposals (RSKIPs) proposed for inclusion in Rootstock’s next network upgrade and explains how you can make your voice heard.  Every Rootstock network upgrade is named after a plant rootstock symbolising how Rootstock allows new capabilities to grow from the foundations of the Bitcoin network. Past upgrades include Bamboo, […]

Ecosystem Updates
Bitcoin at 18: The story so far

Bitcoin at 18: The story so far

Happy Birthday to the Bitcoin Whitepaper which turns 18 today! From an idea on a mailing list to an asset held by public companies, funds and governments. The journey the big B took to get here was full of ups and downs but is magic internet money starting to grow up?  From humble beginnings Bitcoin began […]

Fundamentals