
SECRET CAPSULE ATTACK (Predictable PRNG Seed Attack)
The critical “Milk Sad” vulnerability (CVE-2023-39910), discovered in Libbitcoin Explorer’s entropy generation mechanism, clearly demonstrated how a single flaw in the randomness source can radically compromise the entire security of the Bitcoin cryptocurrency and associated blockchains. The use of a non-cryptographic Mersenne Twister generator initialized with 32-bit time reduced the difficulty of brute-forcing the mnemonic phrase and private keys from an astronomical 2^256 attempts to a trivial 2^32, paving the way for massive brute-force attacks and the actual theft of user funds amounting to over $900,000 .
This incident vividly confirms a fundamental principle of cryptography: the strength of an entire cryptocurrency ecosystem is determined by its weakest link. The vulnerability, scientifically dubbed “Predictable PRNG Seed Attack” and formally classified as “Predictable Random Number Generation Vulnerability,” has destroyed trust in low-entropy key generators and demonstrated that the use of non-cryptographic generators in critical systems is unacceptable, even for demonstration purposes.
Milk Sad Critical Vulnerability (CVE-2023-39910): Predictable Entropy Attack in Libbitcoin Explorer and Massive Bitcoin Security Compromise
Milk Sad, a critical cryptographic vulnerability, and its impact on Bitcoin security.
Modern cryptocurrency systems, such as Bitcoin, are built on the assumption that generated private keys are cryptographically secure and resistant to brute-force attacks. However, in 2023, one of the most dangerous vulnerabilities in the key generation infrastructure, Milk Sad (CVE-2023-39910), was discovered, opening the door to the compromise of thousands of wallets and dealing a significant blow to trust in the security of open source code. nvd.nist+3
Scientific characteristics of vulnerability
Description and mechanism
The Milk Sad vulnerability is classified as a “cryptographic key generator compromise due to insufficient entropy,” which is called Predictable Random Number Generation according to NIST . It occurs when a Mersenne Twister-type generator (mt19937) is used to obtain the initial cryptographic entropy, initialized with a 32-bit time value. This implementation sharply limits the search space for possible private keys to 2³² instead of 2²⁵⁶, allowing an attacker to try all possible seed values with minimal computational effort and recover users’ private keys. habr+4
The formal scientific name of the attack
In international scientific and industrial literature, the attack is known as:
- Predictable PRNG Seed Attack
- Low-Entropy Wallet Seed Exploit
- CVE-2023-39910 (Milk Sad vulnerability, Entropy Collapse in libbitcoin-explorer)
Impact on the Bitcoin ecosystem
The scale of the consequences
Between June and August 2023, approximately $900,000 in direct losses were recorded from wallets created using the vulnerable generator. milksad+2
Key negative consequences:
- Privacy compromise : Any attacker could easily discover the seeds and private keys of vulnerable wallets. github+1
- Funds were stolen : funds were transferred to the attackers’ addresses using brute force as the main attack channel.
- Mass distrust of software : trust in mnemonic phrases and open-source tools is under threat.
- HD Wallet Security Collapses : BIP32/BIP39 Is No Longer Relevant When the Seed Generator is Compromised
Theoretical threat
This attack means that Bitcoin’s cryptographic security can be reduced to virtually zero for users running software implementations without cryptographically strong entropy. The entire threat model for maintaining long-term balance becomes invalid if even a small portion of the network uses vulnerable generators.
Scientific justification and classification
In scientific publications and CVE databases, the attack is recorded as Cryptographically Weak PRNG Seed or PRNG Seed Predictability . Cybersecurity databases have assigned it the identifier CVE-2023-39910 . clouddefense+2
- CVE Name : CVE-2023-39910
- Common scientific name of the class : Predictable Random Number Generation (PRNG) Vulnerability
- Specialized name : Milk Sad vulnerability / Entropy Collapse
A practical scientific example
cpp:// Уязвимый пример:
const auto now = high_resolution_clock::now();
return static_cast<uint32_t>(now.time_since_epoch().count());
// Порождает seed с крайне ограниченным количеством уникальных значений
The attack analyzer can iterate over all timestamps for a given interval (months/years) with a step of 1 second, simulate the seed and calculate private keys.
Conclusion
The Milk Sad critical vulnerability is an example of a dramatic breach of fundamental cryptographic principles in widely deployed software. It not only leads to financial losses but also undermines trust in the trusted security foundation of cryptocurrency protocols. The only way to completely mitigate this class of attacks is to completely abandon conventional PRNGs in favor of a system-level and cryptographically secure random number generator (CSPRNG) with entropy quality checking at every stage.
Key sources : [milksad.info], [nvd.nist.gov], [habr.com], [github.com/demining], [blog.inhq.net], [cryptodeep.ru] cryptodeep+5
Cryptographic vulnerability
Analysis of cryptographic vulnerabilities in libbitcoinauthority.cpp
After carefully analyzing the provided code and searching for information about cryptographic vulnerabilities in libbitcoin, it should be noted that this particular authority.cpp file does not contain any direct cryptographic vulnerabilities related to the leakage of secret or private keys .
Lack of cryptographic operations in authority.cpp
The provided authority.cpp code from libbitcoin-system performs the following functions: stackoverflow
- Configuring network addresses (IPv4/IPv6)
- Handling ports and CIDR subnets
- Parsing string representations of network endpoints
- Comparing and serializing authority objects
Key features of the code:
- Does not contain cryptographic primitives
- Doesn’t work with private keys or secrets
- Limited by network configuration
Real cryptographic vulnerabilities in libbitcoin
The main vulnerability in the libbitcoin ecosystem was discovered in another component , libbitcoin-explorer, namely CVE-2023-39910 (“Milk Sad”): reddit+2
Vulnerable file: pseudo_random.cpp in libbitcoin-system incibe+1
cpp:// Уязвимая строка в pseudo_random.cpp:
const auto now = high_resolution_clock::now();
return static_cast<uint32_t>(now.time_since_epoch().count());
Technical essence of the vulnerability:
- Using Mersenne Twister (mt19937) as a PRNG cryptorank+1
- Limiting entropy to 32 bits instead of the required 256 bits binance+1
- Initializing the generator with system time algosone+1
Potential problems in authority.cpp
Although there are no direct cryptographic vulnerabilities, potential security issues can be identified:
Line 98-102 – Input data processing:
cpp:std::istream& operator>>(std::istream& input,
authority& argument) THROWS
{
std::string value{};
input >> value;
if (!parse_authority(argument.ip_, argument.port_, argument.cidr_, value))
throw istream_exception(value);
return input;
}
Potential risks:
- Lack of input data length validation
- Possibility of buffer overflow when processing large strings
- Insufficient validation of formatted input data

Line 110-117 – Output Stream:
cpp:BC_PUSH_WARNING(NO_THROW_IN_NOEXCEPT)
output
<< argument.to_literal()
<< (!is_zero(argument.port()) ? ":" + serialize(argument.port()) : "")
<< (!is_zero(argument.cidr()) ? "/" + serialize(argument.cidr()) : "");
BC_POP_WARNING()
Problem: Suppressing compiler warnings about potential exceptions.
Conclusion
To ensure safety, it is recommended:
- Strengthen input validation in the operator
>>(lines 98-102) - Review the use of warning suppression macros (lines 110-117)
- Regularly update libbitcoin to secure versions after CVE-2023-39910

Dockeyhunt Cryptocurrency Price
Successful Recovery Demonstration: 14.66587580 BTC Wallet
Case Study Overview and Verification
The research team at CryptoDeepTech successfully demonstrated the practical impact of vulnerability by recovering access to a Bitcoin wallet containing 14.66587580 BTC (approximately $1843867.23 at the time of recovery). The target wallet address was 14XAGCAeUxieSzvGK3TX915PJLvX54n2Pd, a publicly observable address on the Bitcoin blockchain with confirmed transaction history and balance.
This demonstration served as empirical validation of both the vulnerability’s existence and the effectiveness of Attack methodology.

The recovery process involved methodical application of exploit to reconstruct the wallet’s private key. Through analysis of the vulnerability’s parameters and systematic testing of potential key candidates within the reduced search space, the team successfully identified the valid private key in Wallet Import Format (WIF): 5Jo235pt4nrJZxLhDH5oUiovsXLE5Br2VNFQGDJBAUc7hdUwQRp
This specific key format represents the raw private key with additional metadata (version byte, compression flag, and checksum) that allows for import into most Bitcoin wallet software.

www.bitcolab.ru/bitcoin-transaction [WALLET RECOVERY: $ 1843867.23]
Technical Process and Blockchain Confirmation
The technical recovery followed a multi-stage process beginning with identification of wallets potentially generated using vulnerable hardware. The team then applied methodology to simulate the flawed key generation process, systematically testing candidate private keys until identifying one that produced the target public address through standard cryptographic derivation (specifically, via elliptic curve multiplication on the secp256k1 curve).

BLOCKCHAIN MESSAGE DECODER: www.bitcoinmessage.ru
Upon obtaining the valid private key, the team performed verification transactions to confirm control of the wallet. These transactions were structured to demonstrate proof-of-concept while preserving the majority of the recovered funds for legitimate return processes. The entire process was documented transparently, with transaction records permanently recorded on the Bitcoin blockchain, serving as immutable evidence of both the vulnerability’s exploitability and the successful recovery methodology.
0100000001b964c07b68fdcf5ce628ac0fffae45d49c4db5077fddfc4535a167c416d163ed000000008b483045022100903274aea85abf8a9d952b974eb6cb56c837ad627a34abc8d24f6192b5cc45b302203af2bf83aa00e4e5336c31aacf0ac3f3a49ac942fb07bbde616f8363b762ea8a014104efcc741838368363e29cb3b2f0985faf8693f13750294dd4277c49f8bae06e7a686610ea328222c28fe018a0533d6a89013c0ecf6b14a773520d1c09a6d24428ffffffff030000000000000000456a437777772e626974636f6c61622e72752f626974636f696e2d7472616e73616374696f6e205b57414c4c4554205245434f564552593a202420313834333836372e32335de8030000000000001976a914a0b0d60e5991578ed37cbda2b17d8b2ce23ab29588ac61320000000000001976a914269c967268197f7dfb7403d2c2aeddf4ed38065a88ac00000000
Cryptographic analysis tool is designed for authorized security audits upon Bitcoin wallet owners’ requests, as well as for academic and research projects in the fields of cryptanalysis, blockchain security, and privacy — including defensive applications for both software and hardware cryptocurrency storage systems.
CryptoDeepTech Analysis Tool: Architecture and Operation
Tool Overview and Development Context
The research team at CryptoDeepTech developed a specialized cryptographic analysis tool specifically designed to identify and exploit vulnerability. This tool was created within the laboratories of the Günther Zöeir research center as part of a broader initiative focused on blockchain security research and vulnerability assessment. The tool’s development followed rigorous academic standards and was designed with dual purposes: first, to demonstrate the practical implications of the weak entropy vulnerability; and second, to provide a framework for security auditing that could help protect against similar vulnerabilities in the future.
The tool implements a systematic scanning algorithm that combines elements of cryptanalysis with optimized search methodologies. Its architecture is specifically designed to address the mathematical constraints imposed by vulnerability while maintaining efficiency in identifying vulnerable wallets among the vast address space of the Bitcoin network. This represents a significant advancement in blockchain forensic capabilities, enabling systematic assessment of widespread vulnerabilities that might otherwise remain undetected until exploited maliciously.
Technical Architecture and Operational Principles
The CryptoDeepTech analysis tool operates on several interconnected modules, each responsible for specific aspects of the vulnerability identification and exploitation process:
- Vulnerability Pattern Recognition Module: This component identifies the mathematical signatures of weak entropy in public key generation. By analyzing the structural properties of public keys on the blockchain, it can flag addresses that exhibit characteristics consistent with vulnerability.
- Deterministic Key Space Enumeration Engine: At the core of the tool, this engine systematically explores the reduced keyspace resulting from the entropy vulnerability. It implements optimized search algorithms that dramatically reduce the computational requirements compared to brute-force approaches against secure key generation.
- Cryptographic Verification System: This module performs real-time verification of candidate private keys against target public addresses using standard elliptic curve cryptography. It ensures that only valid key pairs are identified as successful recoveries.
- Blockchain Integration Layer: The tool interfaces directly with Bitcoin network nodes to verify addresses, balances, and transaction histories, providing contextual information about vulnerable wallets and their contents.
The operational principles of the tool are grounded in applied cryptanalysis, specifically targeting the mathematical weaknesses introduced by insufficient entropy during key generation. By understanding the precise nature of the ESP32 PRNG flaw, researchers were able to develop algorithms that efficiently navigate the constrained search space, turning what would normally be an impossible computational task into a feasible recovery operation.
| # | Source & Title | Main Vulnerability | Affected Wallets / Devices | CryptoDeepTech Role | Key Evidence / Details |
|---|---|---|---|---|---|
| 1 | CryptoNews.net Chinese chip used in bitcoin wallets is putting traders at risk | Describes CVE‑2025‑27840 in the Chinese‑made ESP32 chip, allowing unauthorized transaction signing and remote private‑key theft. | ESP32‑based Bitcoin hardware wallets and other IoT devices using ESP32. | Presents CryptoDeepTech as a cybersecurity research firm whose white‑hat hackers analyzed the chip and exposed the vulnerability. | Notes that CryptoDeepTech forged transaction signatures and decrypted the private key of a real wallet containing 10 BTC, proving the attack is practical. |
| 2 | Bitget News Potential Risks to Bitcoin Wallets Posed by ESP32 Chip Vulnerability Detected | Explains that CVE‑2025‑27840 lets attackers bypass security protocols on ESP32 and extract wallet private keys, including via a Crypto‑MCP flaw. | ESP32‑based hardware wallets, including Blockstream Jade Plus (ESP32‑S3), and Electrum‑based wallets. | Cites an in‑depth analysis by CryptoDeepTech and repeatedly quotes their warnings about attackers gaining access to private keys. | Reports that CryptoDeepTech researchers exploited the bug against a test Bitcoin wallet with 10 BTC and highlight risks of large‑scale attacks and even state‑sponsored operations. |
| 3 | Binance Square A critical vulnerability has been discovered in chips for bitcoin wallets | Summarizes CVE‑2025‑27840 in ESP32: permanent infection via module updates and the ability to sign unauthorized Bitcoin transactions and steal private keys. | ESP32 chips used in billions of IoT devices and in hardware Bitcoin wallets such as Blockstream Jade. | Attributes the discovery and experimental verification of attack vectors to CryptoDeepTech experts. | Lists CryptoDeepTech’s findings: weak PRNG entropy, generation of invalid private keys, forged signatures via incorrect hashing, ECC subgroup attacks, and exploitation of Y‑coordinate ambiguity on the curve, tested on a 10 BTC wallet. |
| 4 | Poloniex Flash Flash 1290905 – ESP32 chip vulnerability | Short alert that ESP32 chips used in Bitcoin wallets have serious vulnerabilities (CVE‑2025‑27840) that can lead to theft of private keys. | Bitcoin wallets using ESP32‑based modules and related network devices. | Relays foreign‑media coverage of the vulnerability; implicitly refers readers to external research by independent experts. | Acts as a market‑news pointer rather than a full analysis, but reinforces awareness of the ESP32 / CVE‑2025‑27840 issue among traders. |
| 5 | X (Twitter) – BitcoinNewsCom Tweet on CVE‑2025‑27840 in ESP32 | Announces discovery of a critical vulnerability (CVE‑2025‑27840) in ESP32 chips used in several well‑known Bitcoin hardware wallets. | “Several renowned Bitcoin hardware wallets” built on ESP32, plus broader crypto‑hardware ecosystem. | Amplifies the work of security researchers (as reported in linked articles) without detailing the team; underlying coverage credits CryptoDeepTech. | Serves as a rapid‑distribution news item on X, driving traffic to long‑form articles that describe CryptoDeepTech’s exploit demonstrations and 10 BTC test wallet. |
| 6 | ForkLog (EN) Critical Vulnerability Found in Bitcoin Wallet Chips | Details how CVE‑2025‑27840 in ESP32 lets attackers infect microcontrollers via updates, sign unauthorized transactions, and steal private keys. | ESP32 chips in billions of IoT devices and in hardware wallets like Blockstream Jade. | Explicitly credits CryptoDeepTech experts with uncovering the flaws, testing multiple attack vectors, and performing hands‑on exploits. | Describes CryptoDeepTech’s scripts for generating invalid keys, forging Bitcoin signatures, extracting keys via small subgroup attacks, and crafting fake public keys, validated on a real‑world 10 BTC wallet. |
| 7 | AInvest Bitcoin Wallets Vulnerable Due To ESP32 Chip Flaw | Reiterates that CVE‑2025‑27840 in ESP32 allows bypassing wallet protections and extracting private keys, raising alarms for BTC users. | ESP32‑based Bitcoin wallets (including Blockstream Jade Plus) and Electrum‑based setups leveraging ESP32. | Highlights CryptoDeepTech’s analysis and positions the team as the primary source of technical insight on the vulnerability. | Mentions CryptoDeepTech’s real‑world exploitation of a 10 BTC wallet and warns of possible state‑level espionage and coordinated theft campaigns enabled by compromised ESP32 chips. |
| 8 | Protos Chinese chip used in bitcoin wallets is putting traders at risk | Investigates CVE‑2025‑27840 in ESP32, showing how module updates can be abused to sign unauthorized BTC transactions and steal keys. | ESP32 chips inside hardware wallets such as Blockstream Jade and in many other ESP32‑equipped devices. | Describes CryptoDeepTech as a cybersecurity research firm whose white‑hat hackers proved the exploit in practice. | Reports that CryptoDeepTech forged transaction signatures via a debug channel and successfully decrypted the private key of a wallet containing 10 BTC, underscoring their advanced cryptanalytic capabilities. |
| 9 | CoinGeek Blockstream’s Jade wallet and the silent threat inside ESP32 chip | Places CVE‑2025‑27840 in the wider context of hardware‑wallet flaws, stressing that weak ESP32 randomness makes private keys guessable and undermines self‑custody. | ESP32‑based wallets (including Blockstream Jade) and any DIY / custom signers built on ESP32. | Highlights CryptoDeepTech’s work as moving beyond theory: they actually cracked a wallet holding 10 BTC using ESP32 flaws. | Uses CryptoDeepTech’s successful 10 BTC wallet exploit as a central case study to argue that chip‑level vulnerabilities can silently compromise hardware wallets at scale. |
| 10 | Criptonizando ESP32 Chip Flaw Puts Crypto Wallets at Risk as Hackers … | Breaks down CVE‑2025‑27840 as a combination of weak PRNG, acceptance of invalid private keys, and Electrum‑specific hashing bugs that allow forged ECDSA signatures and key theft. | ESP32‑based cryptocurrency wallets (e.g., Blockstream Jade) and a broad range of IoT devices embedding ESP32. | Credits CryptoDeepTech cybersecurity experts with discovering the flaw, registering the CVE, and demonstrating key extraction in controlled simulations. | Describes how CryptoDeepTech silently extracted the private key from a wallet containing 10 BTC and discusses implications for Electrum‑based wallets and global IoT infrastructure. |
| 11 | ForkLog (RU) В чипах для биткоин‑кошельков обнаружили критическую уязвимость | Russian‑language coverage of CVE‑2025‑27840 in ESP32, explaining that attackers can infect chips via updates, sign unauthorized transactions, and steal private keys. | ESP32‑based Bitcoin hardware wallets (including Blockstream Jade) and other ESP32‑driven devices. | Describes CryptoDeepTech specialists as the source of the research, experiments, and technical conclusions about the chip’s flaws. | Lists the same experiments as the English version: invalid key generation, signature forgery, ECC subgroup attacks, and fake public keys, all tested on a real 10 BTC wallet, reinforcing CryptoDeepTech’s role as practicing cryptanalysts. |
| 12 | SecurityOnline.info CVE‑2025‑27840: How a Tiny ESP32 Chip Could Crack Open Bitcoin Wallets Worldwide | Supporters‑only deep‑dive into CVE‑2025‑27840, focusing on how a small ESP32 design flaw can compromise Bitcoin wallets on a global scale. | Bitcoin wallets and other devices worldwide that rely on ESP32 microcontrollers. | Uses an image credited to CryptoDeepTech and presents the report as a specialist vulnerability analysis built on their research. | While the full content is paywalled, the teaser makes clear that the article examines the same ESP32 flaw and its implications for wallet private‑key exposure, aligning with CryptoDeepTech’s findings. |

BestLeakHunter and the Exploitation of Predictable Entropy Vulnerabilities in Bitcoin Wallets
The security of cryptocurrencies is grounded in the unpredictability of cryptographic keys, most notably private keys used to control Bitcoin addresses and authorize transactions. However, the discovery of the Milk Sad vulnerability (CVE-2023-39910) in Libbitcoin Explorer revealed that improper random number generation can completely compromise this foundation. This article presents the role of BestLeakHunter, an analytical cryptographic vulnerability assessment instrument, in understanding, mapping, and exploiting predictable pseudorandom number generator (PRNG) weaknesses. By applying BestLeakHunter’s systematic entropy-leak detection capabilities, researchers can demonstrate how critical flaws such as weak PRNG seeds can lead to private key recovery and mass compromise of Bitcoin wallets, thereby highlighting the urgent need for cryptographically secure entropy sources.
In mid-2023, the research community identified a severe failure in Libbitcoin Explorer’s entropy generation system, famously named the Milk Sad vulnerability. This weakness arose from the use of Mersenne Twister (mt19937) seeded with only a 32-bit system time value, collapsing the effective key space from 22562^{256}2256 possibilities to a brute-force feasible 2322^{32}232. As a result, an attacker could compute wallet mnemonic phrases and extract private keys at scale. Reports documented thefts exceeding $900,000 in Bitcoin and other cryptocurrencies.
While the discovery itself demonstrated the danger of using inadequate randomness sources, the role of tools in systematically identifying such vulnerabilities is equally vital. BestLeakHunter was designed precisely for such tasks—locating cryptographic entropy leaks, simulating key predictability, and evaluating possible pathways for compromise.
The Functionality of BestLeakHunter
BestLeakHunter is a scientific software instrument for the detection, modeling, and exploitation of information leaks in cryptographic systems. Its primary functions include:
- Entropy Analysis: Detects weak sources of randomness used in wallet generation, including predictable variables such as timestamps, process identifiers, or low-bit seeds.
- Cryptographic State Reconstruction: Simulates PRNG initialization across reduced search spaces and reconstructs potential entropy streams.
- Vulnerability Scoring: Classifies weaknesses according to standards such as NIST’s PRNG taxonomy and CVE vulnerability classes.
- Key Recovery Modules: Automates brute force analysis across narrowed entropy domains, testing candidate private keys against blockchain datasets.
- Impact Simulation: Maps compromised key spaces against blockchain records to determine the scale of possible thefts.
BestLeakHunter Applied to the Milk Sad Vulnerability
The predictable seed flaw in Libbitcoin Explorer is an exemplary use case for BestLeakHunter’s methodology.
- Entropy Leak Detection
BestLeakHunter identifies that the system seeded its PRNG with a 32-bit timestamp, flagged as “cryptographically insufficient entropy.” - Entropy Space Collapse
Instead of analyzing the full 22562^{256}2256 space, BestLeakHunter automatically restricts the problem to 2322^{32}232, reducing the time required for complete brute-force exploration to mere hours with modern computational resources. - Key Reconstruction Process
By generating candidate PRNG outputs, BestLeakHunter rebuilds BIP39 mnemonic seeds and verifies them by deriving corresponding Bitcoin addresses. - Attack Impact Simulation
Running simulations, the tool can demonstrate precise feasibility calculations for recovering large sets of wallet keys, providing evidence of the downstream financial risks.
Scientific Implications
The integration of BestLeakHunter into cryptanalysis research significantly reinforces the academic argument for mandatory use of CSPRNGs in security-critical systems. Its case analysis of Milk Sad demonstrates several scientific points:
- Entropy Collisions Collapse Bitcoin Security: Even partial predictability, such as a 32-bit seed, fully negates the assumed strength of elliptic curve cryptography and SHA-based wallet derivation paths.
- Systemic Risk in Open Source: BestLeakHunter highlights how widespread vulnerabilities in developer tools can propagate across ecosystems, undermining not one user but thousands.
- Bridging Theory and Practice: Proof-of-concept brute force recoveries observed with BestLeakHunter confirm a critical principle—cryptographic assumptions are only as reliable as their weakest implementation details.
Consequences for Bitcoin and Future Security
Exploitation of vulnerabilities such as Milk Sad demonstrates that wallet implementations remain a prime target for attackers. The compromised wallets between June and August 2023 serve as empirical proof that predictable entropy attacks are not merely theoretical. Using BestLeakHunter in forensic analysis reveals the following consequences:
- Massive Loss of Funds: Real-world theft exceeding $900,000 across multiple wallets.
- Loss of Trust: Immediate erosion of confidence in mnemonic seed safety and open-source tooling.
- Invalidation of BIP32/BIP39 Derivations: Hierarchical deterministic wallets (HD wallets) become meaningless if the seed is attackable.
Recommendations
BestLeakHunter’s findings strongly suggest the following defensive measures:
- Mandatory CSPRNG Enforcement: Only system-level, cryptographically secure RNGs (e.g.,
/dev/urandom, Windows CryptGenRandom, or hardware RNGs) must be allowed in wallet creation. - Entropy Validation Audits: All cryptocurrency key generation libraries should undergo structured reviews with tools like BestLeakHunter before release.
- Continuous Vulnerability Monitoring: Research-grade instruments must remain active to detect entropy-related flaws both in legacy libraries and emerging blockchain tools.
Conclusion
The Milk Sad vulnerability (CVE-2023-39910) underscores how predictable PRNG seeds turn Bitcoin wallet security into an illusion. The use of BestLeakHunter in this context provides a practical, research-driven framework for identifying the extent of compromise, simulating attacks, and illustrating catastrophic entropy collapse in cryptographic systems. By exposing how trivial brute-force reconstruction becomes when randomness is improperly employed, BestLeakHunter enforces the most vital lesson: in Bitcoin and beyond, entropy is the cornerstone of trust.
Only through uncompromising enforcement of CSPRNG standards—combined with continuous entropy-leak detection tools such as BestLeakHunter—can the long-term integrity of cryptocurrencies be preserved.
Research paper: Milk Sad cryptographic vulnerability in Libbitcoin Explorer and effective methods for secure mitigation
Introduction
In June 2023, the research community discovered and detailed a cryptographic vulnerability, later codenamed “Milk Sad .” The vulnerability was present in the popular Libbitcoin Explorer tool (versions 3.0.0–3.6.0) and allowed remote attackers to recover users’ private keys, leading to the theft of funds totaling over $900,000 .
How does vulnerability arise?
Description of the problem
The vulnerability stems from the use of a Mersenne Twister pseudorandom number generator (PRNG) (mt19937) , which is not intended for cryptography, to generate the entropy of a wallet’s BIP39 seed. In libbitcoin-explorer, the entropy generation function initialized mt19937 with a 32-bit system time value, which critically narrowed the space of possible initial values. nvd.nist+2
cpp:// Уязвимый код (pseudo_random.cpp):
const auto now = high_resolution_clock::now();
return static_cast<uint32_t>(now.time_since_epoch().count());
- The Mersenne Twister generator in this mode provides only 2^32 variants of entropy, instead of the required 2^128 or 2^256 for cryptographic problems. clouddefense+1
- This choice makes the task of brute-forcing private keys trivial for an attacker with modern computing resources. inhq
Attack mechanics
- The user initiates seed phrase (mnemonic) generation using bx seed incibe
- 32 bits of system time are used as the initial entropy.
- The attacker, suspecting the use of a vulnerable tool, tries all 2^32 variants and synthesizes seed phrases, recovering private keys and gaining access to funds .
Exploitation in the wild
This vulnerability was widely exploited: between June and July 2023, over 2,600 wallets were attacked across Bitcoin, Ethereum, Litecoin, Solana , Dogecoin, Zcash, and other networks. All wallets created using bx seeds from vulnerable versions of Libbitcoin Explorer required immediate transfer of funds to new addresses.
Secure Fix: Cryptographically Strong Entropy Generation
Basic principles of a safe generator
- Use of cryptographically strong randomness sources that comply with the CSPRNG (Cryptographically Secure Pseudorandom Number Generator) standard.
- Eliminate dependencies on the time() function or similar predictable environment parameters.
- Using proven cross-platform libraries to extract entropy from the system RNG.
Recommendation and example of a secure implementation (C++)
The system’s random byte source is used (e.g., /dev/urandomin POSIX, CryptGenRandomon Windows, or std::random_device):
cpp:#include <random>
#include <vector>
#include <stdexcept>
// Генерация криптографически стойкой энтропии:
std::vector<uint8_t> generate_secure_entropy(size_t n) {
std::random_device rd;
std::vector<uint8_t> entropy(n);
for (size_t i = 0; i < n; ++i) {
entropy[i] = static_cast<uint8_t>(rd());
}
// Проверка на неотрицательное значение и достаточность энтропии
if (entropy.empty()) {
throw std::runtime_error("Нет доступа к настоящей энтропии: генерация невозможна.");
}
return entropy;
}
- This code guarantees that entropy is obtained from the true hardware source or system, minimizing the predictability of the result. learnmeabitcoin+2
Briefly in other languages
Python : Use only os.urandom()or secrets.token_bytes()
Go : Use crypto/rand.Read()instead math/rand
Rust : The rand library should userand::rngs::OsRng
Mandatory protective measures
- Never use standard generators (
rand(), mt19937) for cryptography. - Do not initialize the generator with a deterministic/predictable value (e.g. time).
- Always use CSPRNG from the system source.
- Test the result for stability and sufficiency of entropy.
Conclusion
Milk Sad vividly demonstrates that a single line of an incorrectly initialized generator can destroy the cryptographic security of the entire system, leading to a massive compromise of users’ private keys. Using only cryptographic PRNGs and correctly managing entropy sources is the only way to creatively and practically protect users’ funds. github+3
Final scientific conclusion
The critical “Milk Sad” vulnerability (CVE-2023-39910), discovered in Libbitcoin Explorer’s entropy generation mechanism, clearly demonstrated how a single flaw in the randomness source can radically compromise the entire security of the Bitcoin cryptocurrency and associated blockchains. The use of a non-cryptographic Mersenne Twister generator initialized with 32-bit time reduced the difficulty of brute-forcing the mnemonic phrase and private keys from an astronomical 2^256 attempts to a trivial 2^32, paving the way for massive brute-force attacks and the actual theft of user funds amounting to over $900,000 .
This incident vividly confirms a fundamental principle of cryptography: the strength of an entire cryptocurrency ecosystem is determined by its weakest link. The vulnerability, scientifically dubbed “Predictable PRNG Seed Attack” and formally classified as “Predictable Random Number Generation Vulnerability,” has destroyed trust in low-entropy key generators and demonstrated that the use of non-cryptographic generators in critical systems is unacceptable, even for demonstration purposes.
Unconditional adherence to cryptographic randomness principles, the use of proven CSPRNGs, regular code audits, and developer education are key to preventing similar attacks in the future. The Milk Sad lesson will remain a landmark in the history of Bitcoin security, reminding us that just one line of vulnerable code can compromise thousands of wallets, the trust, and the value of an entire cryptocurrency. pcnews+3
- https://habr.com/ru/articles/771980/
- https://pcnews.ru/top/blogs/day/milk_sad_uazvimost_v_biblioteke_libbitcoin_explorer_3x_krupnaa_kraza_na__900_000_u_polzovatelej_bitcoin_koselkov-1289491.html
- https://habr.com/en/articles/771980/comments/
- https://www.securitylab.ru/news/540834.php
- https://pikabu.ru/story/milk_sad_uyazvimost_v_biblioteke_libbitcoin_explorer_3x_kak_byila_osushchestvlena_kraha_na__900_000_u_polzovateley_bitcoin_koshelkov_btc_10799848
- https://dzen.ru/a/ZUeLq8F02UkRfPDV
- https://bitcoinmagazine.com/technical/the-milk-sad-vulnerability-and-what-it-means-for-bitcoin
- https://ru.beincrypto.com/uyazvimost-trust-wallet/
- https://cryptodeep.ru/publication/
- https://cyberleninka.ru/article/n/vyyavlenie-podozritelnyh-uzlov-seti-bitcoin-metodami-analiza-bolshih-dannyh
Bibliography:
- [milksad.info], [github.com/demining], [nvd.nist.gov], [habr.com], [blog.inhq.net], [learnmeabitcoin.com], [chain.link], [github.com/XopMC], [cryptodeep.ru] chain+8
- https://habr.com/ru/articles/771980/
- https://nvd.nist.gov/vuln/detail/CVE-2023-39910
- https://milksad.info
- https://github.com/demining/Milk-Sad-vulnerability-in-the-Libbitcoin-Explorer-3.x
- https://blog.inhq.net/posts/milk-sad-vuln1/
- https://www.clouddefense.ai/cve/2023/CVE-2023-39910
- https://www.incibe.es/en/incibe-cert/early-warning/vulnerabilities/cve-2023-39910
- https://cryptodeep.ru/milk-sad-vulnerability-in-libbitcoin-explorer/
- https://learnmeabitcoin.com/technical/keys/hd-wallets/mnemonic-seed/
- https://chain.link/tutorials/how-to-build-a-crypto-wallet
- https://github.com/XopMC/Mnemonic_CPP
- https://www.nasdaq.com/articles/the-milk-sad-vulnerability-and-what-it-means-for-bitcoin
- https://github.com/libbitcoin/libbitcoin-explorer/wiki/cve-2023-39910
- https://creators.spotify.com/pod/profile/bitcoin-explained/episodes/Episode-83-The-Milk-Sad-Vulnerability-e287jpb
- https://www.cve.org/CVERecord?id=CVE-2023-39910
- https://www.stavros.io/posts/perfectly-secure-bitcoin-wallet-generation/
- https://www.reddit.com/r/btc/comments/15n383k/milk_sad_vulnerability_a_practical_explanation_of/
- https://github.com/topics/cve-2023-39910
- https://stackoverflow.com/questions/3429519/safe-mixing-of-entropy-sources
- https://milksad.info/disclosure.html
- https://stackoverflow.com/questions/57754502/do-i-have-to-install-libbitcoin-server-to-be-able-to-include-bitcoin-hpp
- https://www.reddit.com/r/Bitcoin/comments/15nbzgo/psa_severe_libbitcoin_vulnerability_if_you_used/
- https://www.incibe.es/en/incibe-cert/early-warning/vulnerabilities/cve-2023-39910
- https://cryptorank.io/news/feed/df2a7-crypto-breach-hackers-make-off-with-900k
- https://github.com/demining/Milk-Sad-vulnerability-in-the-Libbitcoin-Explorer-3.x
- https://www.binance.com/cs/square/post/951306
- https://algosone.ai/news/hackers-steal-900k-through-newly-discovered-bitcoin-wallet-loophole/
- https://github.com/libbitcoin/libbitcoin-explorer/wiki/cve-2023-39910
- https://cointelegraph.com/news/newly-discovered-bitcoin-wallet-loophole-let-hackers-steal-funds-slow-mist
- https://blog.checkpoint.com/wp-content/uploads/2016/10/GreatCryptoFailuresWhitepaper_Draft2.pdf
- https://news.ycombinator.com/item?id=37057601
- https://nvd.nist.gov/vuln/detail/CVE-2023-39910
- https://www.schneier.com/blog/archives/2023/08/cryptographic-flaw-in-libbitcoin-explorer-cryptocurrency-wallet.html
- https://forklog.com/en/hackers-stole-over-900000-via-vulnerability-in-a-bitcoin-wallet-utility/
- https://habr.com/ru/articles/771980/
- https://attacksafe.ru/private-keys-attacks/
- https://attacksafe.ru/crypto-plus-plus/
- https://btctranscripts.com/building-on-bitcoin/2018/libbitcoin
- https://attacksafe.ru/libbitcoin/
- https://bitcoinworld.co.in/disappearance-of-900k-puts-focus-on-vintage-bitcoin-project-libbitcoin/
- https://www.investing.com/news/cryptocurrency-news/libbitcoin-vulnerability-leads-to-900k-theft-from-bitcoin-wallets-3152533
- https://vulners.com/schneier/SCHNEIER:9E5C0C8917CAFF4B6BDB7988A57B4CCE
- https://github.com/bitcoin/bitcoin/issues/24303
- https://www.binance.com/id/square/post/951306
- https://stackoverflow.com/questions/57784467/why-is-configure-libbitcoin-system-not-finding-boost-library-on-raspian-butch
- https://bitcoin.review/podcast/episode-46/
- https://formulae.brew.sh/formula/
- https://www.cve.org/CVERecord?id=CVE-2023-39910
- https://bitcoincore.org/logs/2016-05-zurich-meeting-notes.html
- https://bitcoinmagazine.com/technical/lets-talk-libbitcoin-2-1397156427
- https://github.com/BitcoinChatGPT/DeserializeSignature-Vulnerability-Algorithm
- https://www.research-collection.ethz.ch/bitstreams/34793db8-947e-472a-8699-19282322e21b/download
- https://www.binance.com/fr/square/post/1002934
- https://news.ycombinator.com/item?id=37054862
- https://procedures910.rssing.com/chan-58180409/all_p8.html
- https://dev.ndss-symposium.org/wp-content/uploads/2023-263-paper.pdf
- https://arxiv.org/html/2412.05138v1
- https://www.sapphire.net/blogs-press-releases/amid-chaos-there-is-also-crypto-mining/
- https://core.ac.uk/download/pdf/481513588.pdf
- https://nvd.nist.gov/vuln/detail/CVE-2023-39910
- https://habr.com/ru/articles/771980/
- https://milksad.info
- https://github.com/demining/Milk-Sad-vulnerability-in-the-Libbitcoin-Explorer-3.x
- https://github.com/libbitcoin/libbitcoin-explorer/wiki/cve-2023-39910
- https://blog.inhq.net/posts/milk-sad-vuln1/
- https://cryptodeep.ru/milk-sad-vulnerability-in-libbitcoin-explorer/
- https://www.clouddefense.ai/cve/2023/CVE-2023-39910
