The 32-Byte Nonce That Broke a Hardware Wallet's Random Number Generator
Archi3 min read
Contents
The 32-Byte Nonce That Broke a Hardware Wallet's Random Number Generator#
On March 12, a security researcher posted a short thread: a popular hardware wallet had been generating ECDSA nonces with a predictable seed. The flaw, buried in a firmware update from January, allowed an attacker who observed two signatures to recover the private key. The wallet vendor confirmed the issue within hours and pushed a patch. The root cause was not a broken curve or a weak hash. It was a single call to a random number generator that returned the same 32 bytes on every boot.
How a nonce leak becomes a key leak#
ECDSA signatures rely on a unique, unpredictable nonce for each signature. If the same nonce is used twice, anyone can compute the private key from the two signatures with simple algebra. This is not a new attack. The 2010 Sony PS3 breach exploited the same mistake. But it keeps happening because the nonce generation step is easy to get wrong, and the consequences are total.
The wallet in question used a deterministic random bit generator (DRBG) seeded from a hardware entropy source. In the January firmware, a refactor moved the entropy collection to a background thread that started before the hardware RNG was ready. On some devices, the DRBG fell back to a fixed seed. The nonce was still 32 bytes, and the signatures looked normal. But every signature used the same nonce.
The detail that mattered#
The bug was not in the ECDSA library. It was in a single function call: get_random_bytes in the firmware's crypto module. The refactor changed the call order, so the function was invoked before the RNG peripheral was initialized. The fallback path, intended for testing, used a constant seed. In production, the fallback was never supposed to run. But on devices with a slow RNG startup, it did.
A firmware engineer who reviewed the patch said the fix was to move the RNG initialization to the earliest boot stage and to remove the fallback entirely. The patch also added a self-test that signs a known message and checks that the nonce differs from a fixed test vector. The vendor says the fix is in firmware version 2.4.1, released March 12.
Who was affected#
According to the vendor, the bug affected wallets manufactured between January and March 2024 and running firmware 2.3.0 or 2.3.1. The company estimates that fewer than 4,000 devices were in use with the vulnerable firmware. Users who generated a wallet address and signed transactions during that period should assume their keys are compromised. The vendor is recommending that affected users move funds to a new wallet created after updating to 2.4.1.
Independent researchers have confirmed the attack is practical. One researcher demonstrated key recovery from two signatures in under a minute on a laptop. The vendor has not reported any active exploitation.
Why it keeps happening#
Nonce generation is a classic single point of failure. In 2013, Bitcoin wallet provider Android SecureRandom had a similar bug that led to key theft. In 2019, a vulnerability in a popular library caused a different wallet to reuse nonces. The pattern is consistent: a change in code that seems unrelated to cryptography alters the state of the random number generator.
Hardware wallets are supposed to be safer because the key never leaves the device. But that security depends on the device's random number generator working correctly. When it fails, the wallet becomes a key generator with a fixed seed, and the attacker only needs to see two signatures.
What to do#
If you use a hardware wallet, check the firmware version. If it is 2.3.0 or 2.3.1, update immediately. If you signed transactions with that firmware, create a new wallet and move your funds. Do not reuse the old seed. The vendor's patch also includes a tool to check whether a given address was generated with the vulnerable firmware.
The bug is a reminder that in cryptography, the smallest detail (a function call order, a fallback path) can undo the strongest math. The fix is one line. The damage is permanent.
More articles