-
Notifications
You must be signed in to change notification settings - Fork 36
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
known_bits and kp #21
Comments
The use case of LatticeAttack is to compute the private key from a set of EC digital signatures, knowing some part of the internal signature nonce (ephemeral "k").
As soon as you get a set of signature (for a given public key), and with their corresponding ephemeral random internal secret ECDSA number partial info (MSB or LSB), you can use lattice-attack to recover the private key. In practice. You input the "partial k info" as follow : Example if the LSB known for "k" are 0b00101 for a given signature: About the hash : About the public key I don't fully understand what is Z, how it relates to the known nonce. I bet this is related to Z being a cube root or similar, so you can figure out some information about "k". Anyway, you need to figure that out yourself and proceed to compute the recovered information in term of the ECDSA nonce. Then you can use this software. Else, if you know nothing about the internal nonce, LatticeAttack might not be the right tool. For further details, you can look at the this file source, it can help into decoding into the target input. Because this file generates dummy data for an example, so it does the work to convert into the LatticeAttack expected format. As always, we can provide further help on all this matter. This is out of scope of the free support on how to use it, fixing bug, installation support, etc... You can reach us at [email protected], and we'll provide a quotation and a schedule for the work. |
In case your Z is the full secret nonce, the Lattice ECDSA Attack software is not designed for that. In this case, all you have to do is to compute d = ( s.Z - H ) . r^-1 where (r,s) is the signature duet, Z the secret nonce, H the hash, and you get the private key (d). See more details here. This software is designed to recover the private key from a hundred of signatures when only a part of the nonce is known (first bits, or last bits) for each signature. |
@bitlogik how you retrieved H(m) from transaction? Tnx PS what does it mean xyz “ "hash": xyz”, mult pubX,PubY and Z? |
Usually, from a blockchain transaction, the hash H(m) is recomputed from the transaction message. The data signed is built from the transaction data, then hashed to get the hash value of the transaction. Sometimes also the tx hash is directly the H (in case the tx hash doesn't include the signature).
No, in our example { "hash": xyz, "r": xxx, "s": xxx, "kp": 5 }, "xyz" is just a single integer value, like xxx. Nothing related with Z nor Y. |
Thank you for your answer! Ok just for education purpose, you know that in standart settings we need about 80 sigs for find PVK, as example, for received correct kp of 80 sigs (ex. 'kp':2) we need around 1500 tx, in this 1500 tx we guarantee received 80 sigs of any kp for 4 bits, if i gen_data 1500 sigs and changed in json file all kp to 2 ('kp':2), lattice attack didnt work. can you explain why? if you know, it interesting for me. Thank you! |
kp is the known leaked part of the internal ephemeral nonce during ECDSA. As this is supposed to be an internal secret, it can be read using a side channel. As it is a protected secret, sometimes we don't get it fully, but only a part, the starting bits, or the last bits. That's the exact purpose of LatticeAttack. If you know the nonce in full, you don't need LatticeAttack, as a simple computation using one signature leads to the private key. But if you only know start (or end) of the nonce for a couple of signatures, then LatticeAttack can provide the secret key. kp represents the known value of the leaked bits of the internal secret nonce for a given signature. kp means "k partial". In case you get MSB (bits at the beginning), kp shall be provided reduced like LSB, means only the known bits : If the known bits are all 0 : "kp":0, because the known value is 0. Now I think you understand why changing this value doesn't' work. You need the real value of the known part. Note : "hash" needs to be provided as integer in the signatures data when there's no "message" key. That means each signature has its own hash. Alternatively, if the exact same message was signed multiple times (all message/hash are same), then "message" can be provided once at the info top level, and the hash will be computed.
How does it work usually? Lets say you only get 4 bits of nonce k, and pvkey being 256 bits. The number of signatures required is roughly the number of bits "summed" up to 256 bits = 256/4. But there are margin, like 4/3 theoretical, and LatticeAttack even adds 3% as a margin. You need apprx 4/3 * 256/4 * 1,03 = 88 signatures (for each you know partial k, 4 bits). On top of that, usually, when listening to a side channel, we only detect when all the bits are 0 (or any particular value, among all the possible values). 0b0000 is 1 value over 16 different (2^4), so for every signature, you have 1 over 16 chances to get the value you can detect. And you need 88 signatures with a known value (kp). It is like 15 times over 16 you cant read the kp value. At the end it means you need to perform 88*16 = 1376 signatures "statistically" to get the minimum number of data to perform a recovery. So yes, if your system you can detect only 4 bits, when 0000, so 1 over 16 signatures can extract the leading bits. You need something like 1500 signatures, then it provides approx 90 signatures with valid data (known k, kp), and this amount will lead to a private key finding. In this example kp=0, in case you can only detect kp equals to 0 (all bits are 0). |
Hello!
I cannot understand how to fill data.json with my parameters.
First of all I can't understand how can I find known_type, known_bits and kp?
And hash in data.json is transaction hash or z?
PubKey: 0445952f99b777cbd57a9d03eb5196dd97622668f5bb6f4190d882a6a3987b0a4474109a96cd8949056267f928994d2c36a4f239d2e0b54e87667a37fe19244020
Transaction info:
hash: 08d917f0fee48b0d765006fa52d62dd3d704563200f2817046973e3bf6d11f1f
So, can you please clarify me how to fill data.json with parameters I have?
The text was updated successfully, but these errors were encountered: