GHSA-7v4j-8wvr-v55r: Array macro `array!` Macro Is Unsound When Vulnerability

MODERATE
Published
Advisory Summary

GHSA-7v4j-8wvr-v55r is a MODERATE `array!` macro is unsound when vulnerability (General Security Weakness) affecting Array macro libraries in the crates.io ecosystem. The issue involves `array!` macro is unsound when its length is impure constant. Remediation is available by upgrading affected packages to version 2.1.2.

GHSA-7v4j-8wvr-v55r at a Glance

CVE Identifier N/A
GHSA Identifier GHSA-7v4j-8wvr-v55r
Severity MODERATE
CVSS v3.1 Base Score N/A
CWE Classification General Security Weakness
Affected Product Array macro
Package Ecosystem crates.io
Published Date
Last Updated

How to Fix GHSA-7v4j-8wvr-v55r

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

array-macro fixed: 2.1.2
Upgrade array-macro to 2.1.2
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 array-macro

How to Check if You Are Affected

To determine whether your application is affected by GHSA-7v4j-8wvr-v55r, inspect your project dependencies for Array macro:

inspect dependencies for array-macro

Analyze the terminal output to locate any version of Array macro in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 2.1.2), 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 General Security Weakness. In Array macro, 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

Affected versions of this crate did substitute the array length provided by an user at compile-time multiple times. When an impure constant expression is passed as an array length (such as a result of an impure procedural macro), this can result in the initialization of an array with uninitialized types, which in turn can allow an attacker to execute arbitrary code. The flaw was corrected in commit [d5b63f72](https://github.com/xfix/array-macro/commit/d5b63f72090f3809c21ac28f9cfd84f12559bf7d) by making sure that array length is substituted just once.

GHSA-7v4j-8wvr-v55r Affected Array macro Versions

1 component(s)
Fixed Versions:
2.1.2
Product / Package Ecosystem Affected Versions Fixed Version
array-macro
crates.io
≥ 2.1.0
< 2.1.2
2.1.2

References

Frequently Asked Questions

What is GHSA-7v4j-8wvr-v55r?
GHSA-7v4j-8wvr-v55r is a security vulnerability in Array macro involving `array!` macro is unsound when its length is impure constant under General Security Weakness.
Which Array macro versions are affected?
Affected versions include releases prior to 2.1.2 across affected packages: array-macro.
What version fixes GHSA-7v4j-8wvr-v55r?
Upgrading to 2.1.2 (or the latest patched release for your respective branch) resolves the vulnerability.
Is array-macro affected?
Yes, array-macro is affected in releases prior to 2.1.2. Upgrade your dependency to 2.1.2 or later.
What CWE is associated with GHSA-7v4j-8wvr-v55r?
GHSA-7v4j-8wvr-v55r is classified under General Security Weakness.
How can I check crates.io dependencies for GHSA-7v4j-8wvr-v55r?
Run the dependency tree command: 'inspect dependencies for array-macro'. 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-7v4j-8wvr-v55r",
  "modified" : "2022-06-20T18:24:00Z",
  "published" : "2022-06-16T23:40:38Z",
  "aliases" : [ ],
  "summary" : "`array!` macro is unsound when its length is impure constant",
  "details" : "Affected versions of this crate did substitute the array length provided by an user at compile-time multiple times.\n\nWhen an impure constant expression is passed as an array length (such as a result of an impure procedural macro), this can result in the initialization of an array with uninitialized types, which in turn can allow an attacker to execute arbitrary code.\n\nThe flaw was corrected in commit [d5b63f72](https://github.com/xfix/array-macro/commit/d5b63f72090f3809c21ac28f9cfd84f12559bf7d) by making sure that array length is substituted just once.\n",
  "severity" : [ ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "crates.io",
      "name" : "array-macro"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "2.1.0"
      }, {
        "fixed" : "2.1.2"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/xfix/array-macro/commit/d5b63f72090f3809c21ac28f9cfd84f12559bf7d"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/rustsec/advisory-db/blob/main/crates/array-macro/RUSTSEC-2022-0017.md"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/xfix/array-macro"
  }, {
    "type" : "WEB",
    "url" : "https://gitlab.com/KonradBorowski/array-macro/-/issues/5"
  }, {
    "type" : "WEB",
    "url" : "https://rustsec.org/advisories/RUSTSEC-2022-0017.html"
  } ],
  "database_specific" : {
    "cwe_ids" : [ ],
    "severity" : "MODERATE",
    "github_reviewed" : true,
    "github_reviewed_at" : "2022-06-16T23:40:38Z",
    "nvd_published_at" : null
  }
}