Resident credentials are silently overwritten along user.id prefix chain (raspi_1 → raspi_12 → raspi_123) on v7.0 #241
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary (TL;DR)
On pico-fido v7.0, discoverable (resident) credentials are incorrectly deduplicated based on a prefix of
user.id.Registering
raspi_12overwritesraspi_1, and registeringraspi_123then overwritesraspi_12.Only one resident credential per prefix chain is kept, causing silent and irreversible data loss.
Description
When using pico-fido v7.0 on a Raspberry Pi Pico, creating discoverable (resident) credentials whose
user.idvalues share a common prefix results in silent overwriting of existing credentials instead of allocating new resident slots.This happens even when plenty of resident credential slots are free and occurs with default WebAuthn settings.
The overwrite is deterministic and repeatable and forms a chain:
raspi_12overwritesraspi_1raspi_123overwritesraspi_12This indicates faulty resident credential matching or deduplication logic.
The same test sequence performed on a real YubiKey 5 behaves correctly (no overwrites, new credentials are added).
Environment
https://github.com/polhenarejos/pico-fido/releases/tag/v7.0
pico_fido_pico-7.0.uf2https://github.com/polhenarejos/pico-fido/releases/download/v7.0/pico_fido_pico-7.0.uf2
webauthn.iofido2-token(libfido2)Steps to Reproduce
Flash
pico_fido_pico-7.0.uf2to a Raspberry Pi Pico and set a PIN.On
https://webauthn.io, register discoverable credentials for:raspi_1raspi_2Verify credentials:
Register another discoverable credential for:
raspi_12List credentials again:
→
raspi_1has been overwritten byraspi_12Register another discoverable credential for:
raspi_123List credentials again:
→
raspi_12has now been overwritten byraspi_123(Control test) Register:
raspi_01This coexists and is not part of the overwrite chain.
Expected Result
Each registration allocates a new resident credential slot.
All previously registered credentials remain present.
Example expected set:
raspi_1raspi_12raspi_123raspi_2raspi_01Actual Result
Resident credentials are silently overwritten when the new
user.idextends an existing one.Observed behavior:
raspi_12overwritesraspi_1raspi_123overwritesraspi_12Example state after registering
raspi_123:raspi_1andraspi_12are lost.Additional Evidence
New keypair is generated but stored by overwriting
Running:
shows a new public key for
raspi_12/raspi_123, confirming that:Reference Device Comparison
The same registration sequence tested on a YubiKey 5:
This suggests the issue is specific to pico-fido’s resident credential storage or matching logic.
Debug Output
For additional context, I am attaching debug output captured from the test token after testing (only webauthn.io test credentials present):
fido2-token_debug.txt
Notes / Observations
user.idvalues:raspi_1→raspi_12→raspi_123❌ overwrite chainraspi_01✅ coexists(rpId, user.id)equality.(rpId, user.id)is identical.Impact
Fixed in ac7e345.
Thanks for the very well detailed report. It helped a lot.
@polhenarejos
I also read this bug report and thought, "This is how all bug reports should look like."
Perhaps it would be useful to create a report template from this report so that all bug reports are as detailed and comprehensive as possible?
And additionally, the existence of the template could be mentioned somewhere in the project's README.md file so that everyone is aware of it?
At least that's how I intend to structure my projects here on GitHub (and on alternatives).
Thanks for the quick fix, @polhenarejos
I tested updated builds based on the current main branch, and the issue is now resolved. Resident credentials with shared prefixes no longer overwrite each other and behave as expected.
I initially discovered this issue while testing an older state of pico-fido2. Since that repository no longer contains code, I reproduced and verified the problem using the current pico-fido release (v7.0), where the issue was still present.
I also backported the fix to my local pico-fido2 setup, where it resolves the issue as well.
Unrelated question: is there any chance that pico-fido2 might be revived in the future, or should i consider it permanently discontinued?
I agree on that a detailed issue is always welcome, provides a valuable help and reduces drastically the interaction focusing on solving the bug. However, I want to be accessible as much as posible. There are users that are not skilled or even they use it as a consumer. Others have problems expressing themselves in english. If I put a template, it will create a barrier that may discourage some to report bugs they found. My goal is to gather many bugs as possible and later I'll figure out how to solve them, if I can. I do not expect users have the proper tools to debug, probe or rebuild the software with variants. In the end, I only need the reproduceability.
@polhenarejos
Well, perhaps the README.md file could simply state that using the template is OPTIONAL and that filing out the template increases the likelihood of fixing the bug, simply by providing the necessary information. In other words, that filling out the template is in the best interest of the bug reporter. At the same time, your exact text could also be included there, clarifying that if the template is legitimately not used, the bug will still be investigated, but the lack of information simply makes it less likely that it will be fixed.
Or would that already be TL;DR?