Rust advisories / totp-rs
Vulnerability MediumRUSTSEC-2022-0018 · totp-rs
RUSTSEC-2022-0018: Timing attack
Short answerA security vulnerability in the totp-rs crate: Timing attack. Medium severity (CVSS 4.2). Fixed in 1.1.0: update to a fixed version.
| Crate | totp-rs |
|---|---|
| Type | Vulnerability (crypto-failure) |
| Affected versions | Before 1.1.0. |
| Fixed in | 1.1.0 |
| Severity | Medium, CVSS 4.2 CVSS:3.1/AV:N/AC:H/PR:H/UI:R/S:U/C:H/I:N/A:N |
| Published | 2022-05-09 |
| Last changed | 2026-10-12 |
| Also known as | CVE-2022-29185, GHSA-8vxv-2g8p-2249 |
| Affected functions | totp_rs::TOTP::check |
What to do
- See which version you have:
cargo tree -i totp-rs(it also shows which of your dependencies pulls it in). - Update within your version requirement:
cargo update -p totp-rs. If the fix is a newer major or minor than your requirement allows, raise it in Cargo.toml (for exampletotp-rs = "1.1.0") or update the dependency that pulls it in. - Check again with
cargo audit, or paste your Cargo.lock into our Cargo.toml checker.
Details from the advisory
Affecting versions did not compare tokens in constant time, which could make it possible for an attacker to guess the 2fa token of a user.
This has been fixed by using using the crate constant_time_eq for comparison.
References
- Package: crates.io/crates/totp-rs
- Advisory: rustsec.org/advisories/RUSTSEC-2022-0018.html
- Report: github.com/constantoine/totp-rs/issues/13
From the RustSec Advisory Database (CC0-1.0) via the OSV export, downloaded Oct 24, 2026. Severity score computed from the published CVSS vector.
Up next
Are you affected?Check your whole dependency treePaste Cargo.lock: every advisory, for your exact versions.Read it next →Also worth your time
Did this answer your question?