HeadlinesBriefing favicon HeadlinesBriefing.com

Coldcard Firmware Random.bytes() Failure

Hacker News •
×

A critical bug in Coldcard firmware stemmed from poor commit practices. Developer ddustin analyzed commits revealing two problematic changes: one with a 5-character 'runs' message altering 1534 lines, and another with a single 'x' modifying ~1000 lines. These commits disabled the hardware RNG (Random Number Generation) by setting `MICROPY_HW_ENABLE_RNG` to 0, forcing reliance on the insecure Yasmarang RNG. The flaw occurred because the Python `random.bytes()` function bypassed intended overrides, directly invoking the weak generator. This compromised wallet seed generation security.

The core issue was a lack of clear commit documentation. Developers are urged to prioritize meaningful messages and rigorous reviews, especially for security-critical code. The disaster highlights risks of complexity layers in embedded systems, where misunderstandings in C-Python interactions can have severe consequences.

The compromise affected users generating wallets via `random.bytes(32)`, which avoided the overridden functions. Instead, it triggered the Yasmarang RNG at line 112 of rng.c. ddustin emphasized that developers must fully grasp their code, as shortcuts or frustration-driven changes can catastrophically undermine security.