8.1high
Race Condition in tokio
- Severity
- 8.1high CVSS:3.1 by NVD
- Exploit likelihood
- 1.24% (higher than 69% of CVEs; EPSS, by FIRST)
- Published
- Last changed
- Assigned by
- mitre
- Also known as
- GHSA-fg7r-2g4j-5cgrRUSTSEC-2021-0124
Description
An issue was discovered in the tokio crate before 1.8.4, and 1.9.x through 1.13.x before 1.13.1, for Rust. In certain circumstances involving a closed oneshot channel, there is a data race and memory corruption.
Affected
| Product or package | Versions | Reported by |
|---|---|---|
| Unspecified product | n/a | CVE List |
| tokio (crates.io) | from 0.1.14 before 1.8.4, from 1.9.0 before 1.13.1 | GitHub Advisory Database, RustSec Advisory Database |
| tokio tokio | from 0.1.14 before 1.8.4, from 1.9.0 before 1.13.1 | NVD |
All scores
| GitHub | 8.1high CVSS:3.1 | CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:H |
| NVD | 8.1high CVSS:3.1 | CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:H |
| NVD | 5.1medium CVSS:2.0 | AV:N/AC:H/Au:N/C:P/I:P/A:P |
Classification
What each source says
CVE List
An issue was discovered in the tokio crate before 1.8.4, and 1.9.x through 1.13.x before 1.13.1, for Rust. In certain circumstances involving a closed oneshot channel, there is a data race and memory corruption.
GitHub Advisory Database
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.
RustSec Advisory Database
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.
NVD (es)
Se ha detectado un problema en la crate tokio versiones anteriores a 1.8.4, y de la 1.9.x a la 1.13.x anteriores a 1.13.1, para Rust. En determinadas circunstancias que implican un canal cerrado oneshot, se presenta una carrera de datos y corrupción de memoria
References
| https://rustsec.org/advisories/RUSTSEC-2021-0124.html | advisory, patch, third-party-advisory, web | |
| https://raw.githubusercontent.com/rustsec/advisory-db/main/crates/tokio/RUSTSEC-2021-0124.md | third-party-advisory, web | |
| https://nvd.nist.gov/vuln/detail/CVE-2021-45710 | advisory | |
| https://github.com/tokio-rs/tokio/issues/4225 | report, web | |
| https://github.com/tokio-rs/tokio | package | |
| https://crates.io/crates/tokio | package | |
Sources
| Source | Record | Licence |
|---|---|---|
| CVE List | CVE-2021-45710 changed 2024-08-04 | CVE Terms of Use |
| GitHub Advisory Database | GHSA-fg7r-2g4j-5cgr changed 2023-11-08 | CC-BY-4.0 |
| RustSec Advisory Database | RUSTSEC-2021-0124 changed 2023-11-08 | CC0-1.0 |
| NVD | CVE-2021-45710 changed 2026-06-17 | Public domain |