Advisory Database
  • Advisories
  • Dependency Scanning
  1. cargo
  2. ›
  3. tokio
  4. ›
  5. CVE-2021-45710

CVE-2021-45710: Race Condition in tokio

January 6, 2022 (updated June 13, 2023)

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.

References

  • github.com/advisories/GHSA-fg7r-2g4j-5cgr
  • github.com/tokio-rs/tokio
  • github.com/tokio-rs/tokio/issues/4225
  • nvd.nist.gov/vuln/detail/CVE-2021-45710
  • raw.githubusercontent.com/rustsec/advisory-db/main/crates/tokio/RUSTSEC-2021-0124.md
  • rustsec.org/advisories/RUSTSEC-2021-0124.html

Code Behaviors & Features

Detect and mitigate CVE-2021-45710 with GitLab Dependency Scanning

Secure your software supply chain by verifying that all open source dependencies used in your projects contain no disclosed vulnerabilities. Learn more about Dependency Scanning →

Affected versions

All versions starting from 0.1.14 before 1.8.4, all versions starting from 1.9.0 before 1.13.1

Fixed versions

  • 1.8.4
  • 1.13.1

Solution

Upgrade to versions 1.13.1, 1.8.4 or above.

Impact 8.1 HIGH

CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:H

Learn more about CVSS

Weakness

  • CWE-362: Concurrent Execution using Shared Resource with Improper Synchronization ('Race Condition')

Source file

cargo/tokio/CVE-2021-45710.yml

Spotted a mistake? Edit the file on GitLab.

  • Site Repo
  • About GitLab
  • Terms
  • Privacy Statement
  • Contact

Page generated Wed, 14 May 2025 12:15:11 +0000.