mirror of
https://github.com/dani-garcia/vaultwarden.git
synced 2026-04-26 01:35:54 +03:00
[GH-ISSUE #1109] Token generation may be vulnerable to Modulo Bias #784
Labels
No labels
SSO
Third party
better for forum
bug
bug
documentation
duplicate
enhancement
future Vault
future Vault
future Vault
good first issue
help wanted
low priority
notes
pull-request
question
troubleshooting
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/vaultwarden#784
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
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?
Originally created by @zyuiop on GitHub (Aug 22, 2020).
Original GitHub issue: https://github.com/dani-garcia/vaultwarden/issues/1109
Modulo Bias is an issue with random numbers generators where some numbers have a higher chance to be found than others. See an article about this bias and how to avoid it here: https://research.kudelskisecurity.com/2020/07/28/the-definitive-guide-to-modulo-bias-and-how-to-avoid-it/
Here is the line where the bias arises:
github.com/dani-garcia/bitwarden_rs@eba22c2d94/src/crypto.rs (L67)From what I saw in the code, this seems to be used (only?) for two factor authentication, so this may not be very problematic.
@dani-garcia commented on GitHub (Aug 22, 2020):
This shouldn't be a problem in practice as long as users don't configure the token generation to be over 16 or so:
For example using a 16 digit length, the numbers at the start would have 1844 chances to appear (2^64 / 10^16), while the ones at the end would have 1855 which is basically close enough to random for this case I think.
But yeah using the max of 19 would give the first numbers in the range 50% more chance to appear, so I think we should at the very list make the limit lower.