# CVE-2021-28031: move_elements can double-free objects on panic

- Severity: Critical 9.8 (CVSS:3.1, scored by NVD) `CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H`
- Known to be exploited: not in CISA's catalogue, which lists only what CISA has confirmed
- Likelihood of exploitation in the next 30 days (EPSS): 1.38%, higher than 72% of CVEs (2026-11-30)
- Published: 2021-02-18T12:00:00.000Z
- Modified: 2026-06-17T03:45:44.930Z
- Also known as: GHSA-3qm2-rfqw-fmrw, RUSTSEC-2021-0030
- Weaknesses: CWE-415
- Assigned by: mitre

## 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.

(As written by CVE List.)

## Affected

- Unspecified product: n/a
- scratchpad (crates.io): before 1.3.1; from 0.0.0-0 before 1.3.1
- scratchpad_project scratchpad: before 1.3.1

## Every score

- GitHub: CVSS:3.1 9.8 Critical `CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H`
- RustSec Advisory Database: CVSS:3.1 9.8 Critical `CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H`
- NVD: CVSS:3.1 9.8 Critical `CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H`
- NVD: CVSS:2.0 7.5 High `AV:N/AC:L/Au:N/C:P/I:P/A:P`

## 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

- CVE List: [CVE-2021-28031](https://www.cve.org/CVERecord?id=CVE-2021-28031), CVE Terms of Use, modified 2024-08-03
- GitHub Advisory Database: [GHSA-3qm2-rfqw-fmrw](https://github.com/advisories/GHSA-3qm2-rfqw-fmrw), CC-BY-4.0, modified 2023-11-08
- RustSec Advisory Database: [RUSTSEC-2021-0030](https://rustsec.org/advisories/RUSTSEC-2021-0030.html), CC0-1.0, modified 2023-11-08
- NVD: [CVE-2021-28031](https://nvd.nist.gov/vuln/detail/CVE-2021-28031), Public domain, modified 2026-06-17

---

Page: https://cve.day/CVE-2021-28031 · Whole record: https://cve.day/CVE-2021-28031.json · Rebuilt by cve.day 2026-11-25T22:58:00.154Z
