---
title: /full write-up
layout: home
permalink: /disclosure.html
---
# Technical write-up
This is the story of a wallet theft enabled by bad cryptography. It covers our research on problems with `Libbitcoin Explorer` `3.x` (CVE-2023-39910), outlines how it is related to the `Trust Wallet` vulnerability (CVE-2023-31290), and shows some of the real-world impact that we were able to confirm. Additionally, it has some early research on problems with `bx` `2.x` that we became aware of late in the disclosure process.
If you're looking for a less-technical summary, head over to the [summary](/) page and the [FAQs](/faq.html).
Table of Contents
* placeholder
{:toc}
## Part I - Tracing the Issue to the Source
Please note that throughout this article, minor details relating to the victims have been omitted or changed.
### Dude, Where's my Cryptocurrency?
Our story starts on Friday, 21 July 2023. Upon attempting to use a well-protected cryptocurrency wallet, the wallet owner realizes that all of their funds stored in their wallet are gone.
This was no accident -- they were the victim of a sophisticated theft. The funds were sent to the attacker's addresses on July 12th, at a time when the hardware wallet wasn't in use for several days. (Details below)
The generation and use of the affected wallet was unusually strict:
* Generated on an [air-gapped](https://en.wikipedia.org/wiki/Air_gap_(networking)) Linux laptop with self-compiled software
* Use of BIP39 24 mnemonic word phrase
* Mnemonic securely entered into Ledger & Trezor hardware wallets
* Good PIN and physical security on the hardware wallets
* Mnemonic seed phrase never touched a non-air-gapped computer
* Mnemonic seed backup well-protected
### Dude, Where's my Friend's Cryptocurrency?
The victim reached out to their network of friends with similar key generation and management protocols, and a second victim was identified! The second victim also had the contents of their cryptocurrency wallet stolen during the same period of time -- both victims Bitcoin (BTC) was stolen in the same _minute_ on-chain. The victims realized this was no accident. They had fallen victim to a some type of hack.
The victims discovered their Bitcoin (BTC) holdings were not the only things stolen. The attackers had also taken Ethereum and other distinct cryptocurrency types from the same wallets. The victims realized this could only happen with an underlying leak of their main wallet private keys. Tricking their hardware wallets into authorizing incorrect transfers or breaking individual private keys of sub-accounts would manifest with a more limited impact.
A theft like this affecting two people at once despite their thorough precautions should be very unlikely. Even worse, the two victims weren't the only ones affected by this. The publicly visible Bitcoin transactions of the theft pull in funds from what looks like many different wallets, possibly by up to a thousand different wallet owners on Bitcoin alone.
So, what in the world is going on!? Had someone found a remotely exploitable hardware wallet vulnerability, used it on a wide scale, and waited for months before executing the on-chain sweeping transactions collectively? Even worse, could one of the underlying cryptographic primitives be broken? Could Quantum Computer magic be involved? 😱
Tensions were running high - thus began the search for the source of compromise.
### Our Cryptocurrency is Gone, But How!?!?
After coordination and communication, the two victims realized that their affected wallets were generated on a similar airgap laptop setup -- although the individual victims' wallets were generated several years apart. At that point, the issue seemed hard to pin down and could have originated from many sources. Our victims decided to start at the beginning -- their wallet generation steps, from the first commands used and working their way up from there.
An essential tool that was involved in the wallet creation in both cases was the [Libbitcoin Explorer](https://github.com/libbitcoin/libbitcoin-explorer/tree/version3) in a 3.x version, via its `bx` binary. The Libbitcoin project has been around for a very long time (2011 !), is Open Source, and `bx` brings everything needed for an offline wallet generation in one self-contained binary.
Despite being a specialized tool that most wallet users won't have heard of, `bx` has some popularity and is dedicated an [appendix section](https://github.com/bitcoinbook/bitcoinbook/blob/97df56f77c06813b1e028b5b1f2dbc036f27b1fc/appdx-bx.asciidoc) in the "Mastering Bitcoin" book. In other words, it appeared to be a reasonable tool to use.
Brief example of the wallet generation workflow used in a Linux shell:
```
# generate 256 bits of entropy, turn it into BIP39 mnemonics
bx seed -b 256 | bx mnemonic-new