Lattice Attack
Lattice Attack
Lattice Attack
1 Introduction
The security of the ECDSA signature algorithm relies crucially on the proper
generation of a per-signature nonce value that is used as an ephemeral private
key. It is well known that if an ECDSA private key is ever used to sign two
messages with the same signature nonce, the long-term private key is trivial to
compute.[18,7,37,13,11,8]
Repeated nonce values are not the only type of bias that can render an ECDSA
key insecure, however. In fact, any nonuniformity in the ECDSA signature nonces
can reveal the private key, given sufficiently many signatures. In this paper, we
carry out lattice-based cryptanalytic attacks against ECDSA signatures collected
from the Bitcoin, Ethereum, and Ripple blockchains as well as Internet-wide
scans of HTTPS and SSH hosts, and efficiently compute hundreds of Bitcoin
private keys and a handful of Ethereum and SSH private keys. As a side effect,
we also find numerous Bitcoin, Ethereum, Ripple, SSH, and HTTPS private keys
that were compromised through repeated signature nonces.
The lattice attacks we apply are based on algorithms for solving the hidden
number problem. [6] While the hidden number problem is a popular tool in
the cryptanalytic literature for recovering private keys based on side channel
attacks [5,14], to our knowledge we are the first to apply these techniques to
already-generated keys in the wild, and the first to observe that these techniques
may apply to signatures in cryptocurrencies. In total, we computed around 300
Bitcoin keys with these techniques. As of this writing, 818,975 satoshis, or around
2 Joachim Breitner and Nadia Heninger
$54, and 30.40 XRP, or about $14, remain in Bitcoin and Ripple accounts whose
keys we were able to compute, suggesting that these flaws do not yet appear to
be known, or else the funds would have already been stolen.
The attacks we use are significantly faster than naive brute force or the
state of the art algorithms for the elliptic curve discrete log problem. Using a
square root-time algorithm like Pollard rho [28], one could feasibly carry out
a targeted attack against a small number of the 64-bit or 128-bit nonces we
discovered; carrying out this attack against all of the approximately 230 signatures
in the Bitcoin blockchain would have required significantly more computational
resources than we have access to. In contrast, we spent around 40 CPU-years
total on our computations, implemented in Python, for all of the blockchains.
The nonce vulnerabilities fall into several classes that suggest that we have
found several independent implementation vulnerabilities. We first use the hidden
number problem algorithm to discover the long-term ECDSA signature key when
used with nonces that are shorter than expected, and found keys used with nonces
with lengths 64 bits, 110 bits, 128 bits, and 160 bits. We extend this technique
to discover nonces with shared prefixes and suffixes, and found keys used with
signature nonces that shared prefixes and varied in their 64 least significant bits,
as well as keys used with signature nonces that shared suffixes and varied in their
128 and 224 most significant bits.
Ethics. We are unable to validate the existence of these vulnerabilities without
actually computing the private keys for vulnerable addresses. In the case of
cryptocurrencies, these keys give us, or any other attacker, the ability to claim
the funds in the associated accounts. In the case of SSH or HTTPS, these keys
would give us, or any other attacker, the ability to impersonate the end hosts.
We did not do so, and in the course of our research we did not carry out any
cryptocurrency transactions or active attacks ourselves; our research is entirely
passive, and requires only observation of transactions or general-purpose network
measurements. However, given that we find evidence that other attackers are
already emptying the accounts of cryptocurrency users whose keys are revealed
through known vulnerabilities (both repeated nonces and private keys posted
online), we anticipate that users will be affected once knowledge of this flaw
becomes public. We have attempted to disclose flaws to the small number of
parties we were able to identify, but in most cases we were unable to identify any
particular vendors, maintainers, or users to responsibly disclose to.
Countermeasures. All of the attacks we discuss in this paper can be pre-
vented by using deterministic ECDSA nonce generation [29], which is already
implemented in the default Bitcoin and Ethereum libraries.
2 Related Work
The Hidden Number Problem and ECDSA. The Hidden Number Problem and
the lattice-based algorithm we used to solve it were formulated by Boneh and
Venkatesan, who used it to prove the hardness of computing most significant
bits for Diffie-Hellman [6]. Howgrave-Graham and Smart [19] and Nguyen and
Biased Nonce Sense 3
Shparlinski [26] applied the hidden number problem to show that the DSA
and ECDSA signature schemes are insecure if an attacker can learn some most
significant bits of the signature nonces. Since then, this technique has been
applied in practice in the context of side-channel attacks [5,14].
Repeated DSA/ECDSA signature nonces. A number of works have examined
vulnerabilities in DSA and ECDSA due to repeated signature nonces in the
wild. Heninger, Durumeric, Wustrow, and Halderman [18] compromised SSH
host keys for 1% of SSH hosts in 2012 by searching for repeated DSA signature
nonces from SSH handshakes. They traced the problems primarily back to
implementation vulnerabilities in random number generation on low-resource
devices. Bos, Halderman, Heninger, Moore, Naehrig, and Wustrow [7] documented
repeated nonces in the Bitcoin blockchain in 2013, as part of a broader study
of elliptic curve cryptography use. Valsorda studied repeated Bitcoin nonces in
2014 [37]. Courtois, Emirdag, and Valsorda [13] studied repeated Bitcoin nonces
in 2014 and noted that it would be possible to chain compromises across keys.
Castellucci and Valsorda studied repeated nonces and variants of weak keys and
nonces repeated across keys in Bitcoin in 2016 [11]. Brengel and Rosow examined
repeated nonces within signatures from the same key and chained compromised
nonces across signatures from different keys in the Bitcoin blockchain in 2018 [8].
Key generation issues in cryptocurrencies. In 2013, a major bug in Android
SecureRandom was blamed for the theft of Bitcoin from many users of Android
wallets, due to the faulty random number generators generating repeated ECDSA
signature nonces [20,22]. In 2015, the Blockchain.info Android application was
discovered to be generating duplicate private keys because the application was
seeding from random.org, which had started serving a 403 Redirect to their https
URL several months prior [35].
Cryptocurrency cryptanalysis. The Large Bitcoin Collider is a project that is
searching for Bitcoin private keys using an apparently linear brute force search
algorithm [30] that has searched up to a 54 bit key space. For public keys that
are already revealed, it would be more efficient to use square root discrete log
algorithms [28,34] to recover short private keys of this type, but we are unaware
of any dedicated efforts in this direction.
The public domain parameters for an elliptic curve digital signature include an
elliptic curve E over a finite field and a base point G of order n on E. The private
signing key is an integer d modulo n, and the public signature verification key is
a point Q = dG. Elliptic curve public keys can be represented in uncompressed
form by providing both the x and y coordinates of the public point Q, or in
compressed form by providing the x coordinate only and a single parity bit from
the y value. [9]
To sign a message hash h, the signer chooses a per-message random integer
k modulo n, computes the point kG, and then computes the values (xr , yr ) =
kG mod n, and outputs r = xr and s = k −1 (h + dr) mod n. The signature is the
4 Joachim Breitner and Nadia Heninger
pair (r, s). To verify a message hash using a public key Q, the verifier computes
(x0r , yr0 ) = hs−1 G + rs−1 Q and verifies that x0r ≡ r mod n. If the bit length ` of
the curve is shorter than the bit length of the hash function used to compute h,
h is truncated to its ` most significant bits prior to the calculation. [25]
Bitcoin [23], Ethereum [10], and Ripple [33] all use the elliptic curve secp256k1 [9].
A Bitcoin address is derived from a public key by repeatedly hashing the un-
compressed or compressed ECDSA public key with SHA-256 and RIPEMD-160.
An Ethereum address is the last 20 bytes of the Keccak-256 hash of the un-
compressed ECDSA public key, where Keccak-256 is an early version of the
SHA-3 standard. Ethereum public keys are not explicitly included along with the
signature; instead, the signature includes an additional byte v that allows the
public key to be derived from the signature. A Ripple address is derived from a
compressed public key by repeatedly hashing with SHA-256 and RIPEMD-160,
and concatenating portions of the hashes. For the purposes of the analysis in our
paper, in all of these cryptocurrencies the ECDSA public key is only revealed
after an address has been used to sign a transaction. Bitcoin and Ripple explicitly
reveal the ECDSA public key in uncompressed or compressed format along with
a signature; in Ethereum, clients must derive the public key from the signature
itself using key recovery.
ECDSA signatures are used to authenticate the sending party of a transaction.
Addresses can be single signature, corresponding to a single public key, or
multisignature addresses, which require valid signatures from k out of a set of
n public keys in order to spend money from a transaction. Users are typically
recommended to use a fresh new address for every transaction [2].
Signature normalization. ECDSA signatures have the property that both the
signatures (r, s) and (r, −s) will validate with the same public key. In October
2015, Bitcoin introduced a change in the signing procedure to use the smaller of
s and −s mod n in a signature in order to make signatures unique.3 Ethereum
and Ripple also do this type of signature normalization, which affects our attack.
ECDSA signatures can also be used in other network protocols. In TLS, every
certificate is signed either by a certificate authority or is self-signed. Most of
these signatures remain RSA signatures in practice. However, when ephemeral
Diffie-Hellman key exchange is chosen as part of the cipher suite in TLS 1.2 and
below, the server signs its portion of the the key exchange, and the client uses
the public key in the certificate to validate this signature [16]. In SSH, every
host has a host key that it uses to sign the entire handshake between client and
server [38]. The client authenticates the server by verifying the signature with
the host public key.
3
https://github.com/bitcoin-core/secp256k1/commit/0c6ab2ff
Biased Nonce Sense 5
x1 − t1 y + a1 ≡ 0 mod p
.. (1)
.
xm − tm y + am ≡ 0 mod p
There are two techniques used to solve this problem in the literature. The
first uses lattice-based techniques [6,19,26] to solve this system in the case of
larger biases and fewer samples (up to around
100 in practice, with B several bits smaller p
than p), and the second uses Fourier anal- p
ysis [3,15] and is more suitable with many . ..
M = (2)
samples (at least 232 ) and very small bias. In p
this paper, we focus on the former technique,
t1 t2 . . . tm B/p
which is better suited to the limited number
a1 a2 . . . am B
of signatures we encounter in the wild.
To solve the hidden number problem us-
ing lattices, consider the lattice generated by the rows of matrix M in Equation (2).
The m × m upper left quadrant is a slightly rescaled version of the lattice given by
Boneh and Venkatesan, who suggest using a CVP algorithm to find a vector that
6 Joachim Breitner and Nadia Heninger
is close to the target, which is the (m + 1)st row in our lattice basis. The most
efficient implementations of lattice algorithms are SVP approximation algorithms,
so we follow [5] in embedding this lattice basis into a slightly larger one and using
an SVP approximation algorithm instead.
The vector vb = (b1 , b2 , . . . , bm , Bα/p, B) is a short
√ vector generated by
the rows of Equation (2), and by construction |vb | < m + 2B. When |vb | ≤
det L1/ dim L , we hope to recover vb among the short vectors of a reduced basis for
the lattice generated by M . We have det M = B 2 pm−1 and dim M = m + 2. The
LLL [21] or BKZ [31,32] lattice basis reduction algorithms can be used to find
short vectors in this lattice. In practice on random lattices, the LLL algorithm
will find a vector satisfying |v| ≤ 1.02dim L (det L)1/ dim L in polynomial time [27].
The performance of BKZ depends on the block size, and will in time exponential
in the block size β find vectors |v| ≤ (1 + )dim β
L
(det L)1/ dim L where β depends
on the block size, but β = 0.01 is achievable in practice [12].
In this paper, we focus on relatively small dimension lattices, so that the
approximation factor of LLL or BKZ is largely insignificant. In this case, we
expect to solve the problem when log B ≤ blog p(m − 1)/m − (log m)/2c.
4.2 Optimizations.
There are two further optimizations that should be applied to this attack. The
first is that in the case of most significant bits known, the value bi is always
positive, and thus one can increase the bias by recentering the bi by writing
each equation as x0i − ti y + am + B ≡ 0 mod p which has a solution x0i = bi − B.
The second improvement is to decrease the dimension of the lattice by one by
eliminating the variable y from Equations (1) so that one has m − 1 equations in
m unknowns, all bounded.
We are also interested in the case where the bi share an identical prefix, or in
other words, that they share most significant bits when viewed as an integer
between 0 and p, but we do not know this prefix. That is, the input to the
problem is samples {ti , ai }m
i=1 satisfying bi + c + ai ≡ ti α mod p, with |bi | < B
and 0 ≤ c < p is unknown. We can reduce this problem to the previous problem
with m − 1 samples by using one of the samples to eliminate the unknown c.
m−1
That is, we solve the hidden number problem with input {t0i = ti − tm ]}i=1 ,
a0i = ai − am , and the desired solutions b0i = bi − bm satisfy |b0i | ≤ 2B.
The technique described in Section 4.3 can also be adapted to solve for bi that
share an identical suffix, that is, that they share least significant bits when viewed
as an integer between 0 and p. More precisely, the input to our problem in this
case is samples {ti , ai }m `
i=1 satisfying 2 bi + c + ai ≡ ti α mod p, with 0 ≤ bi < B,
Biased Nonce Sense 7
To attack ECDSA with biased k values using the hidden number problem [19,26],
note that each signature (ri , si ) on hi satisfies
ki − s−1 −1
i ri d − si hi ≡ 0 mod n (3)
If the ki are all small (|ki | < B) or share a common prefix or suffix, then this is
precisely our setting for the hidden number problem variants we describe above,
with ki = bi , α = d, p = n, and si , ri , and hi public per signature.
We construct the input to our problem by hypothesizing that a set of signatures
contains one of the vulnerabilities necessary to carry out the attacks described in
Sections 4.1, 4.3, or 4.4, construct the corresponding lattice, and apply a lattice
basis reduction algorithm. For each candidate solution for ki , we compute the
value dki = (si ki − hi )ri−1 mod n, and compare dki G to the public key or address.
Experimentally, we found that for a 256-bit n, our case of interest for
secp256k1, we were able to recover the private key from two signatures with 128-
bit nonces by reducing a 3-dimensional lattice with 75% probability, from three
signatures with 170-bit nonces with a 4-dimensional lattice with 95% probability,
from 4 samples with 190-bit nonces with 100% probability; from 20 samples with
242-bit nonces by reducing a 21-dimensional lattice with 100% probability, and
from 40 samples with 248-bit nonces and 41-dimensional lattices.
One can keep continuing by increasing the dimension of the lattice, to a
practical limit of a bias of three or four bits for this 256-bit curve order, at the
cost of solving near-exact SVP, which runs in time exponential in the lattice
dimension, in a high-dimensional lattice.
Unfortunately for the attacker applying these attacks to cryptocurrency
signatures, the signature normalization described in Section 3.1 adds complexity.
We expect half of the signatures to contain a negated s value, but we will not be
able to tell which. From Equation (3), negating s will negate the derived value
of ki . Thus an attack on small ki would still be expected to succeed, since the
lattice algorithm can recover both small positive or small negative values, but
the normalizations required to solve for the case of shared prefixes in Section 4.3
or shared suffixes in Section 4.4 would produce outputs that do not have the
desired properties. For these cases, we brute forced signs for the si .
The signature normalization also means that the relations defining ECDSA
private key recovery from known or repeated nonces as described in Section 3.3
may not hold as described. For these cases we also brute forced sign values for s.
8 Joachim Breitner and Nadia Heninger
5 Bitcoin
5.1 Collecting data
To collect Bitcoin signatures we modified the official client to output hash values
and signatures as they are verified, and re-validated the entire blockchain.
We used a snapshot of the blockchain from September 13, 2018 (block height
541,244). At this point, the blockchain contained 975,560,082 signatures from
446,605,479 distinct keys. 40,497,752 of these keys had been used to generate
more than one signature. 569,396,463, or 58% of the signatures in our snapshot
had been generated by one of these keys.
snapshot of the blockchain from March 2018 and once with normalization in
September 2018. For the low-dimensional lattice attacks, the bottleneck of the
computation was the elliptic curve multiplications required to check whether we
had found the correct private key. The total running time for both jobs was 38
CPU years, and the longest-running job (corresponding to a single key that had
generated 1,021,572 signatures in March 2018) completed in 30 calendar days.
Biased nonces. After running our attacks, we had computed the private keys
for 302 distinct keys that were compromised via small nonces, nonces with
shared prefixes, or nonces with shared suffixes. These keys had generated 6,026
signatures with these vulnerable nonces in the blockchain, and 7,328 signatures
overall, including signatures that we did not classify as using vulnerable nonces.
For further analysis, we used the BlockSci library [4]. We classified keys by
the signature nonce vulnerability that had compromised them and summarize
the data in Table 1. Nearly all of the compromised keys had been used as part
of multisignature addresses of type 1-out-of-1, 1-out-of-2, 1-out-of-3, 2-out-of-2,
2-out-of-3, 2-out-of-5, or 3-out-of-5.
On September 23, 2018, a total of 745,990 satoshis were in non-multisignature
addresses whose keys were compromised by these biased nonces. An additional
72,985 satoshis were in a multisignature address where we possessed all of the
necessary keys for the account. A further 6,480,000 satoshis were present in
addresses for which we possessed one out of two necessary signatures.
We plot the signatures from biased nonces over time in Figure 1. Nearly all
of the compromised nonces fell into a few clear classes based on the length of the
variable portion of the nonce. We found short nonces of length 160 bits, 128 bits,
110 bits, 64 bits, and a few sporadic nonces below 32 bits. We also found nonces
that shared a fixed prefix followed by a variable 64-bit suffix, and nonces that
varied in the 128 most significant bits and shared a fixed 128-bit suffix. Most of
the affected keys were part of multisignature addresses.
Table 1. Biased signatures and keys. We classified the compromised keys and
signatures by the type of nonce vulnerability that had compromised the private key.
Nearly all of the compromised keys had been used as part of multisignature addresses.
prefix+64
128+suffix∗
128+suffix
160
Nonce type
128∗
110
64∗
64
32
2014 2015 2016 2017 2018
Fig. 1. Bitcoin signatures with small and biased nonces over time. We plot
signatures with biased nonces over time, grouped by the class of bias we observed, and
whether they are used with multisignature addresses (marked with ∗ ). Larger circles
correspond to more signatures on a given date. We note that the different types of
biases appear at different date ranges, suggesting that these vulnerabilities are specific
to distinct implementations.
64-bit nonces. We found 5,863 signatures from 280 distinct keys that used 64-bit
nonces. All but one of these keys was used as part of multisignature addresses.
All of these signatures appeared between July 26, 2014 and June 1, 2015.
Two accounts related to these keys have a non-zero balance: One 2-out-of-2
address, for which we have one private key, has a single satoshi. One 2-out-of-3
address, for which we have two private keys, has a balance of 72,985 satoshis.
Since nearly all of these keys are part of multisignature addresses, we hypoth-
esize that this may be a faulty implementation intended for multifactor security,
such as a hardware token.
64-bit nonces and single-signature keys. Our lattice attack only applies when at
least two signatures with a small nonce are created using the same secret key.
A single 64-bit nonce requires only 232 time to break using Shanks’s baby-step-
giant-step algorithm [34] or the Pollard rho algorithm [28], feasible with only
modest computation resources. Applying this attack to all of the 230 Bitcoin
signatures was beyond our resources, but we investigated a random sample.
The bottleneck is the random accesses into the precomputed lookup tables,
so we chose the parameters so that they fit into the RAM of our largest-memory
machine (2.2TB). A single core can check a single signature in ≈ 7 minutes.4
We spent 15 calendar days of computation time, or 17,000 core-hours, to
check a random sample of 144,000 Bitcoin signatures and found one nonce that
had already been computed via the lattice attacks and no previously unknown
small nonces. We conclude that the lattice attack appears to have found most of
the vulnerable signatures.
4
The code can be found at:https://github.com/nomeata/secp265k1-lookup-table.
Biased Nonce Sense 11
110-, 128-, and 160-bit nonces. We found a few sporadic signatures that used
larger nonce lengths that were broken by our lattice techniques. These may
be individual programming errors, but do not appear to be part of common
implementations. None of the affected accounts had a non-zero balance.
– Three 160-bit nonces, all of which were used with the same key, all on the
same date in September 2017. This key did not produce any more signatures
in our data. We hypothesized that a 160-bit nonce length might be explained
by a user generating a nonce using a hash function with 160-bit output, as
in deterministic ECDSA, but were unable to verify this.
– Four 128-bit nonces from two keys. Each key generated two signatures with
128-bit nonces on the same two days in March 2016, and no further signatures.
– One signed 110-bit nonce, used with one key in January 2017, which had
also generated a normal-looking 256-bit nonce on the same day.
256-bit nonces with shared 128-bit suffixes. 121 signatures were compromised by
nonces that shared a 128-bit suffix with at least one other signature. 55 of these
signatures were used with multisignature addresses and 66 were generated by
non-multisignature addresses. 13 keys were compromised this way, which had
generated a total of 224 signatures. There were 20 distinct suffixes that had been
used by these keys. The earliest signature of this type that we found was from
March 2015, and the most recent was from August 2018. Some of the keys were
used with nonces that all shared the same suffix, and some were used with nonces
of varying and occasionally unique suffixes.
We found that a number of the addresses associated with these compromised
signatures had been posted on the web along with their private keys for a variety
of reasons: they corresponded to small integer private keys, private keys derived
from easy-to-guess passwords such as “satoshi”, or private keys used as examples
in documentation. All of the affected accounts had a zero balance.
Interestingly, in 54 of the signatures, the 128-bit nonce suffix is identical
to the 128 most significant bits of the private key. The vulnerable transactions
emptied the relevant accounts. We hypothesize that the vulnerable nonce suffixes
we observe may actually be due to a custom implementation used by an attacker
who is emptying accounts from Bitcoin addresses that were already compromised
online. The overlapping bits between the nonce and the private key might be an
artifact from a bug in a program written in a memory-unsafe language like C.
256-bit nonces with shared 192-bit prefixes. We computed 2 keys that had
been used with 27 signatures with nonces sharing prefixes. Each key had some
signatures with the shared prefix and some without. One of the two keys has a
balance of 495,990 satoshis, and seems to be in current use at the time of writing.
(n − 1)/2
other repeat∗
other repeat
2011 2012 2013 2014 2015 2016 2017 2018
Fig. 2. Bitcoin signatures with repeated nonces over time. We plot repeated
signature nonces over time, separating the value (n−1)/2, which seems to have been used
intentionally, from other repeated nonces. Larger circles correspond to more signatures
on a given date. Signatures involving multisignature addresses are marked with ∗ . The
vertical bars mark when the development (left) and release (right) versions of the official
bitcoin client began to create nonces deterministically [29].
As noted by [8], this is (n − 1)/2 where n is the order of the secp256k1 curve.
The x-coordinate of G · (n − 1)/2 is 166 bits long, where one would expect a
random point to have 256 bits. It appears to not be known why secp256k1 has
this property; Gregory Maxwell [1] notes that secp224k1 shares the same 166-bit
string doubled to produce the generator, and speculates that this value is the
output of SHA-1. According to [1], this value is used to sweep “dust” transactions.
We note that even for a “final” transaction for a given key, an attacker
could observe a proposed transaction, derive the secret key, and race the original
transaction. This is not a concern if the key has already been compromised,
however. Some of the transactions using k = (n − 1)/2 are withdrawing money
from addresses derived from easily guessable brainwallet passwords.
There were no funds left in any of the addresses with repeated nonces at
the time that we examined the results. Since this failure mode of ECDSA is
well known, it appears that multiple entities regularly scan the blockchain for
repeated nonces and remove any funds from vulnerable keys. However, there were
two multisignature addresses with nonzero account balances for which repeated
nonces revealed one of the necessary addresses:
Table 2. Repeated signature nonces. Nearly all of the repeated signature nonces
on the Bitcoin blockchain have the value (n − 1)/2. These represented the majority of
keys compromised through repeated nonces.
told us that signatures from these addresses had been calculated manually,
suggesting that the random number generator may not have been seeded.
– One 2-out-of-3 address had a balance of 179,400 satoshis.
Other small nonces. We brute forced all 32-bit nonce values, and found 275
signatures from 52 keys. The small number and the observed nonces (1, 2, 9,
100, 1337, 13337, 133337, 1333337, 12345678, and 2147491839) do not point to a
flawed implementation, but rather hand-crafted transactions and signatures.
6 Ethereum
256-bit nonce with 192-bit prefix. One key was compromised via biased nonces.
It had generated seven signatures in our dataset, of which five nonces shared the
same nonzero, random-looking 192-bit prefix and differed only in the last 64 bits
of the nonce. The remaining two signatures that had been generated by this key
look random, and do not share this prefix. The key holds 0.00002 Ether.
Repeated nonces. Three keys were compromised from repeated nonces, with
185 signatures between them. The repeated nonces include four occurrences
of the nonce 1, two occurrences of a seemingly random 256-bit nonce, and
123456789abcdef. No funds are held by these keys.
14 Joachim Breitner and Nadia Heninger
7 Ripple
Results and analysis. We found one private key that had been compromised
by a repeated signature nonce. This key had generated 21 signatures. It holds
30.40 XRP (approx. 14 USD) and 1.81 CNY. We deduce that attackers have not
yet begun to systematically observe the Ripple blockchain for repeated nonces.
8 SSH
256-bit keys with 32-bit shared suffixes. Three private keys produced signatures
whose nonces all shared the suffix f27871c6. The hosts have gone offline since,
and we were unable to identify the implementation. This suffix is one of the
“constant words” used in the calculation of a SHA-2 hash [24], with swapped byte
order. We can can speculate that the server is using SHA-2 to generate the nonce,
but has a bug in the implementation.
Biased Nonce Sense 15
224-bit keys with 160-bit nonces. One further key was compromised due to the
use of small nonces. All 23 signatures by this key used a 160 bit nonce with
a 2048-bit DSA public key with a 224-bit subgroup, and were observed at the
same IP address. We speculate that this may be due to the use of a 160-bit hash
function like SHA-1 or MD5 being used to generate the nonce in a 224-bit group.
9 HTTPS
Collecting data. We gathered ECDSA signatures from weekly Internet-wide
scans of HTTPS on port 443 performed by Censys [17] between April 3, 2018
and September 6, 2018. The number of ECDSA signatures per scan increased
from 1.5 million to 1.9 million, resulting in 50,313,795 total ECDSA signatures
from 182,843 distinct keys on 3,333,482 distinct IP address. 50,096,848 signatures
were from NIST P-256, 212,523 were from NIST P-384, 4,400 were from NIST
P-521, and 24 were from NIST P-224.
Results and analysis. We did not find any small or biased signature nonces.
We found three different sources of signatures with repeated nonces, which we
hypothesize are due to flawed random number generators. These resulted in 462
vulnerable signatures that had been generated by 7 distinct private keys on 97
distinct IP addresses.
10 Acknowledgements
We thank Luke Valenta and Zakir Durumeric for help in updating ZGrab and
Censys to collect HTTPS and SSH signature hashes, and Tanja Lange for the
reference on the surprisingly small binary representation of k = 1/2 in secp256k1.
Much of the work for this paper was done while the authors were at the University
of Pennsylvania. This work was supported by the National Science Foundation
under grants no. CNS-1651344 and CNS-1513671. We are grateful to Cisco for
donating much of the computing cluster used to carry out our computations.
16 Joachim Breitner and Nadia Heninger
References
16. Dierks, T., Rescorla, E.: The Transport Layer Security (TLS) protocol. IETF RFC
RFC5246 (2008)
17. Durumeric, Z., Adrian, D., Mirian, A., Bailey, M., Halderman, J.A.: A search engine
backed by Internet-wide scanning. In: 22nd ACM Conference on Computer and
Communications Security (Oct 2015)
18. Heninger, N., Durumeric, Z., Wustrow, E., Halderman, J.A.: Mining your Ps and
Qs: Detection of widespread weak keys in network devices. In: Proceedings of the
21st USENIX Security Symposium (Aug 2012)
19. Howgrave-Graham, N.A., Smart, N.P.: Lattice attacks on digital signature
schemes. Designs, Codes and Cryptography 23(3), 283–290 (Aug 2001).
https://doi.org/10.1023/A:1011214926272, https://doi.org/10.1023/A:1011214926272
20. Klyubin, A.: Some SecureRandom thoughts. https://android-developers.googleblog.
com/2013/08/some-securerandom-thoughts.html (August 2013)
21. Lenstra, A.K., Lenstra, H.W., Lovasz, L.: Factoring polynomials with rational
coefficients. MATH. ANN 261, 515–534 (1982)
22. Michaelis, K., Meyer, C., Schwenk, J.: Randomly Failed! The State of Randomness
in Current Java Implementations. In: CT-RSA. vol. 7779, pp. 129–144. Springer
(2013)
23. Nakamoto, S.: Bitcoin: A peer-to-peer electronic cash system. http://bitcoin.org/
bitcoin.pdf (2009)
24. National Institute of Standards and Technology: FIPS PUB 180-2: Secure Hash
Standard (Aug 2002)
25. National Institute of Standards and Technology: FIPS PUB 186-4: Digital Signature
Standard (DSS) (Jul 2013)
26. Nguyen, P.Q., Shparlinski, I.E.: The insecurity of the elliptic curve digital signature
algorithm with partially known nonces. Designs, Codes and Cryptography 30(2),
201–217 (Sep 2003). https://doi.org/10.1023/A:1025436905711, https://doi.org/10.
1023/A:1025436905711
27. Nguyen, P.Q., Stehlé, D.: LLL on the average. In: Hess, F., Pauli, S., Pohst, M.
(eds.) Algorithmic Number Theory. pp. 238–256. Springer Berlin Heidelberg, Berlin,
Heidelberg (2006)
28. Pollard, J.M.: Monte Carlo methods for index computation (mod p). In: Mathe-
matics of Computation. vol. 32 (1978)
29. Pornin, T.: Deterministic usage of the digital signature algorithm (DSA) and elliptic
curve digital signature algorithm (ECDSA). https://tools.ietf.org/html/rfc6979 (2013)
30. rico666: Large bitcoin collider. https://lbc.cryptoguru.org/
31. Schnorr, C.P.: A hierarchy of polynomial time lattice basis reduction algorithms.
Theor. Comput. Sci. 53(2-3), 201–224 (Aug 1987). https://doi.org/10.1016/0304-
3975(87)90064-8, http://dx.doi.org/10.1016/0304-3975(87)90064-8
32. Schnorr, C.P., Euchner, M.: Lattice basis reduction: Improved practical algorithms
and solving subset sum problems. Math. Program. 66(2), 181–199 (Sep 1994).
https://doi.org/10.1007/BF01581144, http://dx.doi.org/10.1007/BF01581144
33. Schwartz, D., Youngs, N., Britto, A.: The Ripple protocol consensus algorithm.
https://ripple.com/files/ripple consensus whitepaper.pdf (2014), https://ripple.com/
files/ripple consensus whitepaper.pdf, accessed: 2016-08-08
34. Shanks, D.: Class number, a theory of factorization, and genera. In: Proc. of Symp.
Math. Soc., 1971. vol. 20, pp. 41–440 (1971)
35. Team, B.: Android wallet security update. https://blog.blockchain.com/2015/05/28/
android-wallet-security-update/
36. The Sage Developers: SageMath, the Sage Mathematics Software System (Version
8.1) (2017), http://www.sagemath.org
18 Joachim Breitner and Nadia Heninger
37. Valsorda, F.: Exploiting ECDSA failures in the bitcoin blockchain. Hack In The
Box (HITB) (2014)
38. Ylonen, T., Lonvick, C.: The Secure Shell (SSH) transport layer protocol. IETF
RFC 4253 (2006)