{"id":"CVE-2021-28031","aliases":["EUVD-2022-2235","GHSA-3qm2-rfqw-fmrw","RUSTSEC-2021-0030"],"status":"published","title":"move_elements can double-free objects on panic","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.","severity":{"version":"3.1","score":9.8,"vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H","level":"critical","assessor":"primary","from":"nvd"},"epss":{"day":"2026-11-10","score":0.01364,"percentile":0.72031,"model":"v2026.06.15"},"facts":{"in_kev":false,"known_exploited":false,"public_exploit":false,"fix_available":true},"cwes":["CWE-415"],"published":"2021-02-18T12:00:00Z","modified":"2026-10-24T10:30:37Z","fixes":[{"ecosystem":"crates.io","package":"scratchpad","fixed_in":["1.3.1"],"sources":["ghsa","osv"]}],"affected":[{"source":"ghsa","ecosystem":"crates.io","package":"scratchpad","ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"0"},{"fixed":"1.3.1"}]}]},{"source":"osv","ecosystem":"crates.io","package":"scratchpad","ranges":[{"type":"SEMVER","events":[{"introduced":"0"},{"fixed":"1.3.1"}]}]},{"source":"osv","ecosystem":"crates.io","package":"scratchpad","ranges":[{"type":"SEMVER","events":[{"introduced":"0.0.0-0"},{"fixed":"1.3.1"}]}]}],"products":[{"vendor":"scratchpad_project","product":"scratchpad"}],"references":[{"url":"https://rustsec.org/advisories/RUSTSEC-2021-0030.html","tags":["x_refsource_MISC","x_transferred","Patch","Third Party Advisory","fix","web","advisory"]},{"url":"https://nvd.nist.gov/vuln/detail/CVE-2021-28031","tags":["advisory"]},{"url":"https://github.com/okready/scratchpad/issues/1","tags":["web","report"]},{"url":"https://github.com/okready/scratchpad/commit/891561bea","tags":["web"]},{"url":"https://github.com/advisories/GHSA-3qm2-rfqw-fmrw"},{"url":"https://github.com/okready/scratchpad","tags":["package"]},{"url":"https://crates.io/crates/scratchpad","tags":["package"]}],"sources":{"cve":[{"id":"CVE-2021-28031","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.","status":"published","published":"2021-03-05T08:40:15Z","modified":"2024-08-03T21:33:17.105Z","updated_at":"2026-11-02T14:33:08.811269Z"}],"euvd":[{"id":"EUVD-2022-2235","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.","status":"published","published":"2021-03-05T08:40:15Z","modified":"2024-08-03T21:33:17Z","updated_at":"2026-11-03T03:24:47.350261Z"}],"ghsa":[{"id":"GHSA-3qm2-rfqw-fmrw","title":"move_elements can double-free objects on panic","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.\n\nThe flaw was fixed in commit `891561bea` by removing the unsafe block and using a plain iterator.","status":"published","published":"2022-05-24T17:43:48Z","modified":"2023-06-13T20:40:30Z","cvss":[{"version":"3.1","score":9.8,"vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H","level":"critical"}],"cwes":["CWE-415"],"updated_at":"2026-11-02T14:36:54.225318Z"}],"nvd":[{"id":"CVE-2021-28031","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.","status":"published","published":"2021-03-05T09:15:14.037Z","modified":"2026-06-17T03:45:44.93Z","cvss":[{"version":"3.1","score":9.8,"vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H","level":"critical","assessor":"primary"},{"version":"2.0","score":7.5,"vector":"AV:N/AC:L/Au:N/C:P/I:P/A:P","level":"high","assessor":"primary"}],"cwes":["CWE-415"],"updated_at":"2026-11-02T14:06:50.399901Z"}],"osv":[{"id":"CVE-2021-28031","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.","status":"published","published":"2021-03-05T09:15:14.037Z","modified":"2026-10-24T10:30:37.4417204Z","cvss":[{"version":"3.1","score":9.8,"vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H","level":"critical"}],"updated_at":"2026-11-02T15:44:19.129331Z"},{"id":"GHSA-3qm2-rfqw-fmrw","title":"move_elements can double-free objects on panic","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.\n\nThe flaw was fixed in commit `891561bea` by removing the unsafe block and using a plain iterator.","status":"published","published":"2022-05-24T17:43:48Z","modified":"2023-11-08T04:05:27.727053Z","cvss":[{"version":"3.1","score":9.8,"vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H","level":"critical"}],"cwes":["CWE-415"],"updated_at":"2026-11-02T15:46:36.092962Z"},{"id":"RUSTSEC-2021-0030","title":"move_elements can double-free objects on panic","description":"Affected versions of `scratchpad` used `ptr::read` to read elements while\ncalling a user provided function `f` on them.\n\nSince the pointer read duplicates ownership, a panic inside the user provided\n`f` function could cause a double free when unwinding.\n\nThe flaw was fixed in commit `891561bea` by removing the unsafe block and using\na plain iterator.","status":"published","published":"2021-02-18T12:00:00Z","modified":"2023-11-08T04:05:27.727053Z","cvss":[{"version":"3.1","score":9.8,"vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H","level":"critical"}],"updated_at":"2026-11-02T15:53:39.492624Z"}]}}
