Score:7

Why did Yubico changed U2F Key Derivation method on YubiKey?

pl flag

Previous:
https://web.archive.org/web/20160102181336/developers.yubico.com/U2F/Protocol_details/Key_generation.html
https://www.yubico.com/blog/yubicos-u2f-key-wrapping/

$$ PrivateKey = \operatorname{HMAC-SHA256}(AppID+nonce, DeviceKey)\\ KeyHandle = nonce + \operatorname{HMAC-SHA256}(AppID, PrivateKey) $$


Now:
https://web.archive.org/web/20200514221105/developers.yubico.com/U2F/Protocol_details/Key_generation.html

Updated Feb 2020 to reflect current YubiKeys. The following applies to any YubiKey or Security Key by Yubico with a firmware version of 4.4 or greater ( this includes any YubiKey FIPS device).

$$ PrivateKey = \operatorname{GenerateRandomPrivateKey}()\\ KeyHandle = \operatorname{AES-256-CCM}(DeviceMasterKey, PrivateKey, AppId) $$

PrivateKey is generated randomly, encrypted by an AEAD primitive, and bound to AppID.


What was the reason behind this change? Is it more secure? Does relying on built-in RNG weaken it (in case you don't trust the RNG)?

Maarten Bodewes avatar
in flag
Note that *why* questions are always hard to answer. I propose writing to Yubico and posting an answer if & when you get one.
youfu avatar
pl flag
@MaartenBodewes Thank you for your suggestion. I submitted a support ticket to Yubico. Will update after Yubico reply.
samuel-lucas6 avatar
bs flag
At a glance, the first link seems to suggest the U2F spec says to randomly generate the private key and encrypt it. They then note two limitations: the encrypted private key leaves the device and you have to use another primitive. The second link suggests the change makes their code simpler (e.g. no nonce to store, easily detects tampering, avoids multiple MAC computations and as much concatenation). It should be more efficient as well. I think this question is largely answered via those links.
Score:4
pl flag

Answer from Yubico Support:

The first case is the U2F flow, where there are no such things as discoverable credentials - that is FIDO credentials with information identifying aspects about the credential, such as site URL or username. Since the U2F flow does not have the associated metadata, hashing works fine - the key itself is secure and cannot be recreated without both the master key on the device and the relying party key handle.

The second references discoverable credentials used in WebAuthn. As such, the CTAP/U2F spec was expanded to include descriptions on how to handle these keys and associated metadata. The metadata needs to be secured as well as the key, hence the AES encryption - there is arbitrary data which cannot be derived from a hashing algorithm. This encryption is likewise secure, as the master key used for encryption never leaves the YubiKey as well.

Since the private key is generated on the device, we do need to leverage our RNG for entropy. Should any risks or weaknesses in the RNG or any function of the YubiKey be discovered we will make sure our customers are informed and protected. We take any such vulnerabilities exceedingly seriously - please see https://www.yubico.com/support/issue-rating-system/security-advisories/ for a full list of all security advisories.

In short, both methods are secure and optimized for different uses.

youfu avatar
pl flag
Personally I would prefer the HMAC method. But anyway, old-school U2F may phase out after WebAuthn & PassKeys gets more popular. Time kills everything.
I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.