RUSTSEC-2026-0386
`AsyncFd::new` and related constructors violate I/O safety
Mitigation
- Upgrade tokio to one of 1.51.6, 1.53.3 (or later in the same release line).
Who should check
- Projects that depend on crates.io package tokio (>= 0.3.2, < 1.51.6; >= 1.52.0, < 1.53.3)
Vulnerability facts
- Affected
- tokio >= 0.3.2, < 1.51.6; >= 1.52.0, < 1.53.3
- Fixed in
- 1.51.6, 1.53.3
- Exploited in the wild
- Not in CISA KEV
- Public exploit / PoC
- None known
- Remote exploitation
- Unknown
- CVSS
- Not scored yet
- Modified
Description
`tokio::io::unix::AsyncFd` provides safe constructors (`new`, `with_interest`, `try_new`, and `try_with_interest`) that accept any `T: AsRawFd` rather than requiring proof of ownership or validity of the file descriptor. Because `RawFd` implements `AsRawFd`, safe code can construct an `AsyncFd` from an arbitrary or closed file descriptor, or close/replace the underlying file descriptor while the `AsyncFd` is still alive. This violates I/O safety in two ways: 1. `AsyncFd<T>` implements `AsFd` for all `T: AsRawFd` by calling `BorrowedFd::borrow_raw(self.as_raw_fd())`, allowing safe code to obtain an arbitrary `BorrowedFd<'_>` without owning the file descriptor. 2. Tokio's I/O driver stores a pointer to an internal allocation in the `epoll`/`kqueue` user data for registered file descriptors. If the underlying file descriptor is duplicated and then closed while an `AsyncFd` is alive, and the OS reuses that file descriptor number for a another IO resource on the same runtime, dropping the first `AsyncFd` deregisters the reused file descriptor number and frees the first while the original file description remains registered in `epoll`, leading to a use-after-free when a readiness event fires. Starting in Tokio 1.51.6, 1.53.3, and 1.54.0, `AsyncFd::new`, `AsyncFd::with_interest`, `AsyncFd::try_new`, and `AsyncFd::try_with_interest` are deprecated in favor of the `unsafe` constructors `AsyncFd::register` and `AsyncFd::register_with_interest`. Callers must ensure that the file descriptor remains valid, open, and unchanged for the lifetime of the `AsyncFd`.
Affected and fixed versions
| Package / product | Affected | Fixed | Source |
|---|---|---|---|
| crates.io tokio | >= 0.3.2, < 1.51.6; >= 1.52.0, < 1.53.3 | 1.51.6, 1.53.3 | osv |
Check your systems with an agent
Paste this into Claude Code, Cursor or another coding agent. It only reads; it changes nothing.
Check whether anything I run is affected by RUSTSEC-2026-0386. Work read-only: do not install, upgrade, delete or change anything. Details: https://flawdb.com/RUSTSEC-2026-0386.md Affected: tokio >= 0.3.2, < 1.51.6; >= 1.52.0, < 1.53.3 Fixed in: 1.51.6, 1.53.3 Steps: 1. Search this machine and project for tokio (crates.io): dependency manifests and lockfiles, installed packages, container images and running services. 2. For each match, note the installed version and whether it is inside the affected range. 3. Report a table: location, installed version, affected (yes / no / unsure), evidence. If affected, say which fixed version or mitigation from the details link applies, but don't apply it.
References
Vendor advisories
FAQ
Is RUSTSEC-2026-0386 being exploited?
There is no confirmed exploitation: RUSTSEC-2026-0386 is not in the CISA Known Exploited Vulnerabilities catalog. No public exploit code is known.
How serious is RUSTSEC-2026-0386?
It has no CVSS score yet. Unknown.
Which versions are affected by RUSTSEC-2026-0386?
tokio >= 0.3.2, < 1.51.6; >= 1.52.0, < 1.53.3.
Is there a fix for RUSTSEC-2026-0386?
Yes. Fixed in 1.51.6, 1.53.3. Upgrade tokio to one of 1.51.6, 1.53.3 (or later in the same release line).
How do I check if I'm affected by RUSTSEC-2026-0386?
Find where you use the affected software (dependency lockfiles, installed packages, container images, servers) and compare the installed version with the affected range above. The agent prompt on this page does this read-only.