CVE-2021-28031 move_elements can double-free objects on panic
A double-free vulnerability in the Rust scratchpad crate allows attackers to cause denial of service or potentially execute code via a panic in a user-provided function.
- Exploited in the wild
- Not known
- Login needed
- Not needed
- Attackable
- Over the internet
- Victim action needed
- Not needed
- Fix
- Available
What is CVE-2021-28031?
CVE-2021-28031 is a critical use after free vulnerability in n/a, published on 5 Mar 2021. An attacker can exploit it over the internet without logging in, with no action from the victim.
Official description
An issue was discovered in the scratchpad crate before 1.3.1 for Rust. The move_elements function can have a double-free upon a panic in a user-provided f function.
Weakness: CWE-415
Which versions are affected by CVE-2021-28031?
3 open source packages ship an affected version, including scratchpad. It affects 1 product.
| Package | Affected | Fixed in |
|---|---|---|
scratchpad crates.io | All versions | 1.3.1 |
scratchpad crates.io | All versions | 1.3.1 |
scratchpad crates.io | From 0.0.0-0 | 1.3.1 |
Products include Scratchpad Project Scratchpad.
How do I fix CVE-2021-28031?
Upgrade scratchpad to 1.3.1 or later.
Upgrade to the fixed version. These bugs are found with fuzzing and sanitisers and avoided by memory-safe languages. More about Use after free.
Is CVE-2021-28031 being exploited?
There is no known exploitation of CVE-2021-28031 in the wild and no public exploit code.
Sources
Also known as GHSA-3qm2-rfqw-fmrw, RUSTSEC-2021-0030.