CVE-2022-29185: Totp rs Observable Timing Discrepancy Vulnerability

MODERATE
Advisory Identifier: GHSA-8vxv-2g8p-2249
CVSS 4.2
CWE-203 CWE-208
Published
Advisory Summary

CVE-2022-29185 is a MODERATE (CVSS 4.2) observable timing discrepancy vulnerability (CWE-203: Observable Discrepancy) affecting Totp rs libraries in the crates.io ecosystem. The issue involves observable timing discrepancy in totp-rs. Remediation is available by upgrading affected packages to version 1.1.0.

CVE-2022-29185 at a Glance

CVE Identifier CVE-2022-29185
GHSA Identifier GHSA-8vxv-2g8p-2249
Severity MODERATE
CVSS v3.1 Base Score 4.2
CWE Classification CWE-203: Observable Discrepancy
Affected Product Totp rs
Package Ecosystem crates.io
Published Date
Last Updated

Security Impact

CVSS: 4.2

The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:H/PR:H/UI:R/S:U/C:H/I:N/A:N).

Attack Vector Network (AV:N)
Attack Complexity High (AC:H)
Privileges Required High (PR:H)
User Interaction Required (UI:R)
Scope Unchanged (S:U)
Confidentiality High (C:H)
Integrity None (I:N)
Availability None (A:N)

How to Fix CVE-2022-29185

To remediate this vulnerability, upgrade all affected Totp rs dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.

totp-rs fixed: 1.1.0
Upgrade totp-rs to 1.1.0
Verify Direct and Transitive Dependencies

Run the following command in your project directory to verify that all resolved dependencies use the patched release:

inspect dependencies for totp-rs

How to Check if You Are Affected

To determine whether your application is affected by CVE-2022-29185, inspect your project dependencies for Totp rs:

inspect dependencies for totp-rs

Analyze the terminal output to locate any version of Totp rs in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 1.1.0), your application is affected.

Note: Verify declared build manifests and deployed runtime container environments.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-203: Observable Discrepancy, where the product behaves differently or sends different responses under different circumstances in a way that is observable to an unauthorized actor. In Totp rs, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.

Source Advisory Statement

### Impact Token comparison was not constant time, and could theorically be used to guess value of an TOTP token, and thus reuse it in the same time window. The attacker would have to know the password beforehand nonetheless. ### Patches Library now used constant-time comparison. ### Workarounds No. ### For more information If you have any questions or comments about this advisory: * Open an issue in [totp-rs](https://github.com/constantoine/totp-rs) * Email us at [cleo.rebert@gmail.com](mailto:cleo.rebert@gmail.com)

CVE-2022-29185 Affected Totp rs Versions

1 component(s)
Fixed Versions:
1.1.0
Product / Package Ecosystem Affected Versions Fixed Version
totp-rs
crates.io
< 1.1.0
1.1.0

References

Frequently Asked Questions

What is CVE-2022-29185?
CVE-2022-29185 is a security vulnerability in Totp rs involving Observable Timing Discrepancy in totp-rs under CWE-203: Observable Discrepancy.
Which Totp rs versions are affected?
Affected versions include releases prior to 1.1.0 across affected packages: totp-rs.
What version fixes CVE-2022-29185?
Upgrading to 1.1.0 (or the latest patched release for your respective branch) resolves the vulnerability.
Is totp-rs affected?
Yes, totp-rs is affected in releases prior to 1.1.0. Upgrade your dependency to 1.1.0 or later.
What is the CVSS score of CVE-2022-29185?
CVE-2022-29185 has a CVSS v3.1 base score of 4.2 (MODERATE) with vector string CVSS:3.1/AV:N/AC:H/PR:H/UI:R/S:U/C:H/I:N/A:N.
What CWE is associated with CVE-2022-29185?
CVE-2022-29185 is classified under CWE-203: Observable Discrepancy (The product behaves differently or sends different responses under different circumstances in a way that is observable to an unauthorized actor.).
How can I check crates.io dependencies for CVE-2022-29185?
Run the dependency tree command: 'inspect dependencies for totp-rs'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "schema_version" : "1.4.0",
  "id" : "GHSA-8vxv-2g8p-2249",
  "modified" : "2022-05-24T21:33:15Z",
  "published" : "2022-05-24T21:33:15Z",
  "aliases" : [ "CVE-2022-29185" ],
  "summary" : "Observable Timing Discrepancy in totp-rs",
  "details" : "### Impact\nToken comparison was not constant time, and could theorically be used to guess value of an TOTP token, and thus reuse it in the same time window. The attacker would have to know the password beforehand nonetheless.\n\n### Patches\nLibrary now used constant-time comparison.\n\n### Workarounds\nNo.\n\n### For more information\nIf you have any questions or comments about this advisory:\n* Open an issue in [totp-rs](https://github.com/constantoine/totp-rs)\n* Email us at [cleo.rebert@gmail.com](mailto:cleo.rebert@gmail.com)\n",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:H/PR:H/UI:R/S:U/C:H/I:N/A:N"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "crates.io",
      "name" : "totp-rs"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "1.1.0"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/constantoine/totp-rs/security/advisories/GHSA-8vxv-2g8p-2249"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2022-29185"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/constantoine/totp-rs/issues/13"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/constantoine/totp-rs/commit/1f1e1a6fe722deb1656f483b1367ea4be978db5b"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/constantoine/totp-rs"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/constantoine/totp-rs/compare/v1.0...v1.1.0"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/constantoine/totp-rs/releases/tag/v1.1.0"
  }, {
    "type" : "WEB",
    "url" : "https://rustsec.org/advisories/RUSTSEC-2022-0018.html"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-203", "CWE-208" ],
    "severity" : "MODERATE",
    "github_reviewed" : true,
    "github_reviewed_at" : "2022-05-24T21:33:15Z",
    "nvd_published_at" : "2022-05-20T20:15:00Z"
  }
}