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

Invalid user.id length for passkeys handlers #70412

Open
LeoColomb opened this issue May 7, 2024 · 7 comments
Open

Invalid user.id length for passkeys handlers #70412

LeoColomb opened this issue May 7, 2024 · 7 comments

Comments

@LeoColomb
Copy link

LeoColomb commented May 7, 2024

Environment

SaaS (https://sentry.io/)

Steps to Reproduce

  1. Having a passkeys manager running (e.g: a password manager)
  2. Being authenticated on Sentry
  3. Go to the U2F page https://sentry.io/settings/account/security/mfa/u2f/enroll/

Expected Result

All the enrollment to run without issues and the key challenge to be accepted.
The user.id standard to be respected

Actual Result

The interface shows an error.
image

The passkeys manager receives an incorrect user.id length.

image

The password manager logs an error.

[Fido2Client] Invalid 'user.id' length: oWlwdWJsaWNLZXmmYnJwomJpZGlzZW50c[truncated] (589)

Ref: bitwarden/clients#8756

I tried to dig in where the wrong length was created, but it seems to be generated to correct way:

"id": user.id.to_bytes(64, byteorder="big"),

Some ideas:

  • Fido2 Server is re-processing the user.id
  • There is a mismatch in the encoding/decoding somewhere, possibly while the data transited on the frontend React page.

Product Area

Settings - Auth

Link

https://sentry.io/settings/account/security/mfa/u2f/enroll/

DSN

No response

Version

No response

@getsantry
Copy link
Contributor

getsantry bot commented May 7, 2024

Assigning to @getsentry/support for routing ⏲️

@getsantry
Copy link
Contributor

getsantry bot commented May 8, 2024

Routing to @getsentry/product-owners-settings-auth for triage ⏲️

@leedongwei
Copy link
Member

We're looking into this. Thanks for the detailed bug report!

@mdtro
Copy link
Member

mdtro commented May 9, 2024

@LeoColomb

I'm able to recreate this using the Bitwarden Browser Extension 2024.4.2 and Chrome 124.0.6367.156. I don't receive a prompt from Bitwarden to setup a passkey. Is this what you're experiencing? Could you share your extension and browser versions?

Interestingly, I cannot recreate this using 1Password. It successfully prompts to create a new passkey and registers it fine.

@LeoColomb
Copy link
Author

LeoColomb commented May 10, 2024

@mdtro Good to know!
I don't think the version numbers are going to explain anything: I've tried with 3 different browsers (Chrome, Firefox, Brave), with different versions (I'm facing this issue for half a year at least).
Same for Bitwarden.
In any case, the latest versions are affected.

The prompt is not shown because of the error reported by Bitwarden's background script.

@LeoColomb
Copy link
Author

@mdtro After further investigation, it appears that the user.id provided is actually the challenge data encoded with CBOR+base64.
The user.id inside that data is the valid one.

image

@mdtro
Copy link
Member

mdtro commented May 13, 2024

@LeoColomb Good catch! Our backend API returns this in a JSON response to a GET on /api/0/users/me/authenticators/u2f/enroll/.

{
    ...
    "challenge": {
        "webAuthnRegisterData": "<encoded data>"
    }
}

@leedongwei I'm not great with the frontend code. Is it possible we are decoding this incorrectly and putting the wrong values in user.id? Or is this an issue with the BitWarden client/extension?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: No status
Development

No branches or pull requests

4 participants