{"id":"GHSA-x6j6-3ffp-qrfr","aliases":["GHSA-x6j6-3ffp-qrfr","RUSTSEC-2026-0300"],"related":[],"kind":"vulnerability","state":"published","title":"Use-after-free in `clear` and `retain` when an element's `Drop` panics","summary":"`SkipList::clear` drops the node chain and only then resets `tail` and `len`.\nThe drop runs each element's `Drop`, and `T` carries no bounds excluding a\npanicking one. If it unwinds, `tail` still points at the freed node while `len`\nstays non-zero.\n\n`back()`, `back_mut()`, `last_key_value()` and `last()` dereference `tail`\nthrough `unsafe`, so reading the container after the unwind is a use-after-free\n(CWE-416). `Drop for SkipList` calls `Box::from_raw` on `self.head`, which\n`clear` already destroyed, so dropping the container is a double free\n(CWE-415).\n\n`retain`, `retain_mut` and `dedup_by` reach the same state through\n`Node::filter_rebuild`, which frees nodes and runs a user predicate before the\ncaller commits `tail` and `len`. There the head links are left partially\nrewired, so traversal can also reach freed nodes.\n\n## Mitigation\n\nUpdate to 1.1.1.","summaryFormat":"markdown","summarySource":"rustsec","descriptions":[{"lang":"en","text":"`SkipList::clear` drops the node chain and only then resets `tail` and `len`.\nThe drop runs each element's `Drop`, and `T` carries no bounds excluding a\npanicking one. If it unwinds, `tail` still points at the freed node while `len`\nstays non-zero.\n\n`back()`, `back_mut()`, `last_key_value()` and `last()` dereference `tail`\nthrough `unsafe`, so reading the container after the unwind is a use-after-free\n(CWE-416). `Drop for SkipList` calls `Box::from_raw` on `self.head`, which\n`clear` already destroyed, so dropping the container is a double free\n(CWE-415).\n\n`retain`, `retain_mut` and `dedup_by` reach the same state through\n`Node::filter_rebuild`, which frees nodes and runs a user predicate before the\ncaller commits `tail` and `len`. There the head links are left partially\nrewired, so traversal can also reach freed nodes.\n\n## Mitigation\n\nUpdate to 1.1.1.","format":"markdown","source":"rustsec"}],"published":"2026-09-02T12:00:00.000Z","modified":"2026-09-22T07:45:03.895Z","severities":[],"cwes":[],"affected":[{"ranges":[{"type":"semver","introduced":"0.0.0-0","status":"affected","fixed":"1.1.1"}],"ecosystem":"crates.io","package":"skiplist","purl":"pkg:cargo/skiplist","source":"rustsec"}],"references":[{"url":"https://crates.io/crates/skiplist","tags":["package"],"sources":["rustsec"]},{"url":"https://rustsec.org/advisories/RUSTSEC-2026-0300.html","tags":["advisory"],"sources":["rustsec"]},{"url":"https://github.com/JP-Ellis/rust-skiplist/pull/334","tags":["web"],"sources":["rustsec"]}],"credits":[],"sources":[{"source":"rustsec","name":"RustSec Advisory Database","id":"RUSTSEC-2026-0300","url":"https://rustsec.org/advisories/RUSTSEC-2026-0300.html","licence":"CC0-1.0","modified":"2026-09-22T07:45:03.895Z"}],"updatedAt":"2026-11-25T22:56:43.412Z"}