Applying probabilistic methods from the Korshunov–Voss problem book to cryptanalysis of ECDSA in the Bitcoin blockchain

26.10.2026

Despite its educational nature, Korshunov and Foss’s book of problems provides  a full range of probabilistic tools necessary for formalizing and solving the hidden number recovery problem in ECDSA. Key sections—the theory of random variables, limit theorems, martingales, and random processes—allow one to:

  • construct probabilistic models of nonce distribution and estimate their parameters;
  • justify statistical methods for detecting bit bias and leakage;
  • analyze the effectiveness of cryptanalysis algorithms (Fourier analysis, lattice attacks) in terms of the probability of success and the required amount of data;
  • apply these methods to real Bitcoin blockchain data to recover private keys.

Thus, probability theory is not just an auxiliary discipline, but  a fundamental basis  for modern ECDSA cryptanalysis, especially in the context of nonce generation flaws.

Content

1. Introduction and statement of the problem

The ECDSA (Elliptic Curve Digital Signature Algorithm) digital signature scheme underpins transaction security on the Bitcoin blockchain. A critical element of ECDSA is  a one-time random number  (nonce). k, unique for each signature. If k turns out to be weak—reused, partially leaked, or misplaced—an attacker can recover the long-term private key d, signing transactions.

The book by  D. A. Korshunov and S. G. Foss, “Collection of Problems and Exercises in Probability Theory”  (Novosibirsk, 1997)[reference:0] contains 909 problems on key topics in probability theory and random processes[reference:1]. Although the book is not directly devoted to cryptography, its sections provide  the fundamental mathematical apparatus necessary for constructing probabilistic models of attacks on ECDSA.

The purpose of this paper is to show how the sections of the problem book are applied to the formalization of the hidden number recovery problem k and, therefore, the private key d, and also demonstrate practical algorithms that implement these ideas on real Bitcoin blockchain data.

2. Theoretical basis: sections of the Korshunov-Foss problem book

The structure of the problem book includes the following key parts relevant to ECDSA cryptanalysis[reference:2]:

Part of the problem bookContentApplication in ECDSA cryptanalysis
Part I. Probability SpaceOperations on events, classical definition of probability, geometric probabilityModeling the space of possible nonces; estimating the probability of repetition or falling within a given interval
Part II. Conditional Probabilities and IndependenceConditional probability, independent events, Bernoulli scheme, formula of total probability, Bayes’ formulaBayesian inference about meaning k based on observed signatures; estimating the conditional probability of nonce bit leakage
Part III. Random variables and distributionsDistribution functions, joint distribution, moments, characteristic functions, generating functionsDistribution modeling k; calculating the moments (mean, variance) of a biased nonce; characteristic functions for Fourier analysis
Part IV. Convergence of random variablesConvergence almost certainly, convergence in probability, weak convergence, convergence of meansJustification of the statistical consistency of the estimates k with an increase in the number of signatures
Part V. The Law of Large NumbersIndependent identically distributed terms, dependent termsEstimating the number of signatures required for reliable recovery d
Part VI. Limit TheoremsCentral Limit Theorem, Numerical ExercisesAsymptotic analysis of the error distribution in lattice attacks
Part VII. Markov ChainsTransition probabilities, classification of states, ergodicityModeling nonce sequences in pseudorandom number generators
Part VIII. Conditional Expectation. MartingalesConditional expectation, martingalesAnalysis of “fair games” in bit guessing k; construction of optimal strategies
Part IX. Random ProcessesGeneral properties, Wiener process, Poisson process, linear theory of random sequencesNonce time series modeling; autocorrelation estimation

3. Probabilistic nonce model in ECDSA

In ECDSA signature (r,s) for a message with a hash z calculated using the formulas:r=(kG)xmodn,s=k–1(z+rd)modn

Where n — order of the base point G, d — private key, k — nonce, which must be uniformly distributed over the segment [1,n–1].

If k has an offset, for example, senior l bits are equal to zero, then k<2log2⁡n–lThis means that k can be written as k=k′ With |k′|<2log2⁡n–lThen the signature equation is transformed to the form:siki=zi+rid(modn)⟹ki–(si–1ri)d+(–si–1zi)≡0(modn)

This is an instance of  a hidden numerical problem  (HNP), where the unknowns are d and small ki.

From a probability theory perspective, the observed signatures can be viewed as a sample from the joint distribution (Z,R,S,K)The task of a cryptanalyst is to evaluate d for implementation (zi,ri,si), using knowledge of the distribution KThe sections of the problem book devoted to  conditional probabilities  and  Bayes’ formula allow one to formalize the posterior distribution  .d given the given data.

4. Hidden Number Problem

The HNP introduced by Boneh and Venkatesan is formulated as follows. Given a modulus n and a sequence of pairs (ai,bi), Wherebi=(ai⋅α+ei)modn

with an unknown α and small errors ei. Need to find αIn the context of ECDSA:α=d,ai=si–1ri,bi=–si–1zi,ei=ki

provided that ki small (shifted).

The Korshunov-Foss problem book provides tools for analyzing statistical properties ei:

  • Moments  (§11) allow us to calculate the mathematical expectation and variance ki, which is directly related to the “quality” of the displacement.
  • Characteristic functions  (§12) form the basis of Fourier analysis for HNP.
  • The law of large numbers  (§19–21) justifies the convergence of sample estimates ki to true values ​​as the number of signatures increases.

5. Methods for recovering a private key

5.1 Nonce Reuse

If there are two messages z1,z2 signed with the same k, That:s1=k–1(z1+rd),s2=k–1(z2+rd)⟹k=z1–z2s1–s2modn⟹d=s1k–z1rmodn

This case is deterministic and does not require probabilistic methods. However, in real blockchains, such incidents occur due to errors in random number generators [reference:3]. The probability of a coincidence k with random generation it is negligible, but when using deterministic schemes (for example, RFC 6979 with errors) it is possible.

5.2 Biased nonces and limit theorems

A more common scenario is  nonce offsetting  , when k is not uniform, but, for example, has zero high-order bits. In this case, a statistical approach is applied.

Let ki — independent random variables with a known distribution shifted from the uniform one. Then the signature equation can be rewritten as:si–1zi+si–1rid≡ki(modn)

Let us denote ai=si–1ri, bi=–si–1zi. Then:aid+bi≡ki(modn)

This is a system of linear comparisons with small errors. kiTo solve it, methods based on  the central limit theorem  (Section VI of the problem book) are used: with a large number of signatures, the distribution of the sum of errors approaches normal, which allows us to estimate d least squares method in modular arithmetic.

Estimating the number of signatures required ℓ can be obtained from Chebyshev’s inequality or the law of large numbers. For example, if ki have zero seniors l bits, then the standard deviation ki proportionally 2log2⁡n–l, and to achieve the specified accuracy it is required ℓ∼n/22l signatures[reference:4].

5.3. Fourier analysis based on probability estimates

Bleichenbacher’s method uses  characteristic functions  (Section III, §12) to reconstruct d. The idea is as follows. Consider the functionf(x)=∑i=1ℓexp⁡(2πi(aix+bi)modnn)

If x=d, then the arguments of the exponents are close to ki, which are small, and the imaginary part of the sum has an anomalously high absolute value. Thus, the problem is reduced to finding the peak of the Fourier spectrum on the set Zn.

The probabilistic analysis of this method is based on  the Bernstein–Hoeffding inequality  and  the central limit theorem : for large ℓ random variable f(x) For x≠d is distributed asymptotically normally with zero mean, and for x=d has a bias proportional to the probability of hitting ki into a small interval[reference:5]. This allows one to select the detection threshold and estimate the probability of error.

5.4 Lattice attacks and the role of martingales

Lattice attacks (LLL, BKZ) construct a lattice containing a vector corresponding to the true d and small kiThe lattice matrix has the form:M=(n0⋯000n⋯00⋮⋮⋱⋮⋮a1a2⋯aℓB/nb1b2⋯bℓB)

Where B — scaling parameter. The desired vector (k1,…,kℓ,Bd/n,B) is short if ki are small. Lattice reduction algorithms find this vector.

Probabilistic analysis of the success of lattice attacks uses  martingales  (Section VIII of the problem book). The process of finding a short vector can be viewed as a martingale: the conditional mathematical expectation of the “distance” to the true vector at each reduction step is equal to the previous value. This allows one to estimate the probability of success and the required number of signatures. In addition,  Markov chains  (§24–25) are used to model nonce sequences generated by deterministic algorithms (e.g., RFC 6979), where each subsequent k depends on the previous one.

6. Practical application to Bitcoin transactions

Let’s look at a step-by-step algorithm for recovering a private key based on real blockchain data.

Step 1: Data Collection

All transactions containing ECDSA signatures for the same public key (or address) are extracted from the blockchain. For each signature, (zi,ri,si).

Step 2: Anomaly Detection

Checking for duplicates r. If ri=rj For i≠j, then the nonce is reused, and the private key is calculated directly using the formulas in Section 5.1. This analysis reveals hundreds of vulnerable keys in Bitcoin[reference:6].

Step 3. Estimating nonce bias

If there are no repetitions, the statistics are calculated ai=si–1rimodn And bi=–si–1zimodnThen the hypothesis is tested that ki=(aid+bi)modn have a small value. For this purpose, one can use  the chi-square goodness-of-fit test  (Section VI) or estimate the empirical distribution function ki under various assumptions about d.

Step 4. Applying probabilistic algorithms

Depending on the nature of the displacement, the method is selected:

  • Fourier analysis  (Section 5.3) is effective when the number of known bits is small (1–2 bits) and the number of signatures is large (ℓ∼104–106).
  • Lattice attacks  (Section 5.4) – work with larger offsets (4-8 bits) and smaller ones ℓ (tens-hundreds of signatures).
  • The least squares method in modular arithmetic  is used when the bias can be described by a normal distribution (a consequence of the central least squares theory).

Step 5. Verification

Found candidate d The key is verified by generating a signature for a known message and comparing it with the original signature from the blockchain. If the signature matches, the key has been recovered correctly.

A practical example.  In the paper “Biased Nonce Sense,” the authors analyzed the Bitcoin, Ethereum, and Ripple blockchains and recovered approximately 300 Bitcoin private keys using lattice attacks based on HNP [reference:7]. The total computation time was approximately 40 CPU years, demonstrating the practical feasibility of the approach.

7. Conclusion

Despite its educational nature, Korshunov and Foss’s book of problems provides  a full range of probabilistic tools necessary for formalizing and solving the hidden number recovery problem in ECDSA. Key sections—the theory of random variables, limit theorems, martingales, and random processes—allow one to:

  • construct probabilistic models of nonce distribution and estimate their parameters;
  • justify statistical methods for detecting bit bias and leakage;
  • analyze the effectiveness of cryptanalysis algorithms (Fourier analysis, lattice attacks) in terms of the probability of success and the required amount of data;
  • apply these methods to real Bitcoin blockchain data to recover private keys.

Thus, probability theory is not just an auxiliary discipline, but  a fundamental basis  for modern ECDSA cryptanalysis, especially in the context of nonce generation flaws.

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

  1. Developing probabilistic models of nonce leakage.  The problem set considers classical distributions (normal, Poisson, binomial). In real-world ECDSA implementations, leakage can have a complex structure (e.g., dependence on time or energy consumption). Constructing  martingale leakage models  will allow for more accurate estimation of the residual nonce entropy.
  2. Applying Markov chains to nonce generators.  Deterministic generators (RFC 6979) produce sequences ki, which can be modeled as a Markov chain with a known transition probability matrix. Analysis of ergodicity and the rate of convergence to a stationary distribution will help identify hidden biases.
  3. Bayesian methods for private key estimation.  Using Bayes’ formula (Section II) to construct a posterior distribution d taking into account a priori knowledge about the distribution kThis will allow us to move from point estimates to interval estimates and increase the reliability of cryptanalysis.
  4. Limit theorems for estimating the number of signatures.  Exact estimates of the required number of signatures. ℓ to achieve a given probability of success under various types of bias. Application of the central limit theorem and concentration inequalities (Chernoff, Hoeffding) to obtain asymptotically tight bounds.
  5. Analysis of random processes in side-channel attacks.  Modeling time series of energy consumption or electromagnetic radiation as random processes (Section IX). This will allow us to develop optimal filters for extracting nonce information from noisy measurements.
  6. Cryptanalysis Based on Information Theory.  Although the book does not cover information theory directly, the sections on characteristic functions and moments are closely related to entropy and mutual information. Estimating the amount of information about d, contained in the signatures, will allow us to determine the theoretical limits of attacks.
  7. Automated detection of vulnerable transactions in the blockchain.  Developing algorithms that scan the blockchain in real time, apply probabilistic tests for nonce bias, and automatically launch appropriate attacks. This requires efficient implementation of statistical criteria and lattice reduction methods.

This document is based on an analysis of the problem book by D. A. Korshunov and S. G. Foss (1997) and modern works on ECDSA cryptanalysis. All formulas and statements are provided for educational purposes.