Skip to content
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

KIP-0026: Key Derivation and Mnemonic encoding methods #55

Draft
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

Takadenoshi
Copy link

@Takadenoshi Takadenoshi commented Nov 22, 2023

Introduces a standard for key derivation and encoding mnemonic phrases.

Summary from abstract:

  • Derivation: SLIP-10 with derivation path m/44'/626'/a'.
  • Mnemonics: BIP-39, 24 words, English wordlist, empty passphrase.

Pending: test cases, backwards compatibility section


@Takadenoshi Takadenoshi marked this pull request as draft November 22, 2023 16:31

## Key Derivation

We recommend following the widely adopted standard for deriving ED25519 keypairs: [SLIP-0010](https://github.com/satoshilabs/slips/blob/master/slip-0010.md).
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think the KIP itself should be stated as a recommendation. Rather, I'd state directly what anyone following the KIP should follow, and then later we can say to a wallet provider that "We recommend you follow KIP-26".

kip-0026.md Outdated
- Allows interoperability.
- Few wallets implement encrypted mnemonic recovery.
- Encrypting a mnemonic with a passphrase may provide a sense of security, but:
- A leaked encrypted mnemonic phrase can be quickly brute-forced offline ([BIP-39](https://github.com/bitcoin/bips/blob/master/bip-0039.mediawiki#from-mnemonic-to-seed): 2048 round PBKDF2 using salted HMAC-SHA512).

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

❗ ❓ 😮
Are you sure that a (good) password derived with a SHA256-2048 PBKDF2 can be quickly brute-forced ?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

more specifically the assertion that it can be quickly brute-forced is not backed by the reference as far as I can see.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps "significant speed" is more accurate than "quickly", but I think the essence of the statement holds.

A good password could withstand MD5, but it would probably end up looking like another seed phrase to be stored securely, away from the encrypted seedphrase. An average user password would succumb reasonably quickly, especially if the seed was compromised on their machine, where a lot of information could be used to build up a dictionary.

For the current BIP39 spec of HMAC-SHA-512 [1] I estimate that an off-the-shelf 4090 can do about ~1521 kH/s[2] which would map to:

  • rockyou.txt wordlist (14M): 9 seconds
  • crackstation wordlist (1.2B): 13 minutes
  • crackstation * 100 masks (121B): 22 hours
  • bruteforce alpha/lower 8 letters (208B): 38 hours
  • bruteforce alpha/lower + numeric 8 letters (2.8T): 21 days

And so on. It is not exactly a done-deal given enough entropy, but I'd still call it a fast enough attack with consumer hardware, which will only become cheaper and more accessible in the future[3][4].

I would consider "slow" here to be something like LUKS2/argon2i which is molasses-slow to dictionary attack or bruteforce, or pbkdf2/sha512 with a very large number of rounds (600K+.)

All that said, it should probably read "bruteforced with significant speed", instead of "quickly", so I will change that.

[1] HMAC-SHA-256 would be even faster: A 4090 should do 2048 rounds @ ~4170 kH/s

[2] Extrapolating from the speed given for 999 iterations here of 3120.9 kH/s - rounds to speed should be ~linear

[3] Consider the lastpass situation where some of their early accounts were stuck at < 10K iterations and were cracked after a disasterous leak. Not sure what their hashing function is though.

[4] We don't even know what the "cracking station" state of the art is at the moment. It would not surprise me to learn that there are GPU farms or even custom ASICs that can smoke these numbers.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK,
We are not speaking about the same thing... I was speaking about good passwords...
In crypto, people are not supposed to use passwords from the dictionary, lol. 😉

@dfordivam
Copy link

@Takadenoshi here is my resposne to your queries
using m/44'/626'/a' is ok from the Ledger wallet point of view. Using SLIP-0100 is not the default in Ledger, but is supported. You may also see my prior response on this topic here obsidiansystems/ledger-app-kadena#33

@Takadenoshi
Copy link
Author

Using SLIP-0100 is not the default in Ledger, but is supported.

@dfordivam Thanks!

Q: The not-default part is regarding Ledger not enforcing hardened child keys/segments, right? Is the derivation algorithm is still identical to SLIP-0010 for hardened keys?

@dfordivam
Copy link

Is the derivation algorithm is still identical to SLIP-0010 for hardened keys?

No, the algorithm is different and incompatible with the default algorithm (currently in use in ledger-app-kadena)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants