# GHSA-rvr2-r3pv-5m4p: oneshot has potential Use After Free when used asynchronously

- Severity: High (CVSS:4.0, scored by GitHub) `CVSS:4.0/AV:N/AC:H/AT:P/PR:N/UI:N/VC:N/VI:N/VA:H/SC:N/SI:N/SA:N`
- Known to be exploited: not in CISA's catalogue, which lists only what CISA has confirmed
- Published: 2026-01-25T12:00:00.000Z
- Modified: 2026-09-10T03:50:59.065Z
- Also known as: RUSTSEC-2026-0005
- Weaknesses: CWE-362, CWE-416

## Description

There is a race condition that can lead to a use-after-free if a `oneshot::Receiver` is polled but then dropped instead of polled to completion. This could happen if the receiver future was cancelled while receiving, for example by being wrapped in a timeout future or similar.

When the `Receiver` is polled (`Future::poll`) it writes a waker to the channel and sets it to the `RECEIVING` state. If the `Receiver` was then dropped (instead of polled to completion), the `Drop` implementation on `Receiver` unconditionally swapped the channel state to `DISCONNECTED` and only after doing so it read back its waker from the heap allocation and dropped it. The problem is that the `DISCONNECTED` state could be observed by the `Sender`, which would lead to it deallocating the channel heap memory. If the `Sender` manage to free the channel before the `Receiver` managed to proceed to dropping the waker, then the `Receiver` would read from the freed channel memory (Use After Free).

The fix was submitted in https://github.com/faern/oneshot/pull/74 and published as part of `oneshot` version `0.1.12`.

(As written by GitHub Advisory Database.)

## Affected

- oneshot (crates.io): before 0.1.12; from 0.1.2-0 before 0.1.12

## References

- <https://github.com/faern/oneshot/issues/73> (report, web)
- <https://github.com/rustsec/advisory-db/pull/2600> (web)
- <https://github.com/faern/oneshot/commit/d1a1506010bc48962634807d0dcca682af4f50ba> (web)
- <https://github.com/faern/oneshot> (package)
- <https://rustsec.org/advisories/RUSTSEC-2026-0005.html> (advisory, web)
- <https://crates.io/crates/oneshot> (package)

## Sources

- GitHub Advisory Database: [GHSA-rvr2-r3pv-5m4p](https://github.com/advisories/GHSA-rvr2-r3pv-5m4p), CC-BY-4.0, modified 2026-09-10
- RustSec Advisory Database: [RUSTSEC-2026-0005](https://rustsec.org/advisories/RUSTSEC-2026-0005.html), CC0-1.0, modified 2026-01-27

---

Page: https://cve.day/GHSA-rvr2-r3pv-5m4p · Whole record: https://cve.day/GHSA-rvr2-r3pv-5m4p.json · Rebuilt by cve.day 2026-11-25T22:56:43.300Z
