GHSA-4q83-7cq4-p6wg: `tokio :io::ReadHalf<T>::unsplit` Is Unsound Vulnerability

LOW
Published
Advisory Summary

GHSA-4q83-7cq4-p6wg is a LOW :io::readhalf<t>::unsplit` is unsound vulnerability (General Security Weakness) affecting `tokio libraries in the crates.io ecosystem. The issue involves :io::readhalf<t>::unsplit` is unsound. Remediation is available by upgrading affected packages to version 1.24.2, 1.20.4, 1.18.5.

GHSA-4q83-7cq4-p6wg at a Glance

CVE Identifier N/A
GHSA Identifier GHSA-4q83-7cq4-p6wg
Severity LOW
CVSS v3.1 Base Score N/A
CWE Classification General Security Weakness
Affected Product `tokio
Package Ecosystem crates.io
Published Date
Last Updated

How to Fix GHSA-4q83-7cq4-p6wg

To remediate this vulnerability, upgrade all affected `tokio dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.

tokio fixed: 1.24.2
Upgrade tokio to 1.24.2
tokio fixed: 1.20.4
Upgrade tokio to 1.20.4
tokio fixed: 1.18.5
Upgrade tokio to 1.18.5
Verify Direct and Transitive Dependencies

Run the following command in your project directory to verify that all resolved dependencies use the patched release:

inspect dependencies for tokio

How to Check if You Are Affected

To determine whether your application is affected by GHSA-4q83-7cq4-p6wg, inspect your project dependencies for `tokio:

inspect dependencies for tokio

Analyze the terminal output to locate any version of `tokio in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 1.24.2), your application is affected.

Note: Verify declared build manifests and deployed runtime container environments.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under General Security Weakness. In `tokio, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.

Source Advisory Statement

`tokio::io::ReadHalf<T>::unsplit` can violate the `Pin` contract The soundness issue is described in the [tokio/issues#5372](https://github.com/tokio-rs/tokio/issues/5372) Specific set of conditions needed to trigger an issue (a !Unpin type in ReadHalf) is unusual, combined with the difficulty of making any arbitrary use-after-free exploitable in Rust without doing a lot of careful alignment of data types in the surrounding code. The `tokio` feature `io-util` is also required to be enabled to trigger this soundness issue. Thanks to zachs18 reporting the issue to Tokio team responsibly and taiki-e and carllerche appropriately responding and fixing the soundness bug. Tokio before 0.2.0 used `futures` 0.1 that did not have `Pin`, so it is not affected by this issue.

GHSA-4q83-7cq4-p6wg Affected `tokio Versions

3 component(s)
Fixed Versions:
1.24.21.20.41.18.5
Product / Package Ecosystem Affected Versions Fixed Version
tokio
crates.io
≥ 1.21.0
< 1.24.2
1.24.2
tokio
crates.io
≥ 1.19.0
< 1.20.4
1.20.4
tokio
crates.io
≥ 0.2.0
< 1.18.5
1.18.5

References

Frequently Asked Questions

What is GHSA-4q83-7cq4-p6wg?
GHSA-4q83-7cq4-p6wg is a security vulnerability in `tokio involving :io::ReadHalf<T>::unsplit` is Unsound under General Security Weakness.
Which `tokio versions are affected?
Affected versions include releases prior to 1.24.2, 1.20.4, 1.18.5 across affected packages: tokio.
What version fixes GHSA-4q83-7cq4-p6wg?
Upgrading to 1.24.2, 1.20.4, 1.18.5 (or the latest patched release for your respective branch) resolves the vulnerability.
Is tokio affected?
Yes, tokio is affected in releases prior to 1.24.2, 1.20.4, 1.18.5. Upgrade your dependency to 1.24.2, 1.20.4, 1.18.5 or later.
What CWE is associated with GHSA-4q83-7cq4-p6wg?
GHSA-4q83-7cq4-p6wg is classified under General Security Weakness.
How can I check crates.io dependencies for GHSA-4q83-7cq4-p6wg?
Run the dependency tree command: 'inspect dependencies for tokio'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "schema_version" : "1.4.0",
  "id" : "GHSA-4q83-7cq4-p6wg",
  "modified" : "2023-02-04T00:30:37Z",
  "published" : "2023-02-04T00:30:37Z",
  "aliases" : [ ],
  "summary" : "`tokio::io::ReadHalf<T>::unsplit` is Unsound",
  "details" : "`tokio::io::ReadHalf<T>::unsplit` can violate the `Pin` contract\n\nThe soundness issue is described in the [tokio/issues#5372](https://github.com/tokio-rs/tokio/issues/5372)\n\nSpecific set of conditions needed to trigger an issue (a !Unpin type in ReadHalf)\nis unusual, combined with the difficulty of making any arbitrary use-after-free\nexploitable in Rust without doing a lot of careful alignment of data types in\nthe surrounding code.\n\nThe `tokio` feature `io-util` is also required to be enabled to trigger this\nsoundness issue.\n\nThanks to zachs18 reporting the issue to Tokio team responsibly and taiki-e\nand carllerche appropriately responding and fixing the soundness bug.\n\nTokio before 0.2.0 used `futures` 0.1 that did not have `Pin`, so it is not\naffected by this issue.\n",
  "severity" : [ ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "crates.io",
      "name" : "tokio"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "1.21.0"
      }, {
        "fixed" : "1.24.2"
      } ]
    } ]
  }, {
    "package" : {
      "ecosystem" : "crates.io",
      "name" : "tokio"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "1.19.0"
      }, {
        "fixed" : "1.20.4"
      } ]
    } ]
  }, {
    "package" : {
      "ecosystem" : "crates.io",
      "name" : "tokio"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0.2.0"
      }, {
        "fixed" : "1.18.5"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/tokio-rs/tokio/issues/5372"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/tokio-rs/tokio"
  }, {
    "type" : "WEB",
    "url" : "https://rustsec.org/advisories/RUSTSEC-2023-0005.html"
  } ],
  "database_specific" : {
    "cwe_ids" : [ ],
    "severity" : "LOW",
    "github_reviewed" : true,
    "github_reviewed_at" : "2023-02-04T00:30:37Z",
    "nvd_published_at" : null
  }
}