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 package | Versions | Reported by |
|---|---|---|
| Unspecified product | n/a | CVE List |
| scratchpad (crates.io) | before 1.3.1, from 0.0.0-0 before 1.3.1 | GitHub Advisory Database, RustSec Advisory Database |
| scratchpad_project scratchpad | before 1.3.1 | NVD |
All scores
| GitHub | 9.8critical CVSS:3.1 | CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H |
| RustSec Advisory Database | 9.8critical CVSS:3.1 | CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H |
| NVD | 9.8critical CVSS:3.1 | CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H |
| NVD | 7.5high CVSS:2.0 | AV: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
| https://rustsec.org/advisories/RUSTSEC-2021-0030.html | advisory, patch, third-party-advisory, web | |
| https://nvd.nist.gov/vuln/detail/CVE-2021-28031 | advisory | |
| https://github.com/okready/scratchpad/issues/1 | report, web | |
| https://github.com/okready/scratchpad/commit/891561bea | web | |
| https://github.com/okready/scratchpad | package | |
| https://crates.io/crates/scratchpad | package | |
Sources
| Source | Record | Licence |
|---|---|---|
| CVE List | CVE-2021-28031 changed 2024-08-03 | CVE Terms of Use |
| GitHub Advisory Database | GHSA-3qm2-rfqw-fmrw changed 2023-11-08 | CC-BY-4.0 |
| RustSec Advisory Database | RUSTSEC-2021-0030 changed 2023-11-08 | CC0-1.0 |
| NVD | CVE-2021-28031 changed 2026-06-17 | Public domain |