GithubHelp home page GithubHelp logo

qq431169079 / ecdsapredictablenonce Goto Github PK

View Code? Open in Web Editor NEW

This project forked from jonasnick/ecdsapredictablenonce

0.0 1.0 0.0 571 KB

Ethereum Bug Bounty Submission: Breaking ecdsa that uses `privKey xor message` as nonce.

Makefile 0.94% TeX 21.12% Go 77.94%

ecdsapredictablenonce's Introduction

Ethereum Bug Bounty Submission: Predictable ECDSA Nonce

Breaks an ecdsa implementation that uses privKey xor message as nonce. Recovering the full private key requires 256 signatures. In other words, every signature leaks 1 bit. A detailed explanation of the attack can be found in the explanation.pdf.

main.go is the implementation of an attack specifically against a vulnerable version of github.com/obscuren/secp256k1-go and thus also against go-ethereum . It takes roughly 11 minutes for my 3.0Ghz processor to solve the system. The obvious fix is to use the operating system's PRNG to generate the nonce just like the original project by haltingstate.

Caveat

In its current form, this attack does not directly work against github.com/obscuren/secp256k1-go package. The reason for this is that in order to prevent s-malleability, libsecp256k1 enforces an s that is smaller than curve_order/2. If libsecp256k1 computes an s that is bigger it is negated, which essentially has the effect that the message is signed using the negative of the original nonce. Because this attack gets only 1 bit from each signature generated from the textbook algorithm and we don't know if nonce or -nonce has been used, the attacker looses 1 bit and thus learns nothing. See [this line] (https://github.com/jonasnick/ecdsaPredictableNonce/blob/master/main.go#L215) for the cheat that is used in order to ensure using the non-negated nonce.

Thanks to Pieter Wuille for some helpful discussion.

ecdsapredictablenonce's People

Contributors

jonasnick avatar faizkhan00 avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.