Situation
Trying to register a U2P Yubikey series 5 but when I plug it in and click register nothing happens. Usually a Windows system prompt pops up on other websites now saying “insert security key” but that isn’t happening, even when trying different browsers.
OpenEMR Version
I’m using OpenEMR version 7.0.3
Browser:
I’m using: Edge, Chrome, Firefox
Operating System
I’m using: Windows
Search
Yes, last posts from 2021, no users reported issues since
I am commenting to bump. I am not a developer, but am trying to understand what the issue is.
From what I can tell, the issue is that the CryptoTokenExtension which OpenEMR is calling has been deprecated by modern Chrome; it was replaced by the WebAuthn API , which is backwards compatible with u2f devices, but would require a different call that OpenEMR has not moved to. Firefox has similarly changed. I am on Linux so not sure if it still functions on a Microsoft-based browser.
If you open your OpenEMR instance to the MFA u2f registration, and then view your browser console and click register, you likely will see a similar error to me:
Chrome: u2f-api.js:532 Failed to execute ‘postMessage’ on ‘DOMWindow’: The target origin provided (‘chrome-extension://kmendfapggjehodndflmmgagdbamhnfd’) does not match the recipient window’s origin (‘null’).
I am not versed enough to know what needs to be changed to make this work but am hopeful that my identifying this could prompt devs who have the skills to take a look. I created an issue just before I found this post: U2f Extensions deprecated; Replaced by WebAuthn API
Thanks for replying, looking into this further, and posting about it yourself. Alas no response from the devs yet. Would be helpful to get this resolved eventually…
Hi @hgarcia@smithad150 is correct and we’d have to update our U2F interface which I don’t have time right now. However, once we updated you’d need to update your install or create a back port compatible patch. My guess that won’t be too easy to do!
Still, I’ll put it on my todo and take a quick look at time it’d take.
After thinking about this issue I see how it is important and will look into today. If one of you would put up a github issue I can work from, that’d be great.
@hgarcia@smithad150 or all interested/using hardware keys or even TOTP for replacement.
I’ve created a patch I hope will get us by w/o doing a modernization of the feature which would be more impactful and less legacy supportive.
However I don’t have a hardware key to test so I need ya if one or both can help me test.
The attached zip has the changes and instructions for windows or linux flavor installs.
You’ll see it’s a very easy patch and hope it resolves this issue for you’all.
Please let me know so I can get in core for next release or give me as much information including any error in log or console if fails. Recommend turning on user debug.
Thanks, J — I tested the patch on OpenEMR 7.0.3 patch 4 using Windows and a YubiKey 5 NFC (firmware 5.4.3).
The browser displayed the security-key prompt, but registration failed with FIDO2 enabled. The key returned packed attestation, and the console reported:
The selected authenticator did not return a U2F-compatible attestation. Use a physical U2F/FIDO security key.
I temporarily disabled FIDO2 over USB while leaving U2F enabled. Registration then reached the server but failed with:
Registration error: Attestation signature does not match
WebAuthn’s fido-u2f attestation signs the hostname RP ID, while the legacy PHP library verifies the full URL-style AppID. After adding a conditional RP-ID verification path, registration succeeded.
Two additional compatibility changes were required:
Remove WebAuthn’s leading 32-byte RP-ID hash when converting authenticatorData into legacy U2F signatureData.
Allow hostname RP-ID signature verification for WebAuthn-created credentials while preserving full AppID verification for existing legacy U2F registrations.
Registration and login then worked. FIDO2 could be re-enabled after registration, and login continued working.
The remaining issue is onboarding: with FIDO2 enabled, the YubiKey prefers CTAP2 and returns packed attestation, which the legacy backend cannot validate. FIDO2 currently has to be temporarily disabled when registering each new key.
I would not merge the one-file patch as-is yet because both registration and authentication required server-side compatibility changes. I can provide the diffs and help test a revised patch.
Results:
Security-key prompt: Yes
Registration with FIDO2 enabled: No
Registration with FIDO2 temporarily disabled: Yes, after verifier fix
Thanks for testing. I took a shot but no doubt this needs a rewrite and modernization.
We do have a pro concerning this who might be able to pick up and complete far faster than I.
Doesn’t hurt to ask him, right!
How about it Eric @Firehed?