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

> A race condition in the oneshot Rust library allows use-after-free when a receiver is dropped during polling, potentially leading to code execution or crashes.

- **Severity:** Not scored
- **Exploited in the wild:** Not known
- **Login needed:** Not needed
- **Attackable:** Not stated
- **Victim action needed:** Not needed
- **Fix available:** Yes
- **Published:** 25 Jan 2026
- **Also known as:** RUSTSEC-2026-0005

## What is GHSA-rvr2-r3pv-5m4p?

GHSA-rvr2-r3pv-5m4p is an use after free vulnerability in oneshot, published on 25 Jan 2026. 

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

## Which versions are affected by GHSA-rvr2-r3pv-5m4p?

3 open source packages ship an affected version, including oneshot.


| Package | Ecosystem | Affected | Fixed in |
| --- | --- | --- | --- |
| `oneshot` | crates.io | All versions | 0.1.12 |
| `oneshot` | crates.io | All versions | 0.1.12 |
| `oneshot` | crates.io | From 0.1.2-0 | 0.1.12 |

## How do I fix GHSA-rvr2-r3pv-5m4p?

Upgrade oneshot to 0.1.12 or later.

## Is GHSA-rvr2-r3pv-5m4p being exploited?

There is no known exploitation of GHSA-rvr2-r3pv-5m4p in the wild and no public exploit code.

## Fix prompt for AI coding agents

```text
Check this codebase for GHSA-rvr2-r3pv-5m4p and fix it if it is affected.

What it is: GHSA-rvr2-r3pv-5m4p is an use after free vulnerability in oneshot, published on 25 Jan 2026. 
Exploitation: There is no known exploitation of GHSA-rvr2-r3pv-5m4p in the wild and no public exploit code.

Affected packages and fixed versions:
- oneshot (crates.io): affected all versions; fixed in 0.1.12
- oneshot (crates.io): affected all versions; fixed in 0.1.12
- oneshot (crates.io): affected from 0.1.2-0; fixed in 0.1.12

Task:
1. Search the dependency manifests and lockfiles (for example package.json, package-lock.json, requirements.txt, poetry.lock, uv.lock, pom.xml, build.gradle, go.mod, Cargo.lock, Gemfile.lock) and any Dockerfiles for the affected packages, including transitive dependencies.
2. If an affected version is in use, upgrade it to the fixed version for its release line with the project's package manager, so the lockfile is regenerated. Prefer the smallest upgrade that fixes it.
3. If there is no fix, or the upgrade would break the build, do not guess: explain the risk and the safest workaround instead.
4. Run the tests and summarise what changed and why.
5. If nothing in the project is affected, say so and change nothing.

Reference: https://insights.sbomify.com/GHSA-rvr2-r3pv-5m4p/ (Markdown: https://insights.sbomify.com/GHSA-rvr2-r3pv-5m4p/index.md)
```

## Sources

- OSV: https://osv.dev/vulnerability/GHSA-rvr2-r3pv-5m4p

---
From sbomify Insights: https://insights.sbomify.com/GHSA-rvr2-r3pv-5m4p/
Summaries are generated and may contain mistakes; the official description above is the record.
