Skip to content

move_elements can double-free objects on panic

Critical severity GitHub Reviewed Published May 24, 2022 to the GitHub Advisory Database • Updated Jun 13, 2023

Package

cargo scratchpad (Rust)

Affected versions

< 1.3.1

Patched versions

1.3.1

Description

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.

References

Published by the National Vulnerability Database Mar 5, 2021
Published to the GitHub Advisory Database May 24, 2022
Reviewed Jun 17, 2022
Last updated Jun 13, 2023

Severity

Critical
9.8
/ 10

CVSS base metrics

Attack vector
Network
Attack complexity
Low
Privileges required
None
User interaction
None
Scope
Unchanged
Confidentiality
High
Integrity
High
Availability
High
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H

Weaknesses

CVE ID

CVE-2021-28031

GHSA ID

GHSA-3qm2-rfqw-fmrw

Source code

Loading Checking history
See something to contribute? Suggest improvements for this vulnerability.