CVE-2021-45704: Metrics util Out-of-bounds Write And Race Condition Vulnerability
HIGHCVE-2021-45704 is a HIGH (CVSS 8.1) out-of-bounds write and race condition vulnerability (CWE-362: Concurrent Execution using Shared Resource with Improper Synchronization ('Race Condition')) affecting Metrics util libraries in the crates.io ecosystem. The issue involves out-of-bounds write and race condition in metrics-util. Remediation is available by upgrading affected packages to version 0.7.0.
CVE-2021-45704 at a Glance
Security Impact
CVSS: 8.1
The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:H).
How to Fix CVE-2021-45704
To remediate this vulnerability, upgrade all affected Metrics util dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.
Upgrade metrics-util to 0.7.0
Run the following command in your project directory to verify that all resolved dependencies use the patched release:
inspect dependencies for metrics-util
How to Check if You Are Affected
To determine whether your application is affected by CVE-2021-45704, inspect your project dependencies for Metrics util:
inspect dependencies for metrics-util
Analyze the terminal output to locate any version of Metrics util in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 0.7.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-362: Concurrent Execution using Shared Resource with Improper Synchronization ('Race Condition'), where the product contains a concurrent code sequence that requires temporary, exclusive access to a shared resource, but a timing window exists in which the shared resource can be modified by another code sequence operating concurrently. In Metrics util, 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
CVE-2021-45704 Affected Metrics util Versions
1 component(s)| Product / Package | Ecosystem | Affected Versions | Fixed Version |
|---|---|---|---|
|
metrics-util
|
crates.io |
< 0.7.0
|
0.7.0
|
References
Frequently Asked Questions
What is CVE-2021-45704?
Which Metrics util versions are affected?
What version fixes CVE-2021-45704?
Is metrics-util affected?
What is the CVSS score of CVE-2021-45704?
What CWE is associated with CVE-2021-45704?
How can I check crates.io dependencies for CVE-2021-45704?
Machine-readable OSV JSON
OSV v1.5 Schema
{
"schema_version" : "1.4.0",
"id" : "GHSA-cwvc-87xq-pc5m",
"modified" : "2023-06-13T18:14:16Z",
"published" : "2022-01-06T22:08:43Z",
"aliases" : [ "CVE-2021-45704" ],
"summary" : "Out-of-bounds Write and Race Condition in metrics-util",
"details" : "In the affected versions of the crate, AtomicBucket<T> unconditionally implements Send/Sync traits. Therefore, users can create a data race to the inner T: !Sync by using the AtomicBucket::data_with() API. Such data races can potentially cause memory corruption or other undefined behavior.\n\nThe flaw was fixed in commit 8e6daab by adding appropriate Send/Sync bounds to the Send/Sync impl of struct Block<T> (which is a data type contained inside AtomicBucket<T>).",
"severity" : [ {
"type" : "CVSS_V3",
"score" : "CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:H"
} ],
"affected" : [ {
"package" : {
"ecosystem" : "crates.io",
"name" : "metrics-util"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "0"
}, {
"fixed" : "0.7.0"
} ]
} ]
} ],
"references" : [ {
"type" : "ADVISORY",
"url" : "https://nvd.nist.gov/vuln/detail/CVE-2021-45704"
}, {
"type" : "WEB",
"url" : "https://github.com/metrics-rs/metrics/issues/190"
}, {
"type" : "WEB",
"url" : "https://github.com/metrics-rs/metrics/commit/8e6daab"
}, {
"type" : "PACKAGE",
"url" : "https://github.com/metrics-rs/metrics"
}, {
"type" : "WEB",
"url" : "https://raw.githubusercontent.com/rustsec/advisory-db/main/crates/metrics-util/RUSTSEC-2021-0113.md"
}, {
"type" : "WEB",
"url" : "https://rustsec.org/advisories/RUSTSEC-2021-0113.html"
} ],
"database_specific" : {
"cwe_ids" : [ "CWE-362", "CWE-787" ],
"severity" : "HIGH",
"github_reviewed" : true,
"github_reviewed_at" : "2022-01-05T23:21:30Z",
"nvd_published_at" : "2021-12-27T00:15:00Z"
}
}