Vulnerability DatabaseRUSTSEC-2021-0042

RUSTSEC-2021-0042
Rust vulnerability analysis and mitigation

Overview

An issue was discovered in the insert_many crate through 2021-01-26 for Rust, identified as RUSTSEC-2021-0042 (CVE-2021-29933). The vulnerability involves a potential double-free condition where elements may be dropped twice if a .next() method panics during element insertion operations (Rust Advisory).

Technical details

The vulnerability stems from an implementation flaw in the insert_many crate where the impl_veclike macro performs unsafe operations during element insertion. The issue occurs when ptr::copy is used to push elements for insertion, which can duplicate items in the Vec before calling iter.next(). If iter.next() panics during this operation, the copied elements can be dropped twice, leading to a double-free condition. The vulnerability has been assigned a CVSS v3.1 base score of 7.5 (HIGH) with a vector of CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H (NVD Database).

Impact

The vulnerability can result in memory corruption due to double-free operations, which could potentially lead to program crashes or undefined behavior. This is particularly concerning in memory-safe Rust programs where such issues should be prevented by the compiler (GitHub Issue).

Exploitability

The vulnerability can be triggered when using the insert_many operation with an iterator that panics during execution. A proof-of-concept exploit has been demonstrated using a custom iterator implementation that intentionally panics during the next() operation (GitHub Issue).

Mitigation and workarounds

The recommended mitigation is to wrap the vector in ManuallyDrop while performing these operations to prevent the double-free condition. Users should update to a version newer than 2021-01-26 or implement the suggested workaround (GitHub Issue).

Additional resources


SourceThis report was generated using AI

Related Rust vulnerabilities:

CVE ID

Severity

Score

Technologies

Component name

CISA KEV exploit

Has fix

Published date

CVE-2026-46369HIGH7.5
  • Rust logoRust
  • nimiq-blockchain
NoYesAug 12, 2026
CVE-2026-73430MEDIUM5.3
  • Rust logoRust
  • russh
NoYesAug 12, 2026
CVE-2026-73429MEDIUM5.3
  • Rust logoRust
  • russh
NoYesAug 12, 2026
RUSTSEC-2026-0256NONEN/A
  • Rust logoRust
  • circular-buffer
NoYesAug 11, 2026
RUSTSEC-2026-0255NONEN/A
  • Rust logoRust
  • sized-chunks
NoNoAug 11, 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

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