GHSA-9hpw-r23r-xgm5: Thread local Data Race Vulnerability

HIGH
CWE-362
Published
Advisory Summary

GHSA-9hpw-r23r-xgm5 is a HIGH data race vulnerability (CWE-362: Concurrent Execution using Shared Resource with Improper Synchronization ('Race Condition')) affecting Thread local libraries in the crates.io ecosystem. The issue involves data race in `iter` and `itermut`. Remediation is available by upgrading affected packages to version 1.1.4.

GHSA-9hpw-r23r-xgm5 at a Glance

CVE Identifier N/A
GHSA Identifier GHSA-9hpw-r23r-xgm5
Severity HIGH
CVSS v3.1 Base Score N/A
CWE Classification CWE-362: Concurrent Execution using Shared Resource with Improper Synchronization ('Race Condition')
Affected Product Thread local
Package Ecosystem crates.io
Published Date
Last Updated

How to Fix GHSA-9hpw-r23r-xgm5

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

thread_local fixed: 1.1.4
Upgrade thread_local to 1.1.4
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 thread_local

How to Check if You Are Affected

To determine whether your application is affected by GHSA-9hpw-r23r-xgm5, inspect your project dependencies for Thread local:

inspect dependencies for thread_local

Analyze the terminal output to locate any version of Thread local in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 1.1.4), 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 Thread local, 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

In the affected version of this crate, `{Iter, IterMut}::next` used a weaker memory ordering when loading values than what was required, exposing a potential data race when iterating over a `ThreadLocal`'s values. Crates using `Iter::next`, or `IterMut::next` are affected by this issue.

GHSA-9hpw-r23r-xgm5 Affected Thread local Versions

1 component(s)
Fixed Versions:
1.1.4
Product / Package Ecosystem Affected Versions Fixed Version
thread_local
crates.io
< 1.1.4
1.1.4

References

Frequently Asked Questions

What is GHSA-9hpw-r23r-xgm5?
GHSA-9hpw-r23r-xgm5 is a security vulnerability in Thread local involving Data race in `Iter` and `IterMut` under CWE-362: Concurrent Execution using Shared Resource with Improper Synchronization ('Race Condition').
Which Thread local versions are affected?
Affected versions include releases prior to 1.1.4 across affected packages: thread_local.
What version fixes GHSA-9hpw-r23r-xgm5?
Upgrading to 1.1.4 (or the latest patched release for your respective branch) resolves the vulnerability.
Is thread_local affected?
Yes, thread_local is affected in releases prior to 1.1.4. Upgrade your dependency to 1.1.4 or later.
What CWE is associated with GHSA-9hpw-r23r-xgm5?
GHSA-9hpw-r23r-xgm5 is classified under CWE-362: Concurrent Execution using Shared Resource with Improper Synchronization ('Race Condition') (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.).
How can I check crates.io dependencies for GHSA-9hpw-r23r-xgm5?
Run the dependency tree command: 'inspect dependencies for thread_local'. 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-9hpw-r23r-xgm5",
  "modified" : "2022-06-17T00:25:46Z",
  "published" : "2022-06-17T00:25:46Z",
  "aliases" : [ ],
  "summary" : "Data race in `Iter` and `IterMut`",
  "details" : "In the affected version of this crate, `{Iter, IterMut}::next` used a weaker memory ordering when loading values than what was required, exposing a potential data race\nwhen iterating over a `ThreadLocal`'s values.\n\nCrates using `Iter::next`, or `IterMut::next` are affected by this issue.\n",
  "severity" : [ ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "crates.io",
      "name" : "thread_local"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "1.1.4"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/Amanieu/thread_local-rs/issues/33"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/Amanieu/thread_local-rs"
  }, {
    "type" : "WEB",
    "url" : "https://rustsec.org/advisories/RUSTSEC-2022-0006.html"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-362" ],
    "severity" : "HIGH",
    "github_reviewed" : true,
    "github_reviewed_at" : "2022-06-17T00:25:46Z",
    "nvd_published_at" : null
  }
}