Email me

Rust advisories / tokio

Vulnerability MediumRUSTSEC-2021-0072 · tokio

RUSTSEC-2021-0072: Task dropped in wrong thread when aborting `LocalSet` task

Short answerA security vulnerability in the tokio crate: Task dropped in wrong thread when aborting `LocalSet` task. GitHub rates it Medium. Fixed in 1.5.1, 1.6.3, 1.7.2, 1.8.1: update to a fixed version.

Cratetokio
TypeVulnerability (memory-corruption)
Affected versionsFrom 0.3.0 before 1.5.1; from 1.6.0 before 1.6.3; from 1.7.0 before 1.7.2; from 1.8.0 before 1.8.1.
Fixed in1.5.1, 1.6.3, 1.7.2, 1.8.1
SeverityMedium (GitHub rating)
Published2021-07-07
Last changed2023-11-08
Also known asCVE-2021-38191, GHSA-2grh-hm3w-w7hv
Affected functionstokio::task::JoinHandle::abort

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.1") 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

When aborting a task with JoinHandle::abort, the future is dropped in the thread calling abort if the task is not currently being executed. This is incorrect for tasks spawned on a LocalSet.

This can easily result in race conditions as many projects use Rc or RefCell in their Tokio tasks for better performance.

See tokio#3929 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