{"id":"CVE-2021-45710","aliases":["CVE-2021-45710","GHSA-fg7r-2g4j-5cgr","RUSTSEC-2021-0124"],"related":[],"kind":"vulnerability","state":"published","title":"Race Condition in tokio","summary":"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.","summarySource":"cvelist","descriptions":[{"lang":"en","text":"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.","source":"cvelist"},{"lang":"en","text":"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.\n\nWhen 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.\n\nNote 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.","format":"markdown","source":"ghsa"},{"lang":"en","text":"If a `tokio::sync::oneshot` channel is closed (via the\n[`oneshot::Receiver::close`] method), a data race may occur if the\n`oneshot::Sender::send` method is called while the corresponding\n`oneshot::Receiver` is `await`ed or calling `try_recv`.\n\nWhen these methods are called concurrently on a closed channel, the two halves\nof the channel can concurrently access a shared memory location, resulting in a\ndata race. This has been observed to [cause memory corruption][corruption].\n\nNote that the race only occurs when **both** halves of the channel are used\nafter the `Receiver` half has called `close`. Code where `close` is not used, or where the\n`Receiver` is not `await`ed and `try_recv` is not called after calling `close`,\nis not affected.\n\nSee [tokio#4225][issue] for more details.\n\n[corruption]: https://github.com/tokio-rs/tokio/issues/4225#issuecomment-967434847\n[issue]: https://github.com/tokio-rs/tokio/issues/4225\n[`oneshot::Receiver::close`]: https://docs.rs/tokio/1.14.0/tokio/sync/oneshot/struct.Receiver.html#method.close","format":"markdown","source":"rustsec"},{"lang":"es","text":"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","source":"nvd"}],"published":"2021-11-16T12:00:00.000Z","modified":"2026-06-17T04:13:59.733Z","severity":{"scorer":"NVD","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:H","score":8.1,"rating":"HIGH"},"severities":[{"scorer":"GitHub","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:H","score":8.1,"rating":"HIGH"},{"scorer":"NVD","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:H","score":8.1,"rating":"HIGH"},{"scorer":"NVD","scheme":"CVSS:2.0","vector":"AV:N/AC:H/Au:N/C:P/I:P/A:P","score":5.1,"rating":"MEDIUM"}],"cwes":["CWE-362"],"affected":[{"ranges":[{"version":"n/a","status":"affected"}],"source":"cvelist"},{"ranges":[{"type":"semver","introduced":"0.1.14","status":"affected","fixed":"1.8.4"}],"ecosystem":"crates.io","package":"tokio","purl":"pkg:cargo/tokio","source":"ghsa"},{"ranges":[{"type":"semver","introduced":"1.9.0","status":"affected","fixed":"1.13.1"}],"ecosystem":"crates.io","package":"tokio","purl":"pkg:cargo/tokio","source":"ghsa"},{"ranges":[{"type":"semver","introduced":"0.1.14","status":"affected","fixed":"1.8.4"},{"type":"semver","introduced":"1.9.0","status":"affected","fixed":"1.13.1"}],"ecosystem":"crates.io","package":"tokio","purl":"pkg:cargo/tokio","source":"rustsec"},{"ranges":[{"status":"affected","introduced":"0.1.14","fixed":"1.8.4"},{"status":"affected","introduced":"1.9.0","fixed":"1.13.1"}],"vendor":"tokio","product":"tokio","cpe":"cpe:2.3:a:tokio:tokio:*:*:*:*:*:rust:*:*","source":"nvd"}],"references":[{"url":"https://rustsec.org/advisories/RUSTSEC-2021-0124.html","tags":["advisory","patch","third-party-advisory","web","x-refsource-misc","x-transferred"],"sources":["cvelist","ghsa","rustsec","nvd"]},{"url":"https://raw.githubusercontent.com/rustsec/advisory-db/main/crates/tokio/RUSTSEC-2021-0124.md","tags":["third-party-advisory","web","x-refsource-misc","x-transferred"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://nvd.nist.gov/vuln/detail/CVE-2021-45710","tags":["advisory"],"sources":["ghsa"]},{"url":"https://github.com/tokio-rs/tokio/issues/4225","tags":["report","web"],"sources":["ghsa","rustsec"]},{"url":"https://github.com/tokio-rs/tokio","tags":["package"],"sources":["ghsa"]},{"url":"https://crates.io/crates/tokio","tags":["package"],"sources":["rustsec"]}],"credits":[],"assigner":"mitre","sources":[{"source":"cvelist","name":"CVE List","id":"CVE-2021-45710","url":"https://www.cve.org/CVERecord?id=CVE-2021-45710","licence":"CVE Terms of Use","modified":"2024-08-04T04:47:02.072Z"},{"source":"ghsa","name":"GitHub Advisory Database","id":"GHSA-fg7r-2g4j-5cgr","url":"https://github.com/advisories/GHSA-fg7r-2g4j-5cgr","licence":"CC-BY-4.0","modified":"2023-11-08T04:07:23.239Z"},{"source":"rustsec","name":"RustSec Advisory Database","id":"RUSTSEC-2021-0124","url":"https://rustsec.org/advisories/RUSTSEC-2021-0124.html","licence":"CC0-1.0","modified":"2023-11-08T04:07:23.239Z"},{"source":"nvd","name":"NVD","id":"CVE-2021-45710","url":"https://nvd.nist.gov/vuln/detail/CVE-2021-45710","licence":"Public domain","modified":"2026-06-17T04:13:59.733Z"}],"updatedAt":"2026-11-25T22:58:06.272Z","epss":{"score":0.01239,"percentile":0.69965,"date":"2026-12-01T12:00:22.000Z"}}