Zenpanik
Deep Dive

Hardware wallets, randomness, and the vaults behind every device

Your random number generator can be perfect. Your process is where the black swans live.

By Pavel Nikolov, November 7, 2026
Billions of atoms move at random. The cup stays put.

On October 29, 2026, Binance lost about $6.3 billion, the largest crypto theft on record. Binance says it has found no evidence that a private key leaked. The attackers spent months working through engineers' laptops, reached the exchange's internal signing service, and had it sign for them.

Every security posture, whether it protects a retail crypto holder, a neobank's card program, or a custodian with billions on balance sheet, eventually reduces to one question: where does the private key live, and who can make it sign? Firewalls, fraud models, and compliance programs all sit above that question. If the key leaks or is predictable, nothing above it matters.

For the fintech founders, bank technology leaders, and custody teams reading this, I see hardware wallets as the most visible, single-purpose example of a pattern that now runs through almost every device we own: a small, isolated piece of silicon that generates keys from physical randomness, never exports them, and signs only when policy allows.

The same pattern shows up under different names. Apple calls it the Secure Enclave. Google calls it Titan M2 and StrongBox. Microsoft calls it TPM and Pluton. Banks call it an HSM. Ledger, Trezor, and Coldcard call it a secure element. The marketing differs, but the security model rests on two shared primitives.

Randomness that cannot be predicted

A key is only as strong as the entropy used to create it. Most real-world key compromises in crypto came from weak random number generation, with the cryptography left intact.

Isolation that cannot be bypassed

A key is only as safe as the boundary around it. The question is whether that boundary is a separate chip, a separate processor core, or just a separate process on a shared CPU.

I read both primitives through Nassim Taleb. Billions of atoms in the coffee cup on your desk move at random, yet the cup never jumps, because countless small fluctuations cancel out. A sound hardware random number generator behaves the same way. The cup still breaks when someone knocks it off the desk. You can have the best random number generator in the world, and your process can still expose you to black swans.

In this deep dive, I break down how pseudo-random and true random generators differ and where they failed in Milk Sad, Randstorm, the $160 million Wintermute loss, Coldcard's 2026 seed bug and the eMudhra certificate keys. I apply Taleb's Mediocristan and Extremistan to key custody, map the hardware vault family from TEEs to HSMs, and compare how iPhones, MacBooks, Android phones, Windows PCs, security keys, and hardware wallets use them. I take apart the Bybit and Binance breaches and the tampered Ledger devices step by step and close with a five-layer custody model for fintechs and banks.

A timeline of key failures, 2008 to 2026

Every incident in this piece, newest first. The tag shows which layer failed: the randomness behind the key, the hardware holding it, or the process around it. Each name links to its source, and the right-hand link goes to the part that covers it.

Oct 2026Process
BinanceAbout $6.3 billion left hot wallets after attackers reached the internal signing service; Binance reports no evidence a key leaked.
Part 4
Oct 2026Entropy
eMudhraA key-ceremony script left eight intermediate CA keys recoverable in under a second; eMudhra left the global TLS business.
Below
Oct 2026Process
Ledger via CryptoBilisDevices sold through one reseller carried a hidden chip that read the recovery phrase off the screen at setup; more than $90 million drained, by on-chain estimates.
Part 4
Jul 2026Entropy
ColdcardFirmware from March 2021 never used the device's hardware random generator; about 1,816 BTC, roughly $116 million, drained from more than 5,200 addresses.
Below
Mar 2025Hardware
Trezor Safe 3Ledger Donjon showed a voltage glitch on the microcontroller could bypass supply-chain protections.
Part 4
Feb 2025Process
BybitAbout $1.5 billion lost when signers approved, on Ledger devices, a payload that differed from what the web UI showed.
Part 4
Sep 2024Hardware
EUCLEAKA side channel in Infineon's ECDSA library let attackers with physical access extract keys from YubiKey 5 below firmware 5.7.
Part 3
May 2023Process
Ledger RecoverAn opt-in service splitting an encrypted seed into three custodian-held shards showed the firmware can send encrypted seed material off the device.
Part 4
Jun 2023Entropy
Milk SadLibbitcoin Explorer seeds were limited to 32 bits of entropy and were exploited in June and July 2023.
Below
Sep 2022Entropy
WintermuteAbout $160 million lost through a Profanity vanity address, generated from a 32-bit seed, that still held admin rights over the vault.
Below
Aug 2013Entropy
Android SecureRandomBitcoin wallets signed with repeated ECDSA nonces, letting attackers recover private keys and steal funds.
Below
2011 to 2015Entropy
RandstormBrowser wallets silently fell back to Math.random(); disclosed in 2023, about 1.4 million BTC sat in potentially weak wallets.
Below
May 2008Entropy
Debian OpenSSLThe process ID became the only seed, leaving fewer than 32,768 possible keys of each type and size.
Below
Figure 1. Thirteen key failures covered in this deep dive. Entropy failures are detailed in the randomness section below; hardware and process failures in Parts 3 and 4.

Randomness as the first security primitive: pseudo vs true random generators

A 256-bit private key offers 2256 possibilities only if every bit was chosen unpredictably. If the generator that produced it only had 32 bits of real uncertainty, the attacker's search space collapses to roughly 4.3 billion candidates, which a powerful GPU cluster can sweep in hours to weeks. The elliptic-curve math stays intact, and the key is still broken.

Profanity and Milk Sad seeds32 bits, 232 ≈ 4.3 billion: hours to weeks on a GPU clusterColdcard Mk2 and Mk3 seeds, 2021 to 202640 bits, 240 ≈ 1.1 trillionRandstorm-era Math.random() state48 bits, 24812-word seed phrase128 bits, 212824-word seed or full 256-bit key256 bits, 2256 ≈ 1.2 × 1077Bar length = bits of real entropy. Every extra bit doubles the attacker's search.
Figure 2. Security depends on how many bits of real uncertainty went into the key, whatever length is printed on the box. Weak generators from real incidents in amber.

I find it useful to separate three classes of generator, because the industry often blurs them under the single word "random."

GeneratorHow it worksPredictabilityTypical useWhere it fails
Non-cryptographic PRNG (Mersenne Twister mt19937, LCGs, legacy Math.random())Deterministic algorithm expanding a small seedFully predictable once seed or a few outputs are knownSimulations, games, samplingSmall seeds (often 32 bits), state recoverable from output
Cryptographically secure PRNG / DRBG (CTR_DRBG, HMAC_DRBG, ChaCha20, Fortuna)Deterministic algorithm seeded with high-quality entropy, reseeded over timeUnpredictable as long as the seed is secret and largeOS RNGs (getrandom, /dev/urandom), TLS, key generationGarbage in, garbage out: a weak or repeated seed yields weak keys
True RNG / hardware entropy source (ring oscillator jitter, thermal or avalanche noise)Samples a physical process, then conditions the outputPhysically unpredictable, but biased and sometimes faultySeeding DRBGs inside secure elements, enclaves, TPMs, HSMsSilent degradation, environmental attack, no health testing

Every serious design uses both a TRNG and a CSPRNG. Physical noise is slow and statistically messy, so a conditioning function and a deterministic random bit generator stretch it into fast, uniform output. NIST formalizes this split: SP 800-90B covers the entropy source and its health tests, SP 800-90A covers the DRBG, and SP 800-90C covers how to combine them.

Step 1Noise sourceFree-running ring oscillators; jitter comes from thermal noise.
Step 2Health testsA stuck or biased source halts key generation instead of failing silently.
Step 3ConditioningCompresses biased raw bits into full-entropy seed material.
Step 4DRBGUsually AES-CTR_DRBG; produces the bytes firmware consumes.
Step 5ReseedPeriodic reseeding limits what a stolen DRBG state reveals.
Figure 3. The entropy pipeline inside a secure element, a Secure Enclave, or a TPM looks broadly the same across vendors.

Why the failures are almost always on the software side

When I review the history of crypto key compromises, attackers rarely beat the cryptography. They beat the entropy.

2026

eMudhra

In October a researcher showed that the private keys of eight eMudhra intermediate CA certificates had only a fraction of the expected entropy, because a flaw in a wrap/unwrap step of key generation produced weak P-384 keys. According to Help Net Security, anyone could recover the keys from the public certificates in under a second, eMudhra traced the flaw to a faulty script used in its April 2025 key ceremony, and the company then announced it would leave the global TLS certificate business. With those keys, an attacker could have issued trusted certificates for any domain.

2026

Coldcard

Coldcard hardware wallets had a hardware true random number generator, but from March 2021 their firmware created seeds with a weak software generator instead: a build setting disabled the hardware source, and the code checked only whether that setting existed. Coinkite put the result at about 40 bits of entropy on Mk2 and Mk3 devices and about 72 bits on newer models. Starting on July 30, 2026, attackers drained about 1,816 BTC, roughly $116 million, from more than 5,200 addresses. A firmware update could not repair seeds that already existed, so owners had to create new ones and move their coins.

2023

Milk Sad

Libbitcoin Explorer's bx seed command used the mt19937 Mersenne Twister, which limited internal entropy to 32 bits regardless of settings. The CVE record notes it was exploited in the wild in June and July 2023.

2022

Profanity and Wintermute

The Profanity vanity-address generator picked a 32-bit seed and expanded it into 256-bit private keys. After 1inch disclosed the weakness, the market maker Wintermute lost about $160 million. It had moved ether off its Profanity-generated address but left that address as an admin of its vault.

2011 to 2015

Randstorm

Early BitcoinJS imported the JSBN library, which tried to call window.crypto.random. That function no longer existed in mainstream browsers, so the call failed silently and entropy fell back to Math.random(), which had weak implementations across major browsers until they moved to XorShift128+ by 2016. Unciphered estimated roughly 1.4 million BTC sat in potentially weak wallets.

2008 and 2013

Earlier precedents

A 2008 Debian change to OpenSSL left the process ID as the only seed, which cut the possible keys to fewer than 32,768 of each type and size. In 2013 a flaw in Android's SecureRandom made Bitcoin wallets sign with repeated ECDSA nonces, which let attackers recover private keys and steal funds.

Entropy failures are silent. A wallet with 32-bit entropy works perfectly, displays a valid 24-word phrase, and passes every functional test. Randomness is also consumed twice in a signing system: once to create the key and again for every ECDSA signature nonce. Reusing or biasing a nonce leaks the private key just as surely as a weak seed. That is why modern wallets use deterministic nonces (RFC 6979) or Schnorr signatures with hedged nonces, so signing no longer depends on runtime randomness at all.

A dedicated security chip with its own tested physical noise source removes the dependency on whatever browser, OS, or library happens to be generating keys. Randomness stays imperfect, but fewer components have to be right. Coldcard shows the limit: the chip helps only if the firmware asks it for the numbers. As Kraken's chief security officer pointed out, audits can confirm that a device has an approved random number generator without confirming that production firmware uses it.

Continue to Part 2: A Taleb lens