{"id":"CVE-2021-28031","aliases":["GHSA-3qm2-rfqw-fmrw","RUSTSEC-2021-0030"],"url":"https://o3.security/vulnerability/CVE-2021-28031","summary":"move_elements can double-free objects on panic","details":"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.\n\nThe flaw was fixed in commit `891561bea` by removing the unsafe block and using a plain iterator.","published":"2021-03-05T09:15:14.037Z","modified":"2026-10-24T10:30:37.441720400Z","cvss":{"score":9.8,"severity":"CRITICAL","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H"},"epss":null,"cisaKev":null,"exploitsKnown":0,"affectedPackages":[{"ecosystem":"crates.io","name":"scratchpad","fixedVersion":"1.3.1"}],"fix":{"url":"https://github.com/okready/scratchpad/commit/891561bea","label":"okready/scratchpad@891561b"},"references":[{"type":"FIX","url":"https://rustsec.org/advisories/RUSTSEC-2021-0030.html"},{"type":"ADVISORY","url":"https://nvd.nist.gov/vuln/detail/CVE-2021-28031"},{"type":"WEB","url":"https://github.com/okready/scratchpad/issues/1"},{"type":"WEB","url":"https://github.com/okready/scratchpad/commit/891561bea"},{"type":"PACKAGE","url":"https://github.com/okready/scratchpad"}],"provenance":{"sources":["OSV.dev","FIRST.org (EPSS)"],"lastVerified":"2026-10-24T10:30:37.441720400Z"}}