B. A. Sevastyanov’s course in probability theory and mathematical statistics provides a complete set of tools necessary for cryptanalytic research of ECDSA. Hypothesis testing allows one to detect nonce bias, maximum likelihood methods and Bayesian inference provide estimates of unknown parameters, Markov chain theory models dependent sequences, and limit theorems substantiate the asymptotic properties of statistics.
When combined with algebraic methods (Hidden Number Problem) and lattice algorithms (LLL, BKZ), these statistical methods form an effective practical tool for recovering Bitcoin private keys. Real-world attacks on blockchains confirm the applicability of this approach.
Thus, the area presented in Sevastyanov’s works is not just a theoretical basis, but a direct guide to action for a cryptanalyst working with ECDSA.
Content
- Introduction
- 1. Theoretical foundations of ECDSA and the role of nonce
- 2. Probabilistic nonce model and its biases
- 3. Statistical methods for detecting nonce biases
- 4. Application to private key recovery
- 5. Examples from real practice
- Conclusion
- Directions for further research for cryptanalysis based on this area
Introduction
The problem of recovering a long-term ECDSA private key from a set of signatures generated using biased or predictable nonce values is one of the central problems in practical cryptocurrency cryptanalysis. The ECDSA algorithm requires the generation of a unique random number. for each signature. If this number is not uniformly distributed or has statistically detectable patterns, an attacker with a large number of signatures from the blockchain can recover the private key.
B. A. Sevastyanov’s course on probability theory and mathematical statistics [1] provides a powerful and systematic framework for solving this problem. In this paper, we consistently apply probabilistic models, hypothesis testing methods, parameter estimation, Bayesian inference, and the theory of random processes to the analysis of nonce sequences extracted from Bitcoin transactions and to private key recovery.
The purpose of this paper is to demonstrate how the theoretical constructs from Sevastyanov’s course directly translate into practical ECDSA cryptanalysis algorithms. Particular attention is paid to the statistical detection of nonce biases and their use to reduce the problem to a Hidden Number Problem (HNP) and subsequently solve it using lattice analysis methods.
1. Theoretical foundations of ECDSA and the role of nonce
The ECDSA algorithm over the standard secp256k1 curve (used in Bitcoin) is defined by the following parameters: a prime number , by group order , generator point and a hash function When signing a message with a private key a random number is generated (nonce). Then the following are calculated:
The signature is a pair From the equation for easy to express :
If the attacker knows for at least one signature, it immediately calculates . If is repeated in two signatures (even for different messages), the private key is also trivially recoverable. However, even in the absence of repetitions, but in the presence of a statistical relationship between the values in different signatures, the key can be recovered.
Classic result: if nonce has a bias – for example, its most significant bits are always zero, or it is sampled from a smaller range than , — then the task of recovery comes down to solving a system of linear comparisons with small unknowns. This is the Hidden Number Problem (HNP).
2. Probabilistic nonce model and its biases
From a probability theory perspective, the correct generation of a nonce means that is a realization of a random variable uniformly distributed over the set Let’s denote this as The probability density (for continuous approximation) or probability mass (for the discrete case) are equal to for each valid value.
Bias means that the true distribution differs from uniform. In practice, the following types of displacements are encountered:
- Range reduction: is selected from the interval With Then they talk about a “short nonce”.
- Fixed bits: high or low bits are always equal to zero (or some constant). This leads to the fact that lies in a known subset.
- Linear dependence: values for different signatures are related by a linear relationship with known or unknown coefficients.
- Markov dependence: sequence forms a Markov chain (for example, a generator on a shift register with linear feedback).
In terms of probability theory, bias means that the entropy less Mutual information between and the observed data (signature) is positive, which creates an information leak about .
Formally, if has a distribution , then for each signature with a message is being performed:
The task of a cryptanalyst is based on observations restore This is a statistical estimation problem under a parametric model, where — is an unknown parameter, and — hidden (latent) variables.
3. Statistical methods for detecting nonce biases
3.1 Testing hypotheses about uniformity
The cryptanalyst’s first step is to check whether the nonce distribution is uniform. This is accomplished using the statistical hypothesis testing framework outlined in Sevastyanov’s course [1, Chapters 6–7].
Let there be a sample of signatures , . Observe directly it is impossible, but it is possible to calculate the value that, if true, would be equal . Let us denote by hypothetical value of nonce given . If — the true key, then and distribution corresponds to the true distribution .
However unknown. Therefore, indirect tests are used. For example, one can check the uniformity of the distribution of values or . If are uniform, then must also be uniform (at a fixed and random ). If have a bias, this will affect the distribution .
To check for uniformity, the chi-square (Pearson) test is used. We will split the range of values on intervals (bins). Let’s calculate the observed frequencies hits V -th bin. Expected frequencies for uniform distribution: . Criterion statistics:
If the null hypothesis is true (uniformity) asymptotically distributed as If the calculated value exceeds the critical value for the given significance level , the uniformity hypothesis is rejected.
More powerful tests—the NIST SP 800-22 battery [4]—include tests for frequency, runs, block frequency, entropy, and others. They allow one to detect subtle deviations from randomness that may not be visible in a simple chi-square test.
3.2. Estimation of distribution parameters using the maximum likelihood method
If the displacement has a parametric form (e.g., evenly distributed across ), we can estimate the parameter by the maximum likelihood method [1, Chapter 7].
Likelihood function for one observation given the known and unknown has the form:
Probability is determined through distribution : If evenly on , That also has a known distribution. Maximization By And provides maximum likelihood estimates. In practice, is unknown, so profile likelihood or joint maximization is used.
The maximum likelihood method is asymptotically efficient and consistent, which allows one to obtain accurate estimates for large .
3.3 Bayesian approach
The Bayesian approach [1, Chapter 8] allows one to take into account a priori information about the distribution And . Posterior distribution calculated using Bayes’ formula:
Where — data. If the prior distribution uniformly on the key space, then the posterior distribution is concentrated around the true when increasing Bayesian estimates (e.g., posterior mean or maximum posterior probability) can be used to recover the key.
The Bayesian approach is particularly useful when the nonce bias has a complex structure, making it difficult to derive an analytical expression for the likelihood. In such cases, Markov Monte Carlo (MCMC) methods are used to sample from the posterior distribution.
3.4 Markov chains and hidden Markov models
If the nonce generator has memory (for example, it is a linear congruential generator or a shift register), the sequence can be described by a Markov chain [1, Chapter 8]. In this case, to predict the next values Methods of the theory of random processes are applied.
The Hidden Markov Model (HMM) assumes that the observed signatures are probability functions of hidden states , which evolve according to the Markov law. The Baum–Welch algorithm or the Kalman filter (for the continuous case) allow one to estimate the model parameters and reconstruct the sequence , and then .
3.5 Regression analysis
If some of the bits are known (for example, due to side-channel leakage), a regression model can be built that relates the observed bits to The signature equation is linear in :
If , Where — the known part, and — a small error, then we obtain a linear regression with errors on the left-hand side. The least squares method or its generalizations allow us to estimate .
4. Application to private key recovery
4.1 Connection to the Hidden Number Problem
The Hidden Number Problem (HNP) is formulated as follows: given steam such that , Where — an unknown number (in our case ), A – minor errors. Need to find .
In ECDSA, after rearranging the signature equation, we obtain:
Let us denote , . Then:
If small (for example, With ), then this is exactly HNP with small errors The task comes down to searching , in which all values lie in a known small interval.
4.2. Bleichenbacher’s statistical approach (Fourier analysis)
Bleichenbacher’s approach is based on the Fourier analysis of the nonce distribution. If the distribution differs from uniform, then the likelihood function for has a peak at the true value. For each hypothesis statistics are calculated:
If , then the arguments of the exponents correspond to the true ones , the distribution of which is shifted, which leads to coherent summation and a large value For the infidels the sum behaves like a random variable with zero mean. This method requires a large number of signatures (), but is capable of detecting extremely small offsets (less than one bit) [8].
4.3. Lattice attacks and the role of statistics
Lattice attacks (LLL, BKZ) are most effective when there is a large bias (several known bits). The idea is to construct a lattice containing a vector whose components include and mistakes After lattice reduction, the short vector yields the desired values.
Statistics plays a key role at the data preparation stage:
- Determining the limits of ki: statistical analysis allows us to estimate the upper limit such that This determines the lattice parameters.
- Selecting the number of signatures N: from probability theory one can estimate the minimum , required to successfully recover the key with a given probability. For example, an attack on a 256-bit key with a 4-bit offset requires approximately 100–200 signatures [7].
- Outlier filtering: Not all signatures can be used (some may be “normal”). Statistical methods allow us to select signatures that best fit the bias model.
In [7], the authors applied lattice attacks to the Bitcoin blockchain and computed hundreds of private keys. They used HNP and LLL reduction, and statistical analysis helped identify transactions with abnormally short nonces.
4.4. Practical algorithm for key recovery
Let’s combine all the stages into a single algorithm:
- Data collection. All signatures are extracted from the blockchain . for the target public key. The more signatures, the higher the chances.
- Primary statistical analysis. Hypotheses about the uniformity of distribution are tested. (Chi-square test, NIST tests). If a deviation is detected, this indicates nonce bias.
- Estimating the bias parameters. Using the maximum likelihood method or Bayesian inference, the range of possible values is estimated. (For example, ).
- Construction of the HNP lattice. A lattice basis of dimension is formed. , including And . Parameter is selected based on an upper bound for .
- Lattice reduction. The LLL algorithm (or BKZ for greater accuracy) is used. The result is a short vector containing the candidate .
- Verification. Candidate checked on several signatures: calculated and it is checked that (those. -coordinate coincides with ). If the check passes, the key is restored.
Instrumental implementation: The package ecdsa-break [6] implements exactly this approach, including weak signature generation and key recovery via LLL/BKZ.
5. Examples from real practice
The methods described are not purely theoretical. In 2019, Breitner and Heninger [7] analyzed the Bitcoin, Ethereum, and Ripple blockchains and computed hundreds of private keys. They found that many implementations used nonces with a reduced range (e.g., 64-bit or 128-bit instead of 256-bit). The attack took approximately 40 CPU years but yielded real keys.
In 2025, the Upbit exchange hack involved analyzing millions of Solana signatures and identifying subtle statistical patterns in the nonces [9]. Professor Jaewoo Cho noted that the attackers exploited “statistical patterns in the platform’s cryptography,” which is consistent with the approach described in this paper.
These examples confirm that statistical nonce analysis combined with lattice methods is a powerful tool for cryptanalysis of ECDSA in real blockchain systems.
Conclusion
B. A. Sevastyanov’s course in probability theory and mathematical statistics provides a complete set of tools necessary for cryptanalytic research of ECDSA. Hypothesis testing allows one to detect nonce bias, maximum likelihood methods and Bayesian inference provide estimates of unknown parameters, Markov chain theory models dependent sequences, and limit theorems substantiate the asymptotic properties of statistics.
When combined with algebraic methods (Hidden Number Problem) and lattice algorithms (LLL, BKZ), these statistical methods form an effective practical tool for recovering Bitcoin private keys. Real-world attacks on blockchains confirm the applicability of this approach.
Thus, the area presented in Sevastyanov’s works is not just a theoretical basis, but a direct guide to action for a cryptanalyst working with ECDSA.
Directions for further research for cryptanalysis based on this area
The development of statistical methods for ECDSA cryptanalysis can proceed in the following directions:
- Machine learning for weak nonce detection. Neural networks and deep learning methods can detect nonlinear and subtle patterns in sequences. , which are not detected by classical statistical tests.
- Nonce time series analysis. If the nonce generator has a time-dependent state, spectral analysis and autoregressive methods can predict the following values .
- Bayesian networks and probabilistic programming. Construction of complex hierarchical Bayesian models that simultaneously account for multiple sources of information leakage (time, energy consumption, signature structure).
- Adaptive statistical tests. Developing sequential criteria that allow for accumulating evidence of nonce bias as new signatures arrive from the blockchain in real time.
- Quantum Algorithms for HNP. Investigating the feasibility of using quantum computing to solve the Hidden Number Problem with low bias, which could radically reduce the number of signatures required.
- Formal verification of nonce generators. Developing statistical models that can be used to automatically verify the compliance of random number generators with cryptographic standards.
These directions combine classical probability theory with modern computational methods and open new horizons for practical cryptanalysis.
References:
[1] Sevastyanov B. A. Course in probability theory and mathematical statistics. Moscow: Nauka, 1982.
[2] Sevastyanov B. A., Chistyakov V. P., Zubkov A. M. Collection of problems in probability theory. Moscow: Nauka, 1986.
[3] Breitner J., Heninger N. Biased Nonce Sense: Lattice Attacks against Weak ECDSA Signatures in Cryptocurrencies // IACR ePrint 2019/023.
[4] NIST SP 800-22: A Statistical Test Suite for Random and Pseudorandom Number Generators for Cryptographic Applications.
[5] Xu L., Dai Z., Wu B., Lin D. Improved Attacks on (EC)DSA with Nonce Leakage by Lattice Sieving with Predicate // CHES 2023.
[6] ecdsa-break: Recover ECDSA private keys from biased-nonce signatures via LLL/BKZ lattice reduction. PyPI, 2026.
[7] Upbit Hack Stemmed From High-Level Mathematical Exploit, Says Local Expert // Yahoo Tech, 2025.
