Application of random process theory to the analysis of ECDSA vulnerabilities in the Bitcoin blockchain and private key recovery

25.10.2026

A technical overview based on the fundamental work of A. V. Bulinsky and A. N. Shiryaev, “The Theory of Random Processes” (Moscow: Fizmatlit, 2003). The theory of random processes, as presented in the fundamental work of Bulinsky and Shiryaev, provides not just an abstract mathematical apparatus, but  a practical tool  for ECDSA cryptanalysis. Key findings:

  1. A nonce sequence is a random process.  Its statistical properties (independence, stationarity, uniformity) can be rigorously verified using methods of probability theory and mathematical statistics.
  2. Any deviation from perfect uniformity creates vulnerability.  Empirical measures, characteristic functions, and Markov models make it possible to detect and quantify such deviations.
  3. Lattice attacks based on HNP are the most effective practical method.  They require a relatively small number of signatures and moderate computational resources, as confirmed by real-world attacks on the Bitcoin blockchain.
  4. Even ultra-small leaks (<1 bit) are exploitable.  Fourier analysis and related methods allow attacking circuits considered “practically secure” by a superficial analysis.
  5. Deterministic nonces (RFC 6979) eliminate the vulnerability at its root.  This is the primary countermeasure recommended for all ECDSA implementations.

Thus, random process theory not only explains  why  ECDSA is vulnerable to nonce attacks, but also indicates  how  to carry out these attacks – from constructing statistical tests to constructing lattices and solving HNP.

Content

1. Introduction

The Elliptic Curve Digital Signature Algorithm (ECDSA) is the cornerstone of Bitcoin transaction security. Its cryptographic strength is based on the difficulty of the discrete logarithm problem on an elliptic curve. However, as practice shows, the actual security of ECDSA critically depends on the quality of the generation  of the one-time random number  (nonce), denoted  k .

Every ECDSA signature requires a unique, unpredictable, and uniformly distributed value of  k . If this condition is violated—if the nonce is reused, bits are shifted, or the random number generator is predictable—an attacker can recover the long-term private signature key. This paper provides a systematic analysis of this vulnerability using the framework of random process theory, as described in the classic textbook by A. V. Bulinsky and A. N. Shiryaev.

Key idea:  The theory of random processes provides a formal language for describing the statistical properties of sequences of nonce values. Deviations of the empirical distribution  of k  from uniformity on the interval [1, n−1] can be detected and quantified using statistical hypothesis testing methods, and the identified bias can be used to construct an attack.

2. Theoretical foundations of ECDSA and hidden number

2.1 ECDSA Signature Equation

Let  d  be a private key (a scalar in the field  Z n ),  and n  be the order of the base point  G  on the secp256k1 curve. To sign a message with a hash  e  (an integer derived from SHA-256), a random nonce  k ∈ [1, n−1] is generated . The point  R = kG is calculated , its x-coordinate is taken modulo  n  and denoted by  r . Then, the following is calculated:

s = k −1  (e + r d) mod n

A signature is a pair  (r, s) . A critical observation: if  k  is known for at least one signature, the private key is calculated directly:

d = r −1  (s k − e) mod n

This is a direct consequence of the linearity of the signature equation with respect to  d  for known  k . [8†L8-L11]

2.2 Hidden Number and the HNP Problem

In real-world scenarios, the attacker doesn’t know  k  completely. However, if the sequence of nonce values ​​exhibits statistical anomalies—for example, the high-order bits are systematically zero or take on a limited set of values—the problem of recovering  d  reduces to  the Hidden  Number Problem (HNP).

Formally, for each signature  i  we have:

s i  · k i  − r i  · d ≡ e i  (mod n)

Rewriting with respect to  d :

d ≡ r i −1  s i  k i  − r i −1  e i  (mod n)

If approximations to  k i are known  (for example,  k i is known  to lie in the interval  [0, 2 n−b )  for  n -bit order), then each equation yields a linear relation in which  d  is a “hidden number” to be recovered. Lattice reduction methods (LLL, BKZ) allow such systems to be solved efficiently given a sufficient number of signatures.

It has been experimentally confirmed that even a  4-bit bias  in 256-bit ECDSA completely compromises the scheme: signatures generated with biased nonces converge to the private key via the HNP solution.[3†L32-L36] Studies on real Bitcoin blockchain data have shown the possibility of recovering hundreds of private keys by analyzing biased nonces in public transactions.[9†L4-L13]

3. The theory of random processes as an analytical apparatus

3.1 Nonce as a random process

Consider a sequence of nonce values  ​​{k 1 , k 2 , k 3 , …} generated by a wallet or signature device. Ideally, each  k i  is an independent realization of a uniformly distributed random variable on  {1, …, n−1} . Such a sequence can naturally be modeled as  a sequence of independent identically distributed random variables  (iid)—the simplest case of a random process.

However, in practice, pseudo-random number generators (PRNGs) can exhibit:

  • Correlation between successive values  ​​- the process ceases to be independent;
  • Distribution bias  – uniformity is disrupted;
  • Non-stationarity  – statistical properties change over time (e.g. due to changes in the state of the PRNG).

This is where the theory of random processes provides a rigorous mathematical framework for describing and detecting such anomalies.

3.2. Empirical measures and hypothesis testing

Chapter 3 of Bulinsky and Shiryaev’s book discusses  empirical measures constructed from observations of a random process. Applied to our problem, for a sample of nonce values  ​​k 1 , …, k m ,  we can construct an empirical distribution function:

F m (x) = (1/m) Σ i=1 m  1 {k i  ≤ x}

By comparing  F m (x)  with the theoretical uniform distribution function  F(x) = x/n , one can quantitatively assess the degree of deviation using goodness-of-fit tests (Kolmogorov–Smirnov, χ², Cramer–von Mises). A small  p -value indicates a statistically significant bias.

A more refined analysis is possible using  empirical characteristic functions :

φ m (t) = (1/m) Σ i=1 m  exp(i t k i )

The deviation  φ m (t)  from the characteristic function of the uniform distribution  (e it  − 1)/(it n)  allows us to detect not only the shift in the mean, but also more complex types of heterogeneity – clustering, periodicity, time dependence.

3.3 Markov chains and hidden states of PRNGs

Many PRNGs used in cryptographic libraries are deterministic finite automata. Their internal state evolves according to a Markov law, and the nonce is a function of the state. If an attacker can observe side channels (signature time, power consumption) or has access to some of the output bits, the problem arises of estimating the hidden state of the Markov chain from the observed data.

In terms of random process theory, the nonce sequence can be represented as  a partially observable Markov chain . Filtering methods (the Kalman filter in the linear Gaussian case, the particle filter in the general case) allow one to reconstruct the hidden state and, therefore, predict future values  ​​of k  with a probability exceeding random guessing.

Critical consequence:  If a nonce sequence exhibits a Markov dependence with non-zero mutual information between adjacent values  ​​I(k i ; k i+1 ) > 0 , then even in the absence of explicit repetition, an attacker can build a predictive model and use it to recover the key after accumulating a sufficient number of signatures.

3.4 Recovery processes and moments of repetition

Chapter 3 of Bulinsky and Shiryaev’s book also discusses  the recovery process  —the sequence of occurrences of similar events. In the context of ECDSA, a natural event is  the reappearance of a nonce value  or  its inclusion in a certain subset  (for example, a range of small values).

If nonces are generated independently and uniformly from  n  possible values, the probability of repetition among  m  signatures is described by the birthday problem. However, in the presence of bias, the effective number of “popular” values ​​decreases, and repetitions become significantly more frequent. The recovery process allows one to estimate  the mean time to first repetition  and use this information to plan an attack.

4. Practical Application: From Nonce to Private Key

4.1 Direct recovery with a known nonce

The simplest case is complete knowledge  of k  for a single signature. The recovery formula is:

d = r −1  (s k − e) mod n

This scenario is realized, for example, when the value of  k is leaked  through a side channel or when using a deterministic nonce that has become known to the attacker.[4†L7-L10]

4.2 Nonce Reuse Attack

If two different messages are signed with the same  k , we obtain the system:

s 1  = k −1 (e 1  + r d) mod n
s 2  = k −1 (e 2  + r d) mod n

Excluding  k :

k = (e 1  + r d) s 1 −1  = (e 2  + r d) s 2 −1  mod n
⟹ d = (s 2 e 1  − s 1 e 2 ) [r (s 1  − s 2 )] −1  mod n

This classic attack has been exploited many times in practice, including the PlayStation 3 incident and Android wallet vulnerabilities.[0†L4-L12]

4.3 Lattice attacks with partial knowledge of nonce

The most powerful and general method is to reduce the problem to HNP and construct a lattice. Consider  m  signatures for which the most significant  b  bits of the nonce are known to be zero (i.e.,  k i  < 2 n−b ). We define:

t i  = r i −1  · s i  mod n
u i  = −r i −1  · e i  mod n

Then:

d ≡ t i  k i  + u i  (mod n)

An m+2 lattice   with basis vectors is constructed, and the problem of recovering  d  is reduced to finding a short vector. The LLL (Lenstra–Lenstra–Lovasz) algorithm allows finding this vector in polynomial time given a sufficient number of signatures and a sufficiently large known bit size. [10†L2-L9]

It has been experimentally confirmed that with 256-bit ECDSA,  a bias of just 4 bits  and on the order of several dozen signatures is sufficient to successfully recover a key using the lattice method.[3†L32-L36] Research on the Bitcoin blockchain has revealed numerous transactions signed with such biased nonces, allowing the recovery of hundreds of private keys.[9†L4-L13]

4.4 Fourier analysis for ultra-small leaks

If less than one bit of nonce information is known (for example, only the sign of the most significant bit), lattice methods become ineffective. In this case, an alternative approach based on  Fourier analysis  of the nonce distribution is used. This method requires a significantly larger number of signatures (on the order of 2 32 – 2 35 ), but allows attacking even the weakest biases. [8†L23–L27]

From the point of view of the theory of random processes, this method uses the empirical characteristic function  φ m (t)  and its behavior in the neighborhood of zero to estimate the deviation of the distribution of  k  from uniform.

MethodRequired knowledge about nonceNumber of signaturesComputational complexity
Direct recoveryFull  k1O(1)
Reusek  matches2O(1)
Lattice attack (LLL/BKZ)≥ 2–4 bits10–100Polynomial
Fourier analysis< 1 bit2 32 –2 35Exponential

5. Conclusion

The theory of random processes, outlined in Bulinsky and Shiryaev’s seminal work, provides not just abstract mathematical apparatus but  practical tools  for ECDSA cryptanalysis. Key findings:

  1. A nonce sequence is a random process.  Its statistical properties (independence, stationarity, uniformity) can be rigorously verified using methods of probability theory and mathematical statistics.
  2. Any deviation from perfect uniformity creates vulnerability.  Empirical measures, characteristic functions, and Markov models make it possible to detect and quantify such deviations.
  3. Lattice attacks based on HNP are the most effective practical method.  They require a relatively small number of signatures and moderate computational resources, as confirmed by real-world attacks on the Bitcoin blockchain.
  4. Even ultra-small leaks (<1 bit) are exploitable.  Fourier analysis and related methods allow attacking circuits considered “practically secure” by a superficial analysis.
  5. Deterministic nonces (RFC 6979) eliminate the vulnerability at its root.  This is the primary countermeasure recommended for all ECDSA implementations.

Thus, random process theory not only explains  why  ECDSA is vulnerable to nonce attacks, but also indicates  how  to carry out these attacks – from constructing statistical tests to constructing lattices and solving HNP.

6. Directions for further research for cryptanalysis based on this area

The development of ECDSA cryptanalysis methods at the intersection with the theory of random processes opens up several promising directions:

  1. Bayesian methods for estimating the hidden state of a PRNG.  Using particle filters and MCMC methods to reconstruct the internal state of the nonce generator from indirect observations (time delays, power consumption, electromagnetic radiation). This will allow attacking implementations that are robust to classical statistical tests but contain hidden correlations.
  2. Detecting nonlinear dependencies in nonce sequences.  Using mutual information, correlation dimension, and transfer entropy methods to identify complex, nonlinear relationships between successive  k values ​​that are not captured by linear tests.
  3. Adaptive lattice attacks with learning.  Developing algorithms that dynamically select lattice parameters (dimension, scaling) based on statistical estimates of the nonce distribution obtained in real time. This will improve the effectiveness of attacks against heterogeneous signature sets.
  4. Nonce time series analysis for nonstationarity.  Using unit root tests, spectral analysis, and wavelet transforms to detect PRNG parameter drift over time, which may indicate generator compromise or degradation.
  5. Cross-correlation analysis between nonces and other side channels.  A study of the joint distribution of nonces and observed signature execution characteristics (time, cache misses, energy consumption) using copula functions and multivariate statistical analysis methods.
  6. Development of “weak” nonce generators for testing.  Creation of controlled generators with specified biases and dependencies for validation and comparison of the effectiveness of various cryptanalytic methods within a unified methodology.
  7. Applying large deviation theory.  Estimating the probabilities of rare events (such as the occurrence of a nonce within a narrow range) to predict vulnerabilities that only manifest themselves at very large signature volumes.
  8. Quantum-Resistant Aspects.  Investigation of how methods from random process theory can be adapted to analyze post-quantum signature schemes, where randomness generation also plays a critical role.

These areas are united by a common methodological basis:  the consideration of cryptographic parameters as implementations of random processes and the application of the entire arsenal of stochastic analysis to identify and exploit their imperfections.


This document was prepared based on an analysis of open sources and the fundamental work of A. V. Bulinsky and A. N. Shiryaev, “The Theory of Random Processes” (Moscow: Fizmatlit, 2003). The methods and formulas presented are for educational purposes only and are intended for information security specialists.