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

CVE-2021-38191: Race condition in tokio

August 25, 2021 (updated June 13, 2023)

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.

References

  • github.com/advisories/GHSA-2grh-hm3w-w7hv
  • github.com/tokio-rs/tokio
  • github.com/tokio-rs/tokio/issues/3929
  • nvd.nist.gov/vuln/detail/CVE-2021-38191
  • raw.githubusercontent.com/rustsec/advisory-db/main/crates/tokio/RUSTSEC-2021-0072.md
  • rustsec.org/advisories/RUSTSEC-2021-0072.html

Code Behaviors & Features

Detect and mitigate CVE-2021-38191 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.3.0 before 1.5.1, all versions starting from 1.6.0 before 1.6.3, all versions starting from 1.7.0 before 1.7.2, all versions starting from 1.8.0 before 1.8.1

Fixed versions

  • 1.8.1
  • 1.7.2
  • 1.6.3
  • 1.5.1

Solution

Upgrade to versions 1.5.1, 1.6.3, 1.7.2, 1.8.1 or above.

Impact 5.9 MEDIUM

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

Learn more about CVSS

Weakness

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

Source file

cargo/tokio/CVE-2021-38191.yml

Spotted a mistake? Edit the file on GitLab.

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

Page generated Wed, 14 May 2025 12:16:07 +0000.