GHSA-c8v3-jhv9-4ppc: Rust i18n support Use-after-free When Setting The Locale Vulnerability

MODERATE
CWE-416
Published
Advisory Summary

GHSA-c8v3-jhv9-4ppc is a MODERATE use-after-free when setting the locale vulnerability (CWE-416: Use After Free) affecting Rust i18n support libraries in the crates.io ecosystem. The issue involves use-after-free when setting the locale. Remediation is available by upgrading affected packages to version 3.0.1.

GHSA-c8v3-jhv9-4ppc at a Glance

CVE Identifier N/A
GHSA Identifier GHSA-c8v3-jhv9-4ppc
Severity MODERATE
CVSS v3.1 Base Score N/A
CWE Classification CWE-416: Use After Free
Affected Product Rust i18n support
Package Ecosystem crates.io
Published Date
Last Updated

How to Fix GHSA-c8v3-jhv9-4ppc

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

rust-i18n-support fixed: 3.0.1
Upgrade rust-i18n-support to 3.0.1
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 rust-i18n-support

How to Check if You Are Affected

To determine whether your application is affected by GHSA-c8v3-jhv9-4ppc, inspect your project dependencies for Rust i18n support:

inspect dependencies for rust-i18n-support

Analyze the terminal output to locate any version of Rust i18n support in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 3.0.1), 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-416: Use After Free, where the product reuses or references memory after it has been freed. at some point afterward, the memory may be allocated again and saved in another pointer, while the original pointer references a location somewhere within the new allocation. any operations using the original pointer are no longer valid because the memory "belongs" to the code that operates on the new pointer. In Rust i18n support, 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

Version 3.0.0 introduced an `AtomicStr` type, that is used to store the current locale. It stores the locale as a raw pointer to an `Arc<String>`. The locale can be read with `AtomicStr::as_str()`. `AtomicStr::as_str()` does not increment the usage counter of the `Arc`. If the locale is changed in one thread, another thread can have a stale -- possibly already freed -- reference to the stored string.

GHSA-c8v3-jhv9-4ppc Affected Rust i18n support Versions

1 component(s)
Fixed Versions:
3.0.1
Product / Package Ecosystem Affected Versions Fixed Version
rust-i18n-support
crates.io
≥ 3.0.0
< 3.0.1
3.0.1

References

Frequently Asked Questions

What is GHSA-c8v3-jhv9-4ppc?
GHSA-c8v3-jhv9-4ppc is a security vulnerability in Rust i18n support involving Use-after-free when setting the locale under CWE-416: Use After Free.
Which Rust i18n support versions are affected?
Affected versions include releases prior to 3.0.1 across affected packages: rust-i18n-support.
What version fixes GHSA-c8v3-jhv9-4ppc?
Upgrading to 3.0.1 (or the latest patched release for your respective branch) resolves the vulnerability.
Is rust-i18n-support affected?
Yes, rust-i18n-support is affected in releases prior to 3.0.1. Upgrade your dependency to 3.0.1 or later.
What CWE is associated with GHSA-c8v3-jhv9-4ppc?
GHSA-c8v3-jhv9-4ppc is classified under CWE-416: Use After Free (The product reuses or references memory after it has been freed. At some point afterward, the memory may be allocated again and saved in another pointer, while the original pointer references a location somewhere within the new allocation. Any operations using the original pointer are no longer valid because the memory "belongs" to the code that operates on the new pointer.).
How can I check crates.io dependencies for GHSA-c8v3-jhv9-4ppc?
Run the dependency tree command: 'inspect dependencies for rust-i18n-support'. 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-c8v3-jhv9-4ppc",
  "modified" : "2024-01-23T20:10:48Z",
  "published" : "2024-01-23T20:10:48Z",
  "aliases" : [ ],
  "summary" : "Use-after-free when setting the locale",
  "details" : "Version 3.0.0 introduced an `AtomicStr` type, that is used to store the current locale. It stores the locale as a raw pointer to an `Arc<String>`. The locale can be read with `AtomicStr::as_str()`. `AtomicStr::as_str()` does not increment the usage counter of the `Arc`.\n\nIf the locale is changed in one thread, another thread can have a stale -- possibly already freed -- reference to the stored string.\n",
  "severity" : [ ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "crates.io",
      "name" : "rust-i18n-support"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "3.0.0"
      }, {
        "fixed" : "3.0.1"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/longbridgeapp/rust-i18n/issues/71"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/longbridgeapp/rust-i18n/commit/22e0609591a2c08930f52a0e6bc860f02a0e88c0"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/longbridgeapp/rust-i18n"
  }, {
    "type" : "WEB",
    "url" : "https://rustsec.org/advisories/RUSTSEC-2024-0007.html"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-416" ],
    "severity" : "MODERATE",
    "github_reviewed" : true,
    "github_reviewed_at" : "2024-01-23T20:10:48Z",
    "nvd_published_at" : null
  }
}