GHSA-gfgm-chr3-x6px: prettytable-rs Remote Code Execution Vulnerability

MODERATE
Published
Advisory Summary

GHSA-gfgm-chr3-x6px is a MODERATE remote code execution vulnerability (General Security Weakness) affecting prettytable-rs libraries in the crates.io ecosystem. The issue involves force cast a &vec<t> to &[t] may lead to undefined behavior. Remediation is available by upgrading affected packages to version 0.10.0.

GHSA-gfgm-chr3-x6px at a Glance

CVE Identifier N/A
GHSA Identifier GHSA-gfgm-chr3-x6px
Severity MODERATE
CVSS v3.1 Base Score N/A
CWE Classification General Security Weakness
Affected Product prettytable-rs
Package Ecosystem crates.io
Published Date
Last Updated

How to Fix GHSA-gfgm-chr3-x6px

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

prettytable-rs fixed: 0.10.0
Upgrade prettytable-rs to 0.10.0
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 prettytable-rs

How to Check if You Are Affected

To determine whether your application is affected by GHSA-gfgm-chr3-x6px, inspect your project dependencies for prettytable-rs:

inspect dependencies for prettytable-rs

Analyze the terminal output to locate any version of prettytable-rs in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 0.10.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 General Security Weakness. In prettytable-rs, 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 function `Table::as_ref`, a reference of vector is force cast to slice. There are multiple problems here: 1. To guarantee the size is correct, we have to first do `Vec::shrink_to_fit`. The function requires a mutable reference, so we have to force cast from immutable to mutable, which is undefined behavior (UB). 2. Even if (1) is sound, `&Vec<T>` and `&[T]` still might not have the same layout. Treating them equally may lead to undefinted behavior (UB).

GHSA-gfgm-chr3-x6px Affected prettytable-rs Versions

1 component(s)
Fixed Versions:
0.10.0
Product / Package Ecosystem Affected Versions Fixed Version
prettytable-rs
crates.io
< 0.10.0
0.10.0

References

Frequently Asked Questions

What is GHSA-gfgm-chr3-x6px?
GHSA-gfgm-chr3-x6px is a security vulnerability in prettytable-rs involving Force cast a &Vec<T> to &[T] may lead to undefined behavior under General Security Weakness.
Which prettytable-rs versions are affected?
Affected versions include releases prior to 0.10.0 across affected packages: prettytable-rs.
What version fixes GHSA-gfgm-chr3-x6px?
Upgrading to 0.10.0 (or the latest patched release for your respective branch) resolves the vulnerability.
Is prettytable-rs affected?
Yes, prettytable-rs is affected in releases prior to 0.10.0. Upgrade your dependency to 0.10.0 or later.
What CWE is associated with GHSA-gfgm-chr3-x6px?
GHSA-gfgm-chr3-x6px is classified under General Security Weakness.
How can I check crates.io dependencies for GHSA-gfgm-chr3-x6px?
Run the dependency tree command: 'inspect dependencies for prettytable-rs'. 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-gfgm-chr3-x6px",
  "modified" : "2022-12-30T17:48:30Z",
  "published" : "2022-12-30T17:48:30Z",
  "aliases" : [ ],
  "summary" : "prettytable-rs: Force cast a &Vec<T> to &[T] may lead to undefined behavior",
  "details" : "In function `Table::as_ref`, a reference of vector is force cast to slice. There are multiple problems here:\n1. To guarantee the size is correct, we have to first do `Vec::shrink_to_fit`. The function requires a mutable reference, so we have to force cast from immutable to mutable, which is undefined behavior (UB).\n2. Even if (1) is sound, `&Vec<T>` and `&[T]` still might not have the same layout. Treating them equally may lead to undefinted behavior (UB).\n",
  "severity" : [ ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "crates.io",
      "name" : "prettytable-rs"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "0.10.0"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/phsym/prettytable-rs/issues/145"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/phsym/prettytable-rs"
  }, {
    "type" : "WEB",
    "url" : "https://rustsec.org/advisories/RUSTSEC-2022-0074.html"
  } ],
  "database_specific" : {
    "cwe_ids" : [ ],
    "severity" : "MODERATE",
    "github_reviewed" : true,
    "github_reviewed_at" : "2022-12-30T17:48:30Z",
    "nvd_published_at" : null
  }
}