Git Product home page Git Product logo

xorgx304 / eddsa-fault-attack Goto Github PK

View Code? Open in Web Editor NEW

This project forked from kudelskisecurity/eddsa-fault-attack

0.0 1.0 0.0 12 KB

Fault attack agaisnt EdDSA demonstrated on an Arduino Nano board, allowing for partial key recovery and fake signatures.

Home Page: https://research.kudelskisecurity.com/2017/10/04/defeating-eddsa-with-faults/

License: The Unlicense

Arduino 13.16% Python 86.84%

eddsa-fault-attack's Introduction

Fault attack on EdDSA and Ed25519

We demonstrated how to recover enough part of the secret key of a device performing EdDSA signatures thanks to a single fault at the right time to be able to produce seemingly valid signature (even though the real signature by the actual secret key holder would not have the same value). This is an inherent weakness of the algorithms and cannot be avoided as long as the algorithms are generating their values through deterministic means. Our paper was presented during FDTC 2017. We give here the code to perform fault signature simulations as well as key recovery from faulted signatures.

In our example setup, we were able to attack and recover the secret key stored in an Arduino Nano running Ed25519 signature using the ArduinoLibs.

Countermeasures against such fault attacks are detailled in our paper "Practical fault attack against the Ed25519 and EdDSA signature schemes".

Requirements

  • Python 2.6+
  • gmpy2

Attack simulation

The Python script test_simulation.py simulates a fault happening during the signature process and applies the attack to recover the private value a:

./test_simulation.py -r
Key generation:
a = 3856099267433939410638934773561861774469861534617912158986655171120805876879
First signature is valid : True
Second signature is valid: False
Same R but not the same S: True
Found a with error at offset 31
a = 3856099267433939410638934773561861774469861534617912158986655171120805876879
Signing another message:
Third signature is valid: True

By default keys, fault offsets and values are randomly generated. However, deterministic tests may be run:

$ ./test_simulation.py -d -o 12 -e 56
Key generation:
a = 482006232232683921242586128535238829962455780187631138037190845242801001519
First signature is valid : True
Second signature is valid: False
Same R but not the same S: True
Found a with error at offset 12
a = 482006232232683921242586128535238829962455780187631138037190845242801001519
Signing another message:
Third signature is valid: True

Arduino attack

To perform the attack on Arduino Nano, Arduino Studio must be installed and the Crypto library of the ArduinoLibs project have to be imported. The code executed on Arduino Nano is given in the file ed25519.ino. The complete set-up and methodology to obtain faults by voltage glitch are given in the paper.

Once the proper faults have been found, the script test_arduino.py recovers the value a from the faulted signatures:

$ ./test_arduino.py 
Fault from Arduino Nano voltage glitch:
signature 1 is valid: True
signature 2 is valid: False
Found value of a thanks to error at offset 6
a = 5261030905596737613781015704137862010759183555703583748072526152929652983426
signature 2 is valid: False
Found value of a thanks to error at offset 4
a = 5261030905596737613781015704137862010759183555703583748072526152929652983426
signature 2 is valid: False
Found value of a thanks to error at offset 2
a = 5261030905596737613781015704137862010759183555703583748072526152929652983426
signature 2 is valid: False
Found value of a thanks to error at offset 1
a = 5261030905596737613781015704137862010759183555703583748072526152929652983426
signature 2 is valid: False
Error
Error: the glitch was not at offset 32

Publication

Article's DOI: 10.1109/FDTC.2017.12
The accepted version is freely available.

Copyrights

Our original source code is copyright © 2017 Nagravision S.A., and was written by Sylvain Pelissier and Yolan Romailler.

The Ed25519 python implementation is based on DJB's work, the Ed25519 software is in the public domain.

The software published here is in under the Unlicense.

eddsa-fault-attack's People

Contributors

anomalroil avatar sylvainpelissier avatar

Watchers

 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.