GHSA-2rxc-gjrp-vjhx: Anstream Unsoundness Vulnerability

MODERATE
Published
Advisory Summary

GHSA-2rxc-gjrp-vjhx is a MODERATE unsoundness vulnerability (General Security Weakness) affecting Anstream libraries in the crates.io ecosystem. The issue involves unsoundness in anstream. Remediation is available by upgrading affected packages to version 0.6.8.

GHSA-2rxc-gjrp-vjhx at a Glance

CVE Identifier N/A
GHSA Identifier GHSA-2rxc-gjrp-vjhx
Severity MODERATE
CVSS v3.1 Base Score N/A
CWE Classification General Security Weakness
Affected Product Anstream
Package Ecosystem crates.io
Published Date
Last Updated

How to Fix GHSA-2rxc-gjrp-vjhx

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

anstream fixed: 0.6.8
Upgrade anstream to 0.6.8
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 anstream

How to Check if You Are Affected

To determine whether your application is affected by GHSA-2rxc-gjrp-vjhx, inspect your project dependencies for Anstream:

inspect dependencies for anstream

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

When given a valid UTF8 string "รถ\x1b๐Ÿ˜€", the function in crates/anstream/src/adapter/strip.rs will be confused. The UTF8 bytes are \xc3\xb6 then \x1b then \xf0\x9f\x98\x80. When looping over "non-printable bytes" \x1b\xf0 will be considered as some non-printable sequence. This will produce a broken str from the incorrectly segmented bytes via str::from_utf8_unchecked, and that should never happen. Full credit goes to @Ralith who reviewed this code and asked @burakemir to follow up.

GHSA-2rxc-gjrp-vjhx Affected Anstream Versions

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

References

Frequently Asked Questions

What is GHSA-2rxc-gjrp-vjhx?
GHSA-2rxc-gjrp-vjhx is a security vulnerability in Anstream involving Unsoundness in anstream under General Security Weakness.
Which Anstream versions are affected?
Affected versions include releases prior to 0.6.8 across affected packages: anstream.
What version fixes GHSA-2rxc-gjrp-vjhx?
Upgrading to 0.6.8 (or the latest patched release for your respective branch) resolves the vulnerability.
Is anstream affected?
Yes, anstream is affected in releases prior to 0.6.8. Upgrade your dependency to 0.6.8 or later.
What CWE is associated with GHSA-2rxc-gjrp-vjhx?
GHSA-2rxc-gjrp-vjhx is classified under General Security Weakness.
How can I check crates.io dependencies for GHSA-2rxc-gjrp-vjhx?
Run the dependency tree command: 'inspect dependencies for anstream'. 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-2rxc-gjrp-vjhx",
  "modified" : "2024-12-04T18:31:31Z",
  "published" : "2024-12-04T18:31:31Z",
  "aliases" : [ ],
  "summary" : "Unsoundness in anstream",
  "details" : "When given a valid UTF8 string \"รถ\\x1b๐Ÿ˜€\", the function in crates/anstream/src/adapter/strip.rs will be confused. The UTF8 bytes are \\xc3\\xb6 then \\x1b then \\xf0\\x9f\\x98\\x80.\n\nWhen looping over \"non-printable bytes\" \\x1b\\xf0 will be considered as some non-printable sequence.\n\nThis will produce a broken str from the incorrectly segmented bytes via str::from_utf8_unchecked, and that should never happen.\n\nFull credit goes to @Ralith who reviewed this code and asked @burakemir to follow up.",
  "severity" : [ ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "crates.io",
      "name" : "anstream"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "0.6.8"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/rust-cli/anstyle/issues/156"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/rust-cli/anstyle"
  }, {
    "type" : "WEB",
    "url" : "https://rustsec.org/advisories/RUSTSEC-2024-0404.html"
  } ],
  "database_specific" : {
    "cwe_ids" : [ ],
    "severity" : "MODERATE",
    "github_reviewed" : true,
    "github_reviewed_at" : "2024-12-04T18:31:31Z",
    "nvd_published_at" : null
  }
}