GHSA-8mv5-7x95-7wcf: Mopa `mopa` Is Technically Unsound Vulnerability

HIGH
Published
Advisory Summary

GHSA-8mv5-7x95-7wcf is a HIGH `mopa` is technically unsound vulnerability (General Security Weakness) affecting Mopa libraries in the crates.io ecosystem. The issue involves `mopa` is technically unsound. Remediation is available in the latest vendor maintenance releases.

GHSA-8mv5-7x95-7wcf at a Glance

CVE Identifier N/A
GHSA Identifier GHSA-8mv5-7x95-7wcf
Severity HIGH
CVSS v3.1 Base Score N/A
CWE Classification General Security Weakness
Affected Product Mopa
Package Ecosystem crates.io
Published Date
Last Updated

How to Fix GHSA-8mv5-7x95-7wcf

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

mopa fixed: Latest secure release
Upgrade mopa to Latest secure release
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 mopa

How to Check if You Are Affected

To determine whether your application is affected by GHSA-8mv5-7x95-7wcf, inspect your project dependencies for Mopa:

inspect dependencies for mopa

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

The `mopa` crate redefines the deprecated `TraitObject` struct from `core::raw` like so: ```rust #[repr(C)] #[derive(Copy, Clone)] #[doc(hidden)] pub struct TraitObject { pub data: *mut (), pub vtable: *mut (), } ``` This is done to then transmute a reference to a trait object (`&dyn Trait` for any trait `Trait`) into this struct and retrieve the `data` field for the purpose of downcasting. This is used to implement `downcast_ref_unchecked()`, in terms of which `downcast_ref()` is also implemented. Same goes for mutable reference downcasting and `Box` downcasting. The Rust compiler explicitly reserves the right to change the memory layout of `&dyn Trait` for any trait `Trait`. The worst case scenario is that it swaps `data` and `vtable`, making an executable location breach and compromisation of ASLR possible, since reads from `data` would read `vtable` instead. Likewise, arbitrary code execution is also theoretically possible if reads of `vtable` generated by the compiler read `data` instead. While, as of Rust 1.52, this unsound assumption still holds true, updating the compiler may silently create UB in a crate which previously compiled and run without issues, compromising the security of builds which are believed to be reproducible. A potential strategy to resolve this has already been suggested in an issue on the GitHub repository of the crate.

GHSA-8mv5-7x95-7wcf Affected Mopa Versions

1 component(s)
Product / Package Ecosystem Affected Versions Fixed Version
mopa
crates.io
≤ 0.2.2

References

Frequently Asked Questions

What is GHSA-8mv5-7x95-7wcf?
GHSA-8mv5-7x95-7wcf is a security vulnerability in Mopa involving `mopa` is technically unsound under General Security Weakness.
Which Mopa versions are affected?
Affected versions include releases prior to current release patches across affected packages: mopa.
What version fixes GHSA-8mv5-7x95-7wcf?
Upgrading to current release patches (or the latest patched release for your respective branch) resolves the vulnerability.
Is mopa affected?
Yes, mopa is affected in releases prior to Latest secure release. Upgrade your dependency to Latest secure release or later.
What CWE is associated with GHSA-8mv5-7x95-7wcf?
GHSA-8mv5-7x95-7wcf is classified under General Security Weakness.
How can I check crates.io dependencies for GHSA-8mv5-7x95-7wcf?
Run the dependency tree command: 'inspect dependencies for mopa'. 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-8mv5-7x95-7wcf",
  "modified" : "2023-06-13T18:35:51Z",
  "published" : "2022-06-17T00:12:33Z",
  "aliases" : [ ],
  "summary" : "`mopa` is technically unsound",
  "details" : "The `mopa` crate redefines the deprecated `TraitObject` struct from `core::raw` like so:\n```rust\n#[repr(C)]\n#[derive(Copy, Clone)]\n#[doc(hidden)]\npub struct TraitObject {\n    pub data: *mut (),\n    pub vtable: *mut (),\n}\n```\nThis is done to then transmute a reference to a trait object (`&dyn Trait` for any trait `Trait`) into this struct and retrieve the `data` field for the purpose of downcasting. This is used to implement `downcast_ref_unchecked()`, in terms of which `downcast_ref()` is also implemented. Same goes for mutable reference downcasting and `Box` downcasting.\n\nThe Rust compiler explicitly reserves the right to change the memory layout of `&dyn Trait` for any trait `Trait`. The worst case scenario is that it swaps `data` and `vtable`, making an executable location breach and compromisation of ASLR possible, since reads from `data` would read `vtable` instead. Likewise, arbitrary code execution is also theoretically possible if reads of `vtable` generated by the compiler read `data` instead.\n\nWhile, as of Rust 1.52, this unsound assumption still holds true, updating the compiler may silently create UB in a crate which previously compiled and run without issues, compromising the security of builds which are believed to be reproducible.\n\nA potential strategy to resolve this has already been suggested in an issue on the GitHub repository of the crate.",
  "severity" : [ ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "crates.io",
      "name" : "mopa"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "last_affected" : "0.2.2"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/chris-morgan/mopa/issues/13"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/chris-morgan/mopa"
  }, {
    "type" : "WEB",
    "url" : "https://rustsec.org/advisories/RUSTSEC-2021-0095.html"
  } ],
  "database_specific" : {
    "cwe_ids" : [ ],
    "severity" : "HIGH",
    "github_reviewed" : true,
    "github_reviewed_at" : "2022-06-17T00:12:33Z",
    "nvd_published_at" : null
  }
}