Welcome, Guest. Please login or register.

Author Topic: Details regarding the critical security vulnerability  (Read 593 times)

0 Members and 1 Guest are viewing this topic.

Offline doctorevil

  • Fresh Nxter
  • *
  • Posts: 16
    • View Profile
Details regarding the critical security vulnerability
« on: February 07, 2014, 06:42:14 PM »
The disclosure CfB recently announced on the BCT thread might leave some with questions regarding the exact details.  Here's what I sent CfB, Jean-Luc, and OpticalC earlier:

-Gentlemen-

All versions of NXT are currently vulnerable to a transaction replay attack.

I've tested this exploit successfully (TXs 16383865633576457223 and 6120913904145250080).

This message has only been sent to you 3 (Jean-Luc, opticalc and CfB); however, I plan to eventually make a public disclosure.

Specifics:

Anyone on the network can create 15 replicas of a transaction that verify OK but which have distinct transaction ids.  This has to do with a phenomenon called signature malleability.  Given a valid signature X0, anyone (not just the original signer) can create 15 additional distinct signatures X1, X2 ... X15 which all verify correctly. 

The only circumstances in which a transaction can not be replayed are if:

(1) the sender's balance is too low or
(2) the transaction deadline has expired

Example exploit scenario:

BTER currently has a 40M+ NXT wallet it sends withdrawals from.  If I was evil, I could transfer 100k NXT back and forth between myself and BTER.  Lets say I do this 10 times.  A few hours later I could create 15 replays of each withdrawal transaction, netting 1.5M NXT.  If I was super evil I could send the replays immediately after each withdrawal, redepositing the new NXT and growing the heist exponentially.  One could drain their entire 40M wallet in 3 round trips starting with just 12500 NXT.  Eviler still, one could also replay recent transactions flowing into BTER from depositors in order to steal their funds as well, swelling the total catch beyond 40M.

Several possible fixes come to mind:

(1) define a canonical signature representation (bitcoin's approach)
(2) exclude the signature field when calculating the transaction id (probably too sweeping a change at this point)
(3) explicitly check for replays in processTransactions (a bit of a kludge)

The math:

The output of Curve25519.sign is v.  This value essentially acts like an element in a finite field who's order is the same as the curve group order (2252+2124).  So for any v, you can add 2252+2124 and arrive at a value that is equivalent as far as the underlying field math is concerned.  NXT encodes v using 256 bits (32 bytes).  Since 2256 is significantly larger than the group order, there are ~16 distinct 256-bit encodings of each field element.  Because everyone knows the group order and v is part of the signature, anyone can generate the other encodings to perform this attack.

In closing, I just want to say that it hurts my evil heart not to exploit this.

-Dr. Evil-

This was quickly followed up with some back and forth with CfB where I provided him actual code for the exploit (which I'll elide here for obvious reasons) and a discussion of the plan for how to rollout a fix (which they implemented within hours of initially communicating with them).

He also threw me 10 BTC, which I didn't really expect but greatly appreciated.  I got all of jack shit (other than a warm fuzzy) when I privately revealed to blockchain.info a RNG bug that had already lead to multiple documented thefts.

I'm happy to answer in this thread any remaining technical questions the community might have about the nature of the flaw.

« Last Edit: February 07, 2014, 06:48:51 PM by punkrock »
Send all ransom payments to: NXT: 11046963052173795996 - BTC 13mSL7XMnyaHCvhkFPofX7gkQq2Bk7SoyB

Offline smaragda

  • Fresh Nxter
  • *
  • Posts: 7
  • WHOIS NXT?!? ;)
    • View Profile
Re: Details regarding the critical security vulnerability
« Reply #1 on: February 07, 2014, 07:14:50 PM »

thnx for NOT being Evil... despite the username!    ;)


I truly hope you stick around... maybe you should also go for the 100,000 NXT in the flaw thread.

...don't take the whole blockchain.info experience out on us if you happen to find anything else...
« Last Edit: February 07, 2014, 07:37:06 PM by smaragda »
"A world with the money can not be perfect." - BCNext
NXT: 12822873041258037678
BTC: 1Grv7NH3xDetLBBD5J1Y9NvxMw4znTCAe9

Offline Berzerk

  • Nxter
  • **
  • Posts: 124
    • View Profile
    • NXTarea.com
Re: Details regarding the critical security vulnerability
« Reply #2 on: February 07, 2014, 07:36:33 PM »
Please join the dev team! You would be a huge bonus for us! :)
Link List (NXTarea.com) | Social Network (nxtion.com) | NXT voting platform (NXTvote.com) | AM Explorer Like my work? Donate: 13337237365691622237

Offline marcus03

  • Fresh Nxter
  • *
  • Posts: 18
    • View Profile
Re: Details regarding the critical security vulnerability
« Reply #3 on: February 07, 2014, 07:41:12 PM »
Huge respect! Thanks!
NXT Solaris - Early NXT Windows client
Raspberry Pi NXT node
NXT tips and donations: 1758531264253431177

Offline l8orre

  • Fresh Nxter
  • *
  • Posts: 31
    • View Profile
Re: Details regarding the critical security vulnerability
« Reply #4 on: February 07, 2014, 07:49:18 PM »


CHAPEAU!!!!!!!!!!!!!!!!!!!!!!!!

Offline CryptKeeper

  • Fresh Nxter
  • *
  • Posts: 17
    • View Profile
Re: Details regarding the critical security vulnerability
« Reply #5 on: February 07, 2014, 08:02:25 PM »
Thank you very much for not exploiting this flaw. Your moral must be even bigger than your intellect. I have to say, I am very impressed!

Offline gs03xzz

  • Fresh Nxter
  • *
  • Posts: 17
    • View Profile
Re: Details regarding the critical security vulnerability
« Reply #6 on: February 07, 2014, 08:16:38 PM »
Please join the dev team! You would be a huge bonus for us! :)

+1.
NXT: 16245925588831182995

Offline zorke

  • Fresh Nxter
  • *
  • Posts: 13
    • View Profile
Re: Details regarding the critical security vulnerability
« Reply #7 on: February 07, 2014, 08:17:45 PM »
Thanks for finding the flaw and not exploiting it. And please join the NXT dev team!

Offline farl4bit

  • Established Nxter
  • ***
  • Posts: 294
  • Have faith and be active!
    • View Profile
    • Nxt Startpagina
Re: Details regarding the critical security vulnerability
« Reply #8 on: February 07, 2014, 08:31:54 PM »
Good job, I don't understand shit about the exploit, but appreciate your choice not to be evil!  :)
https://twitter.com/Nxtgids | Donations: 7582598942095085392 | Nxt Startpagina.nl

Offline Mario

  • Nxter
  • **
  • Posts: 101
    • View Profile
    • MYNXT.org
Re: Details regarding the critical security vulnerability
« Reply #9 on: February 07, 2014, 08:41:31 PM »
+1000

Join dev team!
MYNXT.org | NXTclient.org | Donations: 14831357961500528319

Offline doctorevil

  • Fresh Nxter
  • *
  • Posts: 16
    • View Profile
Re: Details regarding the critical security vulnerability
« Reply #10 on: February 07, 2014, 09:01:05 PM »
Please join the dev team! You would be a huge bonus for us! :)

I don't have the time to contribute consistently, although I'd be happy to be an adviser.

Either way, NXT is likely to benefit from my independent "Q.A. efforts" whether I'm formally part of the team or not :)
Send all ransom payments to: NXT: 11046963052173795996 - BTC 13mSL7XMnyaHCvhkFPofX7gkQq2Bk7SoyB

Offline greyw0lf

  • Fresh Nxter
  • *
  • Posts: 16
    • View Profile
Re: Details regarding the critical security vulnerability
« Reply #11 on: February 07, 2014, 09:02:26 PM »

Offline gim

  • Fresh Nxter
  • *
  • Posts: 42
    • View Profile
Re: Details regarding the critical security vulnerability
« Reply #12 on: February 07, 2014, 09:13:27 PM »
Good job, I don't understand shit about the exploit, but appreciate your choice not to be evil!  :)

It's not that hard actually. It can be simplified to example below (but is more complicated in reality)/

Imagine you have group of 13 elements from (1 to 12), they form a finite field.
You can fit the result on 4 bits (so 0-15), and that's how it is send no the network.

Let's say your signature is "2", you can now add group order to that value (13)
and you result with "15", which still FITS in those 4 bits.


Now verify does calculations modulo 13, so instead of seeing 15, it sees 2 and verifies the signature without objections..

Now as OP has written in case of NXT, order is slightly more than ~ 2252
and signature size is 256 bits, so you have 3-4 additional bits.
nxt 920318146

Offline LiQio

  • Established Nxter
  • ***
  • Posts: 183
  • |_| NXT 17554870974799505420
    • View Profile
Re: Details regarding the critical security vulnerability
« Reply #13 on: February 07, 2014, 09:40:51 PM »
Great work! *humble bow*

Offline BloodyRookie

  • Fresh Nxter
  • *
  • Posts: 33
    • View Profile
Re: Details regarding the critical security vulnerability
« Reply #14 on: February 07, 2014, 09:42:47 PM »
Wouldn't it be the simplest fix to check in the method verify() if v is smaller than the group order and return false if that is not the case?
nxt: 11095639652683007953