mailcow-dockerized icon indicating copy to clipboard operation
mailcow-dockerized copied to clipboard

Deprecation of U2F API - Implementation of WebAuthn as 2FA-Provider

Open itshappyli opened this issue 2 years ago โ€ข 24 comments

Summary

WebAuthn has been introduced as a new standard for 2FA, replacing the legacy U2F standard. Additionally, the WebAuthn standard is backward compatible with U2F devices. Unfortunately, the Google Chrome browser only supports U2F until February 2022. The same applies for the Microsoft Edge browser respectively.

Motivation

Since many organizations rely on hardware security keys in their IT infrastructure, support for authentication with these keys must be maintained and guaranteed.

Additional context

Also explained in this blog entry from the Chrome Developers: https://developer.chrome.com/blog/deps-rems-95/

As far as I know, there is already an implementation of WebAuthn in the mailcow UI. The current implementation allows hardware based login to the UI (hardware must also fully comply with the FIDO2 standard). My point of view is using WebAuthn as 2FA method as described above.

itshappyli avatar Jan 14 '22 22:01 itshappyli

I've already worked on that and have successfully migrated from u2f to webauthn https://github.com/FreddleSpl0it/mailcow-dockerized. I will try to do a PR next week.

FreddleSpl0it avatar Jan 15 '22 09:01 FreddleSpl0it

Thanks for your contribution! It's really nice to hear that you managed to successfully implement the WebAuthn API.

I can't wait until it's available!

itshappyli avatar Jan 15 '22 11:01 itshappyli

Yes and we will merge it into the Janmooary Update :)

DerLinkman avatar Jan 16 '22 19:01 DerLinkman

Has anyone tested this new implementation under linux? Can't register a yubikey 5 NFC, i successfully used with the old U2F implementation. Tested under Ubuntu with Firefox 96 & Chromium 97.

(This yubikey demo works: https://demo.yubico.com/webauthn-technical/registration.)

ghost avatar Jan 22 '22 19:01 ghost

Can you give us a error code?

DerLinkman avatar Jan 22 '22 20:01 DerLinkman

does your mailcow have a valid ssl certificate or does it have a self-signed/untrusted one?

FreddleSpl0it avatar Jan 22 '22 20:01 FreddleSpl0it

Can you give us a error code?

Bildschirmfoto-20220122211747-2190x214

There is just a timeout. Normally the yubikey would blink, during the firefox popup, and accept a touch. But in this case it doesn't.

does your mailcow have a valid ssl certificate or does it have a self-signed/untrusted one?

Yes, a valid ssl certificate.

ghost avatar Jan 22 '22 20:01 ghost

Did Webauthn use Javascript @FreddleSpl0it ? If so can you check if your Browser blocks Javascript?

DerLinkman avatar Jan 22 '22 20:01 DerLinkman

Did Webauthn use Javascript @FreddleSpl0it ?

Yes.

If so can you check if your Browser blocks Javascript?

No, there are also no errors in the devtools console.

{
  "publicKey": {
    "rp": {
      "name": "WebAuthn Library",
      "id": "DOMAIN"
    },
    "authenticatorSelection": {
      "userVerification": "preferred",
      "requireResidentKey": true
    },
    "user": {
      "id": {},
      "name": "USERNAME",
      "displayName": "USERNAME"
    },
    "pubKeyCredParams": [
      {
        "type": "public-key",
        "alg": -7
      },
      {
        "type": "public-key",
        "alg": -257
      }
    ],
    "attestation": "indirect",
    "extensions": {
      "exts": true
    },
    "timeout": 30000,
    "challenge": {},
    "excludeCredentials": []
  }
}

But this object is logged, don't know if this helps.

ghost avatar Jan 22 '22 20:01 ghost

I'll take a look at it. I can't tell if your browser just needs some time and that's why you get a timeout or if it's another problem. I'll try to reproduce the problem.

Do you get the same error when you try to use the key as only Fido2 registration?

FreddleSpl0it avatar Jan 22 '22 20:01 FreddleSpl0it

I'll take a look at it. I can't tell if your browser just needs some time and that's why you get a timeout or if it's another problem. I'll try to reproduce the problem.

30 seconds should be enough. Please let me know if i can help with further debugging. (Normally the yubikey starts blinking under a second.)

Do you get the same error when you try to use the key as only Fido2 registration?

If i understand you correctly, thats what i did. (I only clicked on the register button to add the yubikey.)

ghost avatar Jan 22 '22 20:01 ghost

Do you get the same error when you try to use the key as only Fido2 registration?

If i understand you correctly, thats what i did. (I only clicked on the register button to add the yubikey.)

And using your Key for 2 Factor Authentication via WebAuthn produced the same error?

FreddleSpl0it avatar Jan 22 '22 21:01 FreddleSpl0it

And using your Key for 2 Factor Authentication via WebAuthn produced the same error?

Yes, same behaviour. Except the object i posted above isn't logged. Bildschirmfoto-20220122220715-1150x224

ghost avatar Jan 22 '22 21:01 ghost

Your YubiKey 5 NFC has a FIDO2 interface. The new Fido2/Webauthn method will try to use your key via this interface instead of the old FIDO interface. This requires that you secure your key with a pin.

If no pin is set, the browser should normally prompt you to set a pin. At least on Windows. Can you check if your key has a pin? https://www.yubico.com/support/download/yubikey-manager/

FreddleSpl0it avatar Jan 22 '22 21:01 FreddleSpl0it

Pin is set. I think the "CredentialCreationOptions" may be the problem.

(fido2-webauthn with bitwarden works with this key and browser. It's probably some problem with the mailcow implementation.)

Bitwardens "CredentialCreationOptions" differ from the ones used here, see: Bildschirmfoto-20220123001944-406x122

ghost avatar Jan 22 '22 21:01 ghost

I can only confirm this strange behaviour with firefox on ubuntu. However my yubikey works fine with chrome and opera. In chrome and opera i get prompted to enter a pin :/

The problem could be solved by setting requireResidentKey: false and userVerification: "discouraged" but this is a security feature we should discuss about before dropping it.

FreddleSpl0it avatar Jan 22 '22 23:01 FreddleSpl0it

Yeah, maybe adding a setting in the ui for this, would be ok. And leave the default as is. Or a browser/OS detection, but thats not bulletproof.

Fido2+webauthn+pin support overview: https://support.yubico.com/hc/en-us/articles/360016615020-Operating-system-and-web-browser-support-for-FIDO2-and-U2F

firefox is affected under linux and macos, and some android browser.

and this seems to be the related firefox bug ticket: https://bugzilla.mozilla.org/show_bug.cgi?id=1530370

ghost avatar Jan 22 '22 23:01 ghost

this issue is related #3859

FreddleSpl0it avatar Jan 23 '22 00:01 FreddleSpl0it

fido

UV flags are set to preferred for both FIDO Second factor and FIDO Passwordless MFA. Seeing this https://developers.yubico.com/WebAuthn/WebAuthn_Developer_Guide/, we should change that. My sugesstion is setting the UV flag for FIDO Passwordless MFA to reqiured and the UV flag for FIDO Second factor to discouraged. This way, at least FIDO Second factor should work on linux firefox browsers

FreddleSpl0it avatar Jan 24 '22 06:01 FreddleSpl0it

https://github.com/mozilla/authenticator-rs/pull/157 is now merged, so maybe with the next Nightly built it's included https://bugzilla.mozilla.org/show_bug.cgi?id=1752089

MAGICCC avatar Jan 26 '22 19:01 MAGICCC

Iโ€™d like to note that the new WebAuthn thingy is still broken here (Yubikey 5C, GNU/Linux 5.13, Firefox 100). It fails during the register step, the Yubikey wonโ€™t even start to blink waiting for me to touch it. Firefox is stuck looking for an applicable device.

WebAuthn tests like webauthn.me work fine, though.

itkfm avatar Jun 01 '22 07:06 itkfm

I think there is a bug on Linux both in Firefox and Chrome Browser. The bug occurs when the parameter User Verification is set to preferred. Could you test the process here webauthn.io and go under Advanced Settings and set User Verification to Preferred. The same bug you mentioned should occur.

However you could create a vars.local.inc.php file in data/web/inc and set the "User Verification" Flag for Webauthn to discouraged like:

<?php
  $WEBAUTHN_UV_FLAG_REGISTER = 'discouraged';
  $WEBAUTHN_UV_FLAG_LOGIN = 'discouraged';
?>

FreddleSpl0it avatar Jun 02 '22 09:06 FreddleSpl0it

Could you test the process here webauthn.io and go under Advanced Settings and set User Verification to Preferred. The same bug you mentioned should occur.

It didnโ€™t.Works fine.

itkfm avatar Jun 02 '22 11:06 itkfm

@itshappyli It looks like all the issues with WebAuthn are fixed now, do you agree? If yes, can you close the issue?

snevas avatar Aug 08 '22 09:08 snevas