CVE-2021-28031
JSON

9.8critical

move_elements can double-free objects on panic

Severity
9.8critical CVSS:3.1 by NVD
Exploit likelihood
1.38% (higher than 72% of CVEs)
Published
Last changed
Assigned by
mitre
Also known as
GHSA-3qm2-rfqw-fmrwRUSTSEC-2021-0030

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.

Affected

Product or packageVersionsReported by
Unspecified productn/aCVE List
scratchpad (crates.io)before 1.3.1, from 0.0.0-0 before 1.3.1GitHub Advisory Database, RustSec Advisory Database
scratchpad_project scratchpadbefore 1.3.1NVD

All scores

GitHub9.8critical CVSS:3.1CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H
RustSec Advisory Database9.8critical CVSS:3.1CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H
NVD9.8critical CVSS:3.1CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H
NVD7.5high CVSS:2.0AV:N/AC:L/Au:N/C:P/I:P/A:P

Classification

What each source says

CVE List

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.

GitHub Advisory Database

Affected versions of scratchpad used ptr::read to read elements while calling a user provided function f on them. Since the pointer read duplicates ownership, a panic inside the user provided f function could cause a double free when unwinding.

The flaw was fixed in commit 891561bea by removing the unsafe block and using a plain iterator.

RustSec Advisory Database

Affected versions of scratchpad used ptr::read to read elements while calling a user provided function f on them.

Since the pointer read duplicates ownership, a panic inside the user provided f function could cause a double free when unwinding.

The flaw was fixed in commit 891561bea by removing the unsafe block and using a plain iterator.

NVD (es)

Se detectó un problema en la crate scratchpad versiones anteriores a 1.3.1 para Rust. La función move_elements puede tener una doble liberación tras un pánico en una función f proporcionada por el usuario

References

Sources

SourceRecordLicence
CVE ListCVE-2021-28031 changed 2024-08-03CVE Terms of Use
GitHub Advisory DatabaseGHSA-3qm2-rfqw-fmrw changed 2023-11-08CC-BY-4.0
RustSec Advisory DatabaseRUSTSEC-2021-0030 changed 2023-11-08CC0-1.0
NVDCVE-2021-28031 changed 2026-06-17Public domain