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

U2F not working with krypt.co provider #105

Closed
ellie-idb opened this issue Jul 27, 2018 · 20 comments
Closed

U2F not working with krypt.co provider #105

ellie-idb opened this issue Jul 27, 2018 · 20 comments
Labels
bug Something isn't working troubleshooting There might be bug or it could be user error, more info needed

Comments

@ellie-idb
Copy link

I'm using bitwarden_rs on docker, and whenever I try to register my U2F provider (Kryptonite), it errors, first, saying that "Error activating u2f", then, "Unable to recover challenge".
Looking in the logs, I see this:

POST /api/two-factor/get-u2f application/json; charset=utf-8:

    => Matched: POST /api/two-factor/get-u2f

    => Outcome: Success

    => Response succeeded.

GET /app-id.json:

    => Matched: GET /app-id.json

    => Outcome: Success

    => Response succeeded.

POST /api/two-factor/u2f application/json; charset=utf-8:

    => Matched: POST /api/two-factor/u2f

Error: BadCertificate

ERROR: Error activating u2f

    => Outcome: Success

    => Response succeeded.

I have enabled HTTPS on my server, and set the DOMAIN environment variable to the URL, including 'https'.

@ellie-idb ellie-idb changed the title U2F not working U2F registration not working Jul 27, 2018
@mprasil mprasil added bug Something isn't working troubleshooting There might be bug or it could be user error, more info needed labels Jul 27, 2018
@dani-garcia
Copy link
Owner

I've tested this with the Krypt iOS app and I can reproduce it. The issue seems to originate in the webpki library (the exact error is BadDER, which seems to indicate problems parsing the DER certificate).

I'm not sure there is much I can do about it, as I'm not a cryptography expert by any means, but I'll look into it a bit more.

@mannp
Copy link

mannp commented Aug 6, 2018

Is this U2F or Authenticator App, as I didn't think U2F was implemented in bitwarden_rs?

@beatgammit
Copy link

@mannp
Copy link

mannp commented Aug 6, 2018

@beatgammit cool thanks, just that I thought that was TOTP Authentication with an Authenticator app, whereas U2F was using a Yubico key or similar.

My misunderstanding.

@mannp
Copy link

mannp commented Aug 9, 2018

My error is different but the exact same setup on v1 works fine.

PUT /api/two-factor/authenticator application/json; charset=utf-8:
=> Error: No matching routes for PUT /api/two-factor/authenticator application/json; charset=utf-8.
=> Warning: Responding with 404 Not Found catcher.
=> Response succeeded.

@mprasil
Copy link
Contributor

mprasil commented Aug 10, 2018

@mannp this sounds like different issue, I've created #124 to handle that.

@rezhajulio
Copy link

rezhajulio commented Mar 4, 2019

I just test U2F with SoloKeys and it works just fine.

@dani-garcia dani-garcia changed the title U2F registration not working U2F not working with krypt.co provider Mar 13, 2019
@jkaberg
Copy link
Contributor

jkaberg commented Apr 21, 2019

@dani-garcia which lib is that? I'm asking because I haven't came across this issue with any other U2F compatible service out there (tested on atleast 20+ different ones), just bitwarden_rs

This is/was tested/used with Krypton. Perhaps @kcking is able to share some light on the issue?

@dani-garcia
Copy link
Owner

We are using the U2F-rs library, which uses Webpki for cert validation, which is where it fails.

I'm not sure what the cause of the error is to be honest, looking for BadDER in webpki's issue tracker lists a couple of issues, like not supporting V1 certificates, or requiring certificates to have the subjectAltName extension field, but not sure if those are related.

@kcking
Copy link

kcking commented Apr 21, 2019

Thanks for digging into this a bit -- we don't set any SAN extension on the cert, so if webpki requires it that would be at least one issue. Is there a rationale for why they require one or is it considered a bug?

@dani-garcia
Copy link
Owner

Mostly that webpki is focused on certificates for TLS use, and every mayor browser requires those extensions. The u2f support is more of a happy coincidence, as it is.

briansmith/webpki#90 (comment)

@jkaberg
Copy link
Contributor

jkaberg commented Apr 26, 2019

@kcking Would it be feasible to do add SAN to the Kryptonite certificate?

@raf924
Copy link

raf924 commented Oct 18, 2019

Just doing a health-check on this issue as I just tried and failed to use Krypton as a u2f security key with Bitwarden. @kcking Is setting SAN out of the question then ?

@dani-garcia
Copy link
Owner

I've tested this again with the latest image, with the new version of the u2f crate, which now uses openssl instead of ring/webpki and the krypt app seems to work for me for a basic register/login test.

I'd appreciate if someone else could also test it too.

@raf924
Copy link

raf924 commented Jan 22, 2020

Just tested it, with bitwarden-rs v1.13.1-d212dfe7, Firefox v72.0.1 with the Krypton extension v1.0.16 on Windows and the Krypton Android App v2.5.5. Registered the app as a U2F key for Bitwarden and successfully logged in with it. Nice work!

@dani-garcia
Copy link
Owner

Great, I've got some other confirmations that this works now, so I'll close the issue. If any problems appear again, it can be reopened/a new one can be created.

@mustanggb
Copy link

mustanggb commented Sep 16, 2022

Seems like this is broken again.

There was a problem reading the security key. Try again.

@BlackDex
Copy link
Collaborator

@mustanggb if you are referring to krypt.co, then I can confirm that it doesn't work.
But it also doesn't work on https://webauthn.io/ or https://www.token2.com/tools/fido2-test/

Since Kryptco hasn't been updated for a long time since it has been acquired by Akamai, i think there are many issues with it using modern browsers and maybe even Android/iOS devices.

This is not something we can fix on our side.

@mustanggb
Copy link

Yes, referring to krypt.co/krypton.

The same issue exists for Akamai by the way, I tried both.

Testing the two links you gave, https://webauthn.io/ registers, but at login gives the error:
The 'allowCredentials' attribute exceeds the maximum allowed size (64).

Whereas https://www.token2.com/tools/fido2-test/index.php actually works fine.

Both get "stuck" on the registering, as it appears to the user, but seemingly do actually perform the register behind the scenes (on both webauthn and token2), then the login works (on token2).

Whereas with vaultwarden it similarly appears to get "stuck" as the same point on registering, but doesn't save the information sent back.

So yes like you said it's not been updated in a while, and what it sends back might not be 100% "in spec", but it shouldn't be impossible to "fix on our side".

Perhaps you use a library for U2F support, so it's something that could be raised upstream?

@BlackDex
Copy link
Collaborator

Well, if you want to get it fixed in upstream, i would suggest to check the library for the details.
They do have some mentions about this.

The library: https://github.com/kanidm/webauthn-rs/
There test site: https://webauthn.firstyear.id.au/compat_test

Though, vaultwarden currently uses an older version of that library, i think there main site uses the latest version, and it doesn't work there either.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working troubleshooting There might be bug or it could be user error, more info needed
Projects
None yet
Development

No branches or pull requests