Based on the textbooks of A. V. Prokhorov, V. G. Ushakov, N. G. Ushakov, Yu. V. Prokhorov, and Yu. A. Rozanov. The probability theory presented in the Prokhorov–Ushakov and Prokhorov–Rozanov textbooks provides not just an abstract mathematical framework but a powerful tool for practical cryptanalysis of ECDSA in Bitcoin. Limit theorems allow one to estimate the required number of signatures for a statistical attack, characteristic functions underlie the Bleichenbacher method, and the theory of random processes helps model nonce generation and identify anomalies.
Real-world attacks on the Bitcoin blockchain demonstrate that even a small bias in the distribution k (less than one bit) can lead to complete recovery of a private key. This highlights the critical importance of correctly generating random numbers in cryptographic protocols and the need to use deterministic schemes such as RFC 6979.
The presented analysis shows that probabilistic methods are an integral part of modern cryptanalysis and should be taken into account when designing and auditing digital signature systems.
1. Introduction
Cryptanalysis of the Elliptic Curve Digital Signature Algorithm (ECDSA) in the context of the Bitcoin blockchain is the problem of recovering a signer’s long-term private key from a set of publicly available signatures. The vulnerability arises when the ephemeral nonce value (denoted by k) is generated with a deviation from a uniform distribution or is partially leaked through side channels. Even the slightest shift in the distribution k can lead to complete recovery of the private key given a sufficient number of signatures.[reference:0]
The textbooks “Problems in Probability Theory: Basic Concepts. Limit Theorems. Random Processes” by A. V. Prokhorov, V. G. Ushakov, and N. G. Ushakov, and “Probability Theory” by Yu. V. Prokhorov and Yu. A. Rozanov contain fundamental apparatus that is directly applicable to this problem: limit theorems (law of large numbers, central limit theorem), theory of random processes, characteristic functions, and infinitely divisible distributions[reference:1].
This paper demonstrates how these probabilistic tools allow us to formalize an attack on ECDSA as a statistical hypothesis testing and Hidden Number Problem (HNP) problem.
2. Mathematical model of ECDSA and problem statement
2.1. ECDSA Signature Algorithm
Let q be the order of a base point G on the elliptic curve secp256k1. When signing a message with a hash z and a private key x:
1. Select nonce k ∈ [1, q−1].
2. Calculate point R = k·G, its x-coordinate is taken modulo q: . 3. Calculate . 4. Signature: .r = Rx mod qs = k−1 (z + r·x) mod q(r, s)
From the signature equation follows a linear relationship:
k ≡ s −1 z + s −1 r x (mod q).
If k is known completely, then . However, in practice , is unknown, and the problem is reduced to reconstructing from a set of triples .x = r−1 (s·k − z) mod qkx(ri, si, zi)
2.2 Nonce bias as a probabilistic anomaly
Ideally, k it should be uniformly distributed over {1, …, q−1}. However, implementations may generate k from a narrower interval with , or have a bias in the high-order/low-order bits. This means that the distribution is statistically different from uniform [reference:2].[0, 2ℓ−1]ℓ < log2 qk
The cryptanalyst’s task is to determine the presence of bias in a sample of signatures and, using this bias, calculate . This is where probability theory provides a language for describing and quantifying this bias.(ri, si, zi)x
3. Applications of Probability Theory: Key Concepts
3.1 Random processes and nonce generation
The process of generating the nonce sequence can be viewed as a random process. Ideally, it is a sequence of independent identically distributed (iid) values with a uniform distribution on . If the implementation uses a deterministic generator (e.g., RFC 6979), the process degenerates into a deterministic function of the message and key—then the uncertainty disappears, and the attack is impossible [reference:3].k1, k2, …, kNZq
However, hardware or software errors (bad PRNGs, side-channel leaks) can cause deviations. Prokhorov and Ushakov’s textbook contains sections on random processes and conditional probabilities, which allow one to model sequences such as Markov chains or processes with dependent increments [reference:4]. For example, if the nonce bias is caused by a physical process (temperature drift, electromagnetic interference), it can be described as a stationary random process with nonzero mean.
3.2 Limit theorems and statistical attacks
Let be iid random variables with a distribution concentrated on the interval , where . Then the variable has a skewed distribution. Let’s consider the statistics:ki[0, B)B ≪ qki / q
T N = (1/N) Σ i=1 N (s i −1 r i ) mod q.
Using the law of large numbers (Kolmogorov’s theorem) and the central limit theorem, it can be shown that for large , N the quantity converges in probability to some value linearly related to . This underlies Bleichenbacher’s statistical attack [reference:5]. Limit theorems provide the rate of convergence and allow one to estimate the number of signatures required to achieve a given probability of success.TNxN
Example: If k is uniform on , then has mean . The central limit theorem allows us to state that the deviation of the sample mean from this value is of the order of . Therefore, when , the bias becomes statistically significant.[0, 2ℓ)k/q≈ 2ℓ−1/qO(1/√N)N ∼ q2 / 22ℓ
3.3 Hidden Number as a Probability Problem (HNP)
x The problem of signature recovery with partially known nonces reduces to the Hidden Number Problem (HNP) introduced by Boneh and Venkatesan. The formulation of HNP is:
Given and approximations , where . Find .ti ∈ Zqai = ⌊α·ti⌋q + ei|ei| < Bα ∈ Zq
In the context of ECDSA, α the private key plays a role x, and are associated with . Errors reflect uncertainty in the nonce. Prokhorov and Rozanov’s textbook contains sections on infinitely divisible distributions and characteristic functions , which are used to analyze error distributions and construct optimal statistical decision rules [reference:6].tiri si−1ei
The probabilistic approach to HNP includes:
- Estimation of the entropy of the distribution
k(via differential entropy); - Testing the hypothesis of uniformity using the χ² test or the Kolmogorov–Smirnov test;
- Constructing confidence intervals for
xbased on sample data.
3.4 Bleichenbacher Attack Based on Fourier Analysis
Daniel Bleichenbacher proposed a powerful statistical method for solving HNP based on the discrete Fourier transform. The idea is that if a nonce k is biased (for example, the most significant bits are fixed), the distribution of the value exhibits characteristic peaks in the frequency domain. Fourier analysis allows one to isolate these peaks and reconstruct them even with very slight bias (less than one bit) [reference:7] [reference:8].si−1 (zi + ri x)x
The probability-theoretic basis of this method is characteristic functions. The characteristic function of a uniform distribution is [0, q) equal to sinc(πt), and in the presence of a bias, additional oscillations appear in it. Prokhorov and Rozanov’s textbook provides a detailed discussion of the method of characteristic functions for proving limit theorems [reference:9]; the same tools allow one to analyze the spectrum of the nonce distribution.
Practical result. Bleichenbacher’s attack allowed Bitcoin private keys to be recovered with just one bit of bias in the nonce on a 160-bit curve, and with improvements, even with a probabilistic leakage of less than one bit (LadderLeak)[reference:10].
3.5 Lattice attacks and LLL reduction
An alternative approach to HNP is to construct a lattice containing a vector whose coordinates are associated with x and errors . The problem reduces to finding the shortest vector (SVP) or the vector close to the given one (CVP). The LLL (Lenstra–Lenstra–Lovász) algorithm and its modifications (BKZ, G6K) allow one to efficiently solve these problems given a sufficient number of signatures [reference:11] [reference:12].ei
Probabilistic analysis of lattice attacks involves estimating the probability that the target vector will be shortest, depending on:
- The size of the offset (the bit length of the known part
k); - Number of signatures
N; - Lattice dimensions.
Limit theorems allow us to derive asymptotic estimates: as , N → ∞ the success probability approaches 1 if the bias exceeds a certain threshold. For the 256-bit secp256k1 curve, 4–6 signatures with known high-order bits of the nonce are sufficient to recover the key [reference:13].
4. Practical examples and tools
4.1 Nonce Reuse Attack
If two messages are signed with the same k, then:
s 1 − s 2 = k −1 (z 1 − z 2 ) ⇒ k = (z 1 − z 2 ) / (s 1 − s 2 ) mod q.
After calculation, k the private key is trivially found. This case is degenerate, but historically, it led to the compromise of the PlayStation 3 and a number of Bitcoin wallets [reference:14].
4.2. Statistical Analysis of Blockchain
In Breitner and Heninger (2019), the authors scanned the Bitcoin blockchain and discovered hundreds of keys compromised due to misaligned nonces. Using lattice attacks on HNP, they recovered private keys corresponding to real addresses with non-zero balances.[reference:15] This demonstrates the practical value of probabilistic methods.
4.3. Tools
| Tool | Method | Link |
|---|---|---|
ecdsa-break | LLL/BKZ lattice reduction | PyPI[reference:16] |
| KeySilentLeak | Blockchain scanning, bias analysis | Mallory.ai[reference:17] |
| LadderLeak (PoC) | Fourier analysis, leakage < 1 bit | IACR ePrint 2020/615[reference:18] |
5. Conclusion
Probability theory, as presented in the textbooks by Prokhorov-Ushakov and Prokhorov-Rozanov, provides not just an abstract mathematical framework but a powerful tool for practical cryptanalysis of ECDSA in Bitcoin. Limit theorems allow one to estimate the number of signatures required for a statistical attack, characteristic functions underlie Bleichenbacher’s method, and the theory of random processes helps model nonce generation and identify anomalies.
Real-world attacks on the Bitcoin blockchain demonstrate that even a small bias in the distribution k (less than one bit) can lead to complete recovery of a private key. This highlights the critical importance of correctly generating random numbers in cryptographic protocols and the need to use deterministic schemes such as RFC 6979.
The presented analysis shows that probabilistic methods are an integral part of modern cryptanalysis and should be taken into account when designing and auditing digital signature systems.
Directions for further research for cryptanalysis based on this area
- Adaptive statistical attacks with learning. Developing methods that estimate the nonce distribution in real time as new signatures are received and dynamically select the optimal key recovery strategy. Bayesian methods and the theory of random processes with switching can be applied here.
- Analysis of nonstationary biases. Investigation of cases where the nonce bias changes over time (for example, due to hardware generator degradation). Models of nonstationary random processes from the Prokhorov-Ushakov textbook allow for more accurate predictions and attack adaptation.
- Combined attacks (lattice + Fourier). Hybrid schemes that leverage the advantages of lattice methods (small number of signatures) and Fourier analysis (noise immunity). Probability-theoretic analysis of the optimal combination of these approaches remains an open problem [reference:19].
- Application of infinitely divisible distributions. Nonce distributions in real systems can have “heavy tails” or be a mixture of distributions. The framework of infinitely divisible distributions and Lévy processes, presented in the Prokhorov-Ushakov textbook, can provide new tools for analyzing such cases.
- Quantum Probabilistic Algorithms for HNP. Investigation of the feasibility of using quantum computing to accelerate the solution of HNP and, consequently, attacks on ECDSA. Probabilistic methods of quantum information theory can be adapted to estimate the complexity of such attacks.
- Automated blockchain auditing. The creation of scalable systems that continuously scan the blockchain, apply statistical tests to each signature, and automatically launch lattice or Fourier attacks when anomalies are detected. This requires the development of multivariate statistical analysis methods and large sample theory.
Bibliography
- Prokhorov A. V., Ushakov V. G., Ushakov N. G. Problems in Probability Theory: Basic Concepts. Limit Theorems. Random Processes. — Moscow: Nauka, 1986. — 328 p.
- Prokhorov Yu. V., Rozanov Yu. A. Probability Theory (Basic Concepts. Limit Theorems. Random Processes). – Moscow: Nauka, 1973. – 496 p.
- Breitner J., Heninger N. Biased Nonce Sense: Lattice Attacks against Weak ECDSA Signatures in Cryptocurrencies // IACR ePrint 2019/023.[reference:20]
- Aranha DF et al. LadderLeak: Breaking ECDSA With Less Than One Bit Of Nonce Leakage // IACR ePrint 2020/615.[reference:21]
- Gao Y. et al. Attacking ECDSA with Nonce Leakage by Lattice Sieving: Bridging the Gap with Fourier Analysis-based Attacks // ASIACRYPT 2024.[reference:22]
- Xu L. et al. Improved Attacks on (EC)DSA with Nonce Leakage by Lattice Sieving with Predicate // CHES 2023.[reference:23]
