CVE-2022-29185: Observable Timing Discrepancy in totp-rs
4.2
CVSS Score
3.1
Basic Information
CVE ID
GHSA ID
EPSS Score
0.56245%
CWE
Published
5/24/2022
Updated
6/13/2023
KEV Status
No
Technology
Rust
Technical Details
CVSS Vector
CVSS:3.1/AV:N/AC:H/PR:H/UI:R/S:U/C:H/I:N/A:N
Package Name | Ecosystem | Vulnerable Versions | First Patched Version |
---|---|---|---|
totp-rs | rust | < 1.1.0 | 1.1.0 |
Vulnerability Intelligence
Miggo AI
Root Cause Analysis
The vulnerability stemmed from using regular string comparison (==) in the token validation logic. The commit diff shows the critical fix replaced this with constant_time_eq() in TOTP<T>::check. This function's comparison of generated tokens with user input was vulnerable to timing analysis, as string equality checks in most languages (including Rust) short-circuit on first mismatch. The direct replacement with a constant-time comparison function in the patched version confirms this was the vulnerable point.