Vulnerability DatabaseGHSA-q7pr-3hx6-cgc4

GHSA-q7pr-3hx6-cgc4: 
Rust vulnerability analysis and mitigation

Details

From<Cow<'_, [Item]>> for SmallVec<Item, INLINE, Global> adopts the pointer, length, and capacity of the Cow::Owned Vec, then returns. It does not stop that Vec from being dropped. The Vec frees the allocation and drops its elements before the returned SmallVec can be used or dropped. Ordinary use of the returned SmallVec can read freed memory; dropping it can free the same allocation again. Affected source in the published tag: https://github.com/smallvec/smallvec/blob/v2.0.0-beta.5/src/conversions.rs#L333-L351 The existing From<Vec<Item>> for SmallVec<Item, INLINE> implementation handles ownership transfer and capacity invariants. Changing the owned arm to Cow::Owned(vector) => vector.into() made the saved test pass. This is a suggested direction, not a complete upstream fix review.

Reproduction

Add this as tests/cow_owned_transfer.rs to the unmodified v2.0.0-beta.5 source, then run cargo test --test cow_owned_transfer -- --nocapture. The test uses ManuallyDrop so it can observe the premature element drops without deliberately dropping the dangling returned vector on the failure path.

use smallvec::SmallVec;
use std::borrow::Cow;
use std::mem::ManuallyDrop;
use std::sync::{Arc, atomic::{AtomicUsize, Ordering}};
#[derive(Clone)]
struct Witness(Arc<AtomicUsize>);
impl Drop for Witness {
    fn drop(&mut self) {
        self.0.fetch_add(1, Ordering::SeqCst);
    }
}
#[test]
fn owned_cow_transfers_elements_once() {
    let drops = Arc::new(AtomicUsize::new(0));
    let mut vec = Vec::with_capacity(8);
    for _ in 0..3 {
        vec.push(Witness(Arc::clone(&drops)));
    }
    let mut converted = ManuallyDrop::new(SmallVec::<Witness, 4>::from(Cow::Owned(vec)));
    assert_eq!(drops.load(Ordering::SeqCst), 0, "Cow::Owned elements dropped during conversion");
    unsafe { ManuallyDrop::drop(&mut converted) };
    assert_eq!(drops.load(Ordering::SeqCst), 3);
}

On the affected source, the saved run exited 101 and observed all three Witness destructors before the returned SmallVec was dropped. With the one-line ownership-transfer change, the same assertion passed.

Impact and limits

Any safe caller converting an owned Cow<[T]> to SmallVec<T, N> can receive a dangling vector. This can cause memory corruption, a crash, or unintended reads when the value is used or dropped. The saved proof establishes premature destruction and the ownership error; it does not execute a second free or show a remote exploit. I found no public issue or advisory covering this conversion in a targeted search, but a private report may already exist. Research credit: Aaron Elijah Mars of Aeon. Please credit both @aeonframework and @aaronjmars on publication.


Source: NVD

Related Rust vulnerabilities:

CVE ID

Severity

Score

Technologies

Component name

CISA KEV exploit

Has fix

Published date

CVE-2026-134056HIGH8.3
  • Rust logoRust
  • aws-lc-fips-sys
NoYesNov 23, 2026
GHSA-8wcq-xq25-7fhmMEDIUM6.5
  • Rust logoRust
  • cookie
NoYesNov 23, 2026
GHSA-2rx9-36wh-cm54MEDIUM5.3
  • Rust logoRust
  • gix
NoNoNov 23, 2026
GHSA-j5gm-p573-w4wqLOW2.2
  • Rust logoRust
  • gix
NoNoNov 23, 2026
GHSA-q7pr-3hx6-cgc4HIGHN/A
  • Rust logoRust
  • smallvec
NoNoNov 23, 2026

Free Vulnerability Assessment

Benchmark your Cloud Security Posture

Evaluate your cloud security practices across 9 security domains to benchmark your risk level and identify gaps in your defenses.

Request assessment

Additional Wiz resources

Get a personalized demo

Ready to see Wiz in action?

"Best User Experience I have ever seen, provides full visibility to cloud workloads."
David EstlickCISO
"Wiz provides a single pane of glass to see what is going on in our cloud environments."
Adam FletcherChief Security Officer
"We know that if Wiz identifies something as critical, it actually is."
Greg PoniatowskiHead of Threat and Vulnerability Management