Ecosyste.ms: Advisories
An open API service providing security vulnerability metadata for many open source software ecosystems.
Security Advisories: GSA_kwCzR0hTQS0yZ3hqLXFycDItNTNqds0flA
Incorrect reliance on Trait memory layout in mopa
The mopa crate redefines the deprecated TraitObject struct from core::raw. 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.
Permalink: https://github.com/advisories/GHSA-2gxj-qrp2-53jvJSON: https://advisories.ecosyste.ms/api/v1/advisories/GSA_kwCzR0hTQS0yZ3hqLXFycDItNTNqds0flA
Source: GitHub Advisory Database
Origin: Unspecified
Severity: Critical
Classification: General
Published: almost 3 years ago
Updated: over 1 year ago
CVSS Score: 9.8
CVSS vector: CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H
Identifiers: GHSA-2gxj-qrp2-53jv, CVE-2021-45695
References:
- https://nvd.nist.gov/vuln/detail/CVE-2021-45695
- https://raw.githubusercontent.com/rustsec/advisory-db/main/crates/mopa/RUSTSEC-2021-0095.md
- https://rustsec.org/advisories/RUSTSEC-2021-0095.html
- https://github.com/chris-morgan/mopa/issues/13
- https://github.com/advisories/GHSA-2gxj-qrp2-53jv
Blast Radius: 27.3
Affected Packages
cargo:mopa
Dependent packages: 28Dependent repositories: 609
Downloads: 868,016 total
Affected Version Ranges: <= 0.2.2
No known fixed version
All affected versions: 0.1.0, 0.1.1, 0.1.2, 0.1.3, 0.1.4, 0.1.5, 0.1.6, 0.1.7, 0.1.8, 0.2.0, 0.2.1, 0.2.2