Email me

Rust advisories / tokio

Vulnerability HighRUSTSEC-2021-0124 · tokio

RUSTSEC-2021-0124: Data race when sending and receiving after closing a `oneshot` channel

Short answerA security vulnerability in the tokio crate: Data race when sending and receiving after closing a `oneshot` channel. GitHub rates it High. Fixed in 1.13.1, 1.8.4: update to a fixed version.

Cratetokio
TypeVulnerability (memory-corruption, thread-safety)
Affected versionsFrom 0.1.14 before 1.8.4; from 1.9.0 before 1.13.1.
Fixed in1.13.1, 1.8.4
SeverityHigh (GitHub rating)
Published2021-11-16
Last changed2023-11-08
Also known asCVE-2021-45710, GHSA-fg7r-2g4j-5cgr
Affected functionstokio::sync::oneshot::Receiver::close

What to do

  1. See which version you have: cargo tree -i tokio (it also shows which of your dependencies pulls it in).
  2. Update within your version requirement: cargo update -p tokio. If the fix is a newer major or minor than your requirement allows, raise it in Cargo.toml (for example tokio = "1.8.4") or update the dependency that pulls it in.
  3. Check again with cargo audit, or paste your Cargo.lock into our Cargo.toml checker.

Details from the advisory

If a tokio::sync::oneshot channel is closed (via the oneshot::Receiver::close method), a data race may occur if the oneshot::Sender::send method is called while the corresponding oneshot::Receiver is awaited or calling try_recv.

When these methods are called concurrently on a closed channel, the two halves of the channel can concurrently access a shared memory location, resulting in a data race. This has been observed to cause memory corruption.

Note that the race only occurs when **both** halves of the channel are used after the Receiver half has called close. Code where close is not used, or where the Receiver is not awaited and try_recv is not called after calling close, is not affected.

See tokio#4225 for more details.

References

From the RustSec Advisory Database (CC0-1.0) via the OSV export, downloaded Oct 24, 2026. Severity score computed from the published CVSS vector.

Other advisories for tokio

Full security history of tokio

Up next

Same cratetokio: security historyEvery advisory for this crate, and whether it is safe to use today.Read it next →

Did this answer your question?

Get the receipts by email.

What my AI agents tried this week, with the real numbers: what worked, what flopped, what made money. One email when there is something worth reading.

No spam, never sold. Every email has a one-click unsubscribe.

Popular in the shop

All 124 tools →

Browse: Bundles and kitsHome, family and schoolMoney and businessAI toolsSports and fitnessMaking and hobbiesFood and drinkIndie dev and launchTrading and quant

Free: Landing page teardown iPhone app cost calculator LLM API cost calculator Paid online: $49 Launch Check App builds Articles FAQ