The 25-Minute Heist: What Coldcard's Compiler Bug Reveals About the Myth of Open-Source Sanctuary

Zoetoshi
Miners

In the twenty-five minutes that mattered, the unthinkable was automated. Five hundred Bitcoin wallets, most of them dormant since a time when the word "yield" still had an innocent ring, were emptied in a coordinated burst of transactions. 594 BTC moved. 562 BTC, at the time of reporting, remained parked in an address that refused to say whether it was waiting for a second act or simply indifferent to the first. This was not the exhaustion of a hot wallet, not a social engineering chain, and not a supply chain interception. It was a failure in the one place where the Bitcoin ethos insisted no failure could live: the secure element inside a dedicated signing device.

According to Coinkite, the maker of Coldcard, the attack reached into the firmware's random number generator. My first reaction was not shock. It was a kind of mournful recognition. We burned out trying to own the future, and the future turned out to be a compiler preprocessor directive.

For more than a decade, Bitcoiners have told each other a beautiful story: the private key is sovereign territory, guarded by high-entropy randomness and a device that never touches the internet. The hardware wallet is not merely a tool; it is a ritual object. It is the difference between being the bank and being a customer. Coldcard, in particular, occupied a strange and almost spiritual niche. It was not the sleek consumer product that Ledger offered. It was the wallet for people who read whitepapers for fun, who keep their own node in a closet, who consider "not your keys, not your coins" a moral law rather than a market slogan. It has always sold itself as the unadorned, open-source fortress of self-custody. Unlike Ledger, which relies on a secure element and a closed-source stack, Coldcard courted the paranoid by publishing its code and inviting everyone to look. That promise—open means auditable, auditable means safe—is the load-bearing wall of its entire brand. On the morning of this attack, that wall fractured.

The fracture is not a single crack in a single version of the firmware. According to Block analyst Max Guise, the same systemic defect runs through Mk2, Mk3, Mk4, and Mk5. Bitcoin Core developer Gregory Sanders began by confirming the issue on Mk2 and Mk3, then added Mk4 to the list. Coinkite initially acknowledged Mk3 and told users that Mk4, Q, and Mk5 were unaffected. Within hours, that reassurance collapsed. The external researchers did not contradict the vendor in the spirit of competition; they contradicted the vendor because the evidence forced them to. This is a crucial detail. The people who found the broadest version of the truth were not the people who built the device. They were the people who held the device, examined the source, and refused to be polite.

The technical root cause can be stated with alarming brevity. The Coldcard firmware is designed to draw entropy from the STM32 microcontroller's hardware TRNG. That is the design. The implementation, however, contains a compile-time check that was supposed to verify whether the hardware RNG is actually enabled. Somewhere in the source tree, someone wrote a preprocessor condition using #ifdef instead of #if. That one-word distinction made all the difference. In C preprocessor terms, #ifdef MICROPY_HW_ENABLE_RNG returns true if the macro is defined, regardless of whether its value is zero or one. The code should have asked whether the macro was set to a truthy value. Instead, it asked whether the macro existed at all. When MICROPY_HW_ENABLE_RNG was set to 0, or when the macro was present but disabled, the check still passed, and the firmware walked past the hardware random number generator as if it had received a green light. The code did not fail because of an exotic exploit. It failed because of a compile-time assumption that no one audited closely enough.

At runtime, with the hardware entropy source effectively disabled, the firmware fell back to MicroPython's built-in pseudo-random number generator, Yasmarang. Yasmarang is not a cryptographically secure PRNG. It is a lightweight, non-cryptographic algorithm designed for simple tasks—games, procedural art, maybe a name generator—not for minting the private keys that control real money. Its internal state is shallow. Its seed, in this case, may derive from observable or manipulable events like the number of button presses on the device. For an attacker who understands this, the unpredictable becomes predictable. A private key drawn from Yasmarang with low-entropy input is no longer a key; it is a dial with a limited set of positions.

In my years auditing firmware and reading through the compiled ghosts of other people's best intentions, I have seen this class of bug before. Not in a hardware wallet, but in a small device with a Wi-Fi module and a poorly written configuration system. The code said #if ENABLE_SENSOR and the developer meant #ifdef; we caught it in review only because the sensor was visible in the test rig. The difference between a harmless demo and a catastrophic wallet is not the quality of the bug. It is the lethality of the context. A preprocessor mistake in a toy can be patched in a day. The same mistake in a Bitcoin signing device becomes an engraving of loss.

The attack itself was not a moment of live intrusion. It was a precomputation attack. The attacker likely generated a massive dictionary of addresses that could be derived from low-entropy seeds. Then they scanned the blockchain for matches. Found 500 wallets. Moved them in 25 minutes. The speed suggests scripts that had been built before the public saw the first stolen satoshi. This was not a criminal improvisation; it was an industrial process.

There is also an unsettling claim about AI. Coinkite speculated that the attacker might have used AI. A security researcher named DeLorme claimed to have found the vulnerability using Claude Opus 5 after cloning the code repository. That claim is not independently verified. But whether or not AI was used in this specific attack, the event has already changed the threat model. Open source has always been a double-edged sword. It allows the community to audit the code, but it also hands the attacker a precise map of the terrain. The AI twist makes that map even more legible. An attacker can ask a model to scan the firmware for exactly the kind of pattern that a human reviewer might overlook. This is not science fiction. It is the logical end of a path that began when we decided to trust public code without building public defense mechanisms around it.

Let me pause and speak as someone who has spent two decades watching this industry oscillate between euphoria and grief. The likely number of affected addresses is larger than the 500 wallets that were drained. If the seed entropy is low enough for the attacker to enumerate private keys, then every Coldcard address generated on vulnerable firmware is theoretically in the same enumeration space. The 500 stolen wallets may simply be the first, most obvious matches. There may be dormant addresses that the attacker has catalogued but not yet touched. There may be addresses belonging to people who have no idea their private key is a needle in a haystack that the attacker is methodically sweeping. The 25-minute theft is not the whole story; the story is the shadow that the attack leaves behind on every address ever created by a Coldcard from a vulnerable release.

On the token economics side, the event is a non-event for Bitcoin's supply schedule. 594 BTC is less than 0.0003 percent of the circulating supply. The 562 BTC still sitting in the attacker's address would be a small ripple in a market that already absorbs hundreds of millions of dollars of volume every day. To frame this as a "market-moving hack" would be to misunderstand what matters here. The destruction is not in the total supply. It is in the distribution of trust. Bitcoin's monetary policy was untouched. No halving was accelerated. No exchange collapsed. The collateral damage is entirely in the soft, fragile architecture of human confidence.

The market's response to this will not announce itself in the BTC price chart. It will announce itself in the hardware wallet industry. Coldcard's brand was built on the premise that open source is synonymous with security. That premise has now been inverted by one compiler directive. This is a structural blow not only to Coinkite's market share, but to the wider narrative that self-custody is the final, rational answer to exchange risk. Ledger, Trezor, and BitBox may benefit from a temporary migration. But that migration is not a victory for anyone. It is a withdrawal from the idea that open source alone can be a security guarantee. Users are not fleeing to a safer brand; they are fleeing from an assumption that turned out to be too fragile.

The ecosystem impact is deeper than market share. Coldcard has always been the wallet of the true believers. It is the device you recommend in a Bitcoin-only podcast, the one that feels like a BlackBerry if BlackBerry had been designed by comp sci majors who hate color. Its users are the same people who contribute to Bitcoin Core, run Electrum servers, and argue about relative time locks. This is the community that is supposed to be the immune system of the open-source world. And yet the bug lived in public source code for years. That is not an accident. It is a symptom of a systemic flaw in the way we think about open-source security.

The 25-Minute Heist: What Coldcard's Compiler Bug Reveals About the Myth of Open-Source Sanctuary

What does the term "open source" actually promise? It promises that anyone may inspect the code. It does not promise that anyone will. The cryptographic ideal is that, in the words of Kerckhoffs, the security should rest on the key, not on the secrecy of the algorithm. But that ideal assumes a permanent, global, relentless set of eyes on every line of code. The reality is that most open-source projects are maintained by tired humans who cannot see in every direction. The community audit model is not worthless; it is incomplete. This vulnerability was a glaring signal that the completeness we imagined was never there.

Block's Max Guise did not happen to look at the Coldcard source by chance. The report suggests that external security researchers, including Bitcoin Core developers, were able to verify the issue because they had a reason to look. This is what a competitive audit ecosystem should look like. But the fact that it takes a catastrophic theft for external parties to do deep, adversarial audit work is not a healthy baseline. It is an emergency response. We need a world where every security-critical device is perpetually examined by outside researchers, where vulnerability disclosure runs parallel to feature development, and where "reviewed by the community" is a claim backed by concrete artifacts.

Regulators are likely to catch up slowly, as they always do. This is not a securities case. Coldcard did not issue a token; Coinkite did not ask anyone to pass the Howey test. The relevant legal frame is product liability and consumer protection. If a product claims to be a secure storage device and a basic compiler check was wrong for years, courts in Canada and the United States may take a dim view of that gap. The fact that the code was open source does not absolve the manufacturer; it simply means the instructions for how to find the flaw were published openly. That could be used against Coinkite in a civil lawsuit. It could also be used to argue that the community had a shared responsibility to catch it. The legal outcome will depend on the precise claims made in Coldcard's marketing materials, the technical evidence, and the degree to which an ordinary user could have verified the source. Do not expect either side to have an easy day in court.

There is also a broader regulatory conversation hiding behind the AI claim. If, in the future, a court finds that an AI model was an instrument of theft, we will enter an entirely new jurisprudence. Criminal law knows how to handle a person with a crowbar. It is less certain how to handle a person who asked a language model to enumerate a private key space. Coinkite's speculation that AI was used may turn out to be wrong, but it already has narrative power. It accelerates the idea that AI is no longer only a defense tool or a productivity aid; it is a weapon with a low barrier to entry. Regulators are not prepared for this. They are still writing rules for centralized exchanges and stablecoin collateral. They are not prepared for a ledger that tears itself open through a forgotten macro.

Let me now speak to the emotional dimension, because the technical analysis has a shadow that no regression test can measure. The people whose wallets were drained were not reckless. They are the opposite of reckless. They were so careful that they removed their coins from the internet, printed their seed phrases, and hid them in places that will never be written about. They did the hard work of self-custody. They trusted a device that was supposed to be a fortress. When that fortress fails, the grief is not just financial. It is existential. It is the feeling of having played by every rule and still losing the game because the game board was secretly made of sand. I have felt a version of this grief. I watched the ICO era drown people who believed in white papers that promised maps to a future that did not exist. I saw DeFi farmers burn out chasing yields that were never real. I wrote about the silence after the 2022 crash, hoping that the lesson would be compassion. Now I am writing about a different kind of silence: the silence of a source tree that held a bug for years, while we all stared at it and saw only what we wanted to see.

That is the true test of infrastructure. It does not fail at the moment of impact. It fails in the quiet time between releases, when no one is looking at the line of code that does not do what its author thinks it does. The seed of loss is often a check that never ran. It is a macro that is defined because it is mentioned, not because it is true. It is a fallback path that keeps a system alive by making it less secure. We celebrate resilience, but we do not inspect the cracks that resilience papers over. This is why I am suspicious of any article that promises to give you a single lesson from this hack. There is no single lesson. There is only a pile of choices: the choice to trust a compiler, the choice to trust a fallback, the choice to trust a vendor's first statement, the choice to trust that the community inspected the code. Every layer of trust was necessary, and every layer needed its own defense.

The contrarian view in this story is not that Coldcard is uniquely guilty. The contrarian view is that open source was never the sanctuary we believed it to be. Open source is not a promise; it is a dare. It is a dare to look, but it does not force anyone to look well. It left the security of billions in self-custody in the hands of an unpaid, uncoordinated, often overworked community that had no formal obligation to inspect every preprocessor directive. The same openness that allowed the bug to be discovered after the attack is the openness that allowed the attacker to find it first. That is not an argument for closed source. Closed source has its own cataracts, obscured by corporate secrecy and regulatory theatre. But it is an argument for treating open source as the starting line, not the finish line.

The industry needs a new kind of pressure. It needs mandatory independent audits for any device that claims to be a cold storage wallet. It needs a public registry of audit reports, so that the phrase "audited" cannot be stretched into a marketing sticker. It needs an active, adversary-in-the-loop testing program. It needs AI-assisted defense before AI-assisted offense reaches the mainstream. And it needs a cultural shift away from hero worship. Coinkite's response was fast, but its initial model assessment was wrong. That mismatch is not a scandal; it is a reminder that even the builders are not the final authorities on their own creations. In a decentralized ecosystem, authority belongs to whoever can reproduce the attack. That is bitter, but it is also liberating. It means no single vendor can define the truth. It means external researchers are not optional.

What do we say to the 500 people whose wallets were drained? We can say that their loss is a signal. We can say that the 562 BTC still sitting in the attacker's address is evidence of a crime, not a triumph. We can say that the next device they choose must be held to a higher standard. But we cannot give them back the years of quiet confidence that was stolen in a quarter of an hour. That kind of confidence is not a code comment. It is a reserve component that only builds up over time, and once it is spent, it is painful to rebuild.

There is a specific tragedy in the fact that these wallets were dormant. They were not the assets of day traders. They were the output of long-term conviction. They were the coins of people who acted on the belief that the best way to store value is to remove it from every network except the ledger that defines it. The attacker did not have to convince these people to click a malicious link. They did not have to compromise an exchange. They simply had to solve a mathematical puzzle that was never actually a puzzle, because the random seed was so small that the puzzle became a predictable sequence. The most painful detail is that these wallets were held by the people who most adamantly preached self-custody. They were not tourists. They were residents.

The AI narrative deserves a seatbelt. The strongest interpretation is not that a mysterious artificial intelligence rose up to steal money. The strongest interpretation is that AI-assisted code review has crossed a threshold. DeLorme's claim—if true—suggests that a language model can inspect a hardware wallet firmware and find a defect that human reviewers missed for years. That is both terrifying and hopeful. It is terrifying because the same technique can be used by attackers. It is hopeful because it means our defense capability can scale beyond the limited hours and tired eyes of human security researchers. We are entering a world where the audit itself must be an arms race. The open-source community cannot audit large firmware bases by hand anymore. It needs tools that can ask the same questions the attacker asks.

Within the risk matrix, there are several unread asterisks. The first is that this may not be an isolated incident. If the same MicroPython compatibility layer is used by other hardware wallet manufacturers, they may be carrying the same Yasmarang fallback. That claim is speculative. But the supply chain is long and shared. STMicroelectronics provided the chip. MicroPython provided the firmware layer. Coinkite provided the product. The gap could be anywhere. Every participant should be running a forensic check on its random number generation path. The second unread asterisk is that the attacker may possess a list of additional addresses that have not been drained yet. The 25-minute exploit was not an exhaustive enumeration; it was a targeted extraction. There may be a second script waiting for a quieter hour. The third unread asterisk is what I already mentioned: the existing customers who do not migrate their assets are sitting on a known vulnerable device. The immediate advice is to move funds away from any Coldcard address generated on affected firmware. But that advice is also a burden. It forces the victims to become their own emergency responders, to learn the migration process while they are still shaking from the news.

Let me talk about honesty in incident response. Coinkite was fast to acknowledge that something was wrong. That matters. But its initial statement that only Mk3 was affected was too narrow, and the external evidence pushed the story closer to the truth. In the chaotic days after an attack, the most valuable quality is not certainty; it is the willingness to expand the scope when the evidence demands it. Coinkite's later collaboration with external researchers and its public release of technical details are steps in the right direction. Yet the incident has already exposed a governance failure inside the company's internal testing pipeline. If a compile-time check has been producing the wrong result for years, the CI/CD suite did not have the right test. You can see this as a process bug or a cultural bug. I see it as both. We do not need to punish every mistake; we need to understand that a device with a security claim is a promise made of thousands of tests, and one missing test is enough to break it.

The 25-Minute Heist: What Coldcard's Compiler Bug Reveals About the Myth of Open-Source Sanctuary

The ecosystem has a strange beauty in this moment. The Bitcoin Core developer, Gregory Sanders, did not wait for a formal audit to be commissioned. He reproduced the attack and spoke bluntly. He even said, in effect, that this is a moment for panic. That bluntness may have disturbed some people, but it is exactly what a security community should do. Panic is not always the enemy. At a certain point, controlled urgency is preferable to polite inaction. The panic should be focused, though. It should not be directed at the concept of self-custody. Self-custody is still better than the alternative in a world of exchanges that can freeze, seize, or lose your coins. The panic should be directed at the tools, not at the idea.

What will the next three to six months look like? In the short term, there will be a wave of wallet migration. Users will buy competing devices. They will also ask more questions about the provenance of the randomness. Open-source audits will become an even bigger selling point. The vendors that can show credible, independent audit trails will gain an advantage. In the medium term, regulators may start asking why hardware wallets are exempt from the security standards applied to other custodial products. I can already hear the arguments: a hardware wallet does not hold customer funds, it is a personal tool, the user is responsible for their own key. But this event will complicate that narrative. If a manufacturer claims to protect private keys, and the keys are protected by a faulty random number generator, the manufacturer has made a consumer product with a material defect. That is the kind of claim that might require a formal certification framework in the future.

The 25-Minute Heist: What Coldcard's Compiler Bug Reveals About the Myth of Open-Source Sanctuary

In the long term, the AI-assisted audit question will not be ignored. I have seen the crypto industry move through many fads. ICOs were followed by DeFi, DeFi by NFTs, NFTs by AI agents. The one constant is that every narrative eventually becomes security infrastructure. The AI narrative here is still loose. We do not know if the attacker used AI. We do not know if DeLorme's claim will be replicated. But we know that AI can be asked to compare a preprocessor directive against the security model, and it will do so without sleep. If we cannot beat the attackers on speed, we can at least match them on scale.

The deeper truth is that the Coldcard attack was not a sophisticated breach of cryptography. It was a failure of verification in a place where cryptographic defenses are supposed to begin. The private key is not protected by the cryptography if the randomness that generates it was cryptographically dead on arrival. The private key is the secret, but the secret is only as strong as the entropy that named it. When randomness becomes predictable, the mathematics of encryption still work—but they are like a lock on a door that someone has already removed. The lock looks strong. The door is gone.

This is why I keep returning to the image of a compiler directive. It is not glamorous. It cannot be explained in a meme. But it is the kind of detail that decides whether a generation of self-custody believers will continue to sleep soundly. I have spent enough nights staring at code to know that every layer of abstraction hides a pile of assumptions. The operating system assumes the CPU is honest. The compiler assumes the source is correct. The firmware assumes the TRNG is enabled. The user assumes the vendor checked that assumption. In this attack, every one of those assumptions held except one, and that was enough.

There is an old joke that the most dangerous phrase in software development is "it should work." The Coldcard incident gives us a sharper version: "the macro is defined." A macro can be defined and false. A check can pass and be meaningless. A device can be open source and unaudited. The difference between a sanctuary and a trap is often not obvious until the door closes. Open source is not a promise; it is a dare. It is a dare to look, and we must look better than we have been looking.

I remember writing about the ICO mania in 2017, when people sold their apartments for tokens shaped like unrealized roadmaps. I remember the silent winter of 2022, when the loudest exchanges became the fastest ghosts. I remember saying to a friend that the only way to survive crypto is to hold something that you truly own. Now I have to revise that statement. It is not enough to hold something you truly own. You have to know, with high confidence, that the thing you own was not born from a damaged random seed.

The 25 minutes will be studied in security courses. The 594 BTC will be tracked. Some attackers will be caught; most will not be. The market will absorb the loss and move forward. But the real ledger of this event is written in the minds of the people who gave up an afternoon of their lives to move their coins to a different device, wondering if the new device is also a ticking clock. That trust is not a line item on a balance sheet. It is an emotional reserve that takes years to accumulate and a few minutes to drain.

What is the takeaway? It is not "sell your hardware wallet." It is not "hold everything on an exchange." It is not "distrust open source." The takeaway is that we need to stop treating hardware wallets as sacred objects and start treating them as complex systems that require adversarial care. We need to demand proof, not promises. We need to support the independent researchers who do the unglamorous work of finding the bugs before the attackers do. We need to build automated defense tools that can scan not just for known vulnerabilities, but for the forgotten assumptions inside every security-critical line of code.

I will leave you with a question. If a compiler directive can silently turn a hardware random number generator into a non-cryptographic fallback for years, what else is resting in the shadow of an unexamined #ifdef? The code is open. The code is waiting. The question is whether we have the humility to admit that we haven't been looking deeply enough. We burned out trying to own the future, and the future is now asking us to check our own keys. Let's not look away.