tokio AsyncFd constructors violate I/O safety

Severity: info · Published 2026-10-13

Tokio's AsyncFd library, used by Rust applications for asynchronous file descriptor operations, has unsafe constructors that can accept invalid or closed file descriptors, violating I/O safety guarantees. This allows safe code to create memory corruption and use-after-free conditions when file descriptors are duplicated, closed, or reused by the operating system while an AsyncFd is still active.

Technologies: tokio (crates.io). Vendors: crates.io.

Quick answers

Is This vulnerability exploited in the wild?
No. Junglewise Threat Intelligence has no report of This vulnerability being exploited in the wild.
How severe is This vulnerability?
Informational severity, published 13 October 2026.
Which products and versions are affected?
tokio (crates.io) SEMVER:introduced=0.3.2,fixed=1.51.6,introduced=1.52.0,fixed=1.53.3; Tokio project Tokio 0.3.2 to 1.51.5, 1.52.0 to 1.53.2.
Is there a fix for This vulnerability?
Yes. tokio (crates.io): upgrade to 1.53.3 or later. Junglewise finds every place you run it, drafts the upgrade and applies it once you approve.
How is This vulnerability attacked?
It is attacked with local access, in a software library.
Am I affected?
Check whether you run tokio (crates.io) or Tokio project Tokio at an affected version. Junglewise does that check for you around the clock: connect your code, cloud and domains, and it matches new vulnerabilities like this one against what you actually run and tells you when one reaches you.

How to fix

  • tokio (crates.io): upgrade to 1.53.3 or later
    cargo update -p tokio

Technical details

The issue exists in AsyncFd::new, AsyncFd::with_interest, AsyncFd::try_new, and AsyncFd::try_with_interest, which accept any T: AsRawFd without validating ownership or validity. This allows safe Rust code to construct AsyncFd from arbitrary file descriptors, and enables file descriptor use-after-free when a descriptor is closed and reused by the OS while Tokio's internal epoll/kqueue structures still hold a dangling pointer to internal allocations. The advisory deprecates these safe constructors in favor of unsafe register and register_with_interest, placing the burden on callers to ensure descriptor validity.

Affected products

  • tokio project tokio 0.3.2 to 1.51.5, 1.52.0 to 1.53.2

Timeline

  • 2026-10-13: disclosed
  • 2026-10-23: patched

References

This page as Markdown. Free to reuse under CC BY 4.0 with a link back.