-
-
Notifications
You must be signed in to change notification settings - Fork 2.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Windows Named pipes invalid memory access #6369
Comments
The Looks like the safety assumption at Here's the stack trace where the
|
I also tried older versions of |
Security Advisory mio >= 0.7.2, <= 0.8.10 - tokio-rs/tokio#6369 - tokio-rs/mio#1760 - https://rustsec.org/advisories/RUSTSEC-2024-0019.html
Security Advisory mio >= 0.7.2, <= 0.8.10 - tokio-rs/tokio#6369 - tokio-rs/mio#1760 - https://rustsec.org/advisories/RUSTSEC-2024-0019.html
tokio-rs/mio#1760 is marked as fixing this bug, but note that tokio's (optional) dependency on mio is still at 0.8.9 which was vulnerable, e.g.: Line 98 in f6d0619
I believe this shouldn't be considered fixed in tokio until no tokio crates depend on any vulnerable version of mio (or they otherwise mitigate the vulnerability). This is important for downstream projects dependent on tokio since adding a dependency on mio is not the right fix for them, assuming they do not depend on it directly. The right fix is to update their tokio dependency/dependencies to a release that has updated its mio dependencies. (I know that mio 0.8.11 is a compatible point-release relative to the version that tokio depends on, so in most cases it would be sufficient for downstream projects that are not libraries to just do a |
@daira you can run |
I'm aware of that; see the last paragraph of my comment. (Also see dependabot/dependabot-core#9210 which would fix an issue with getting potentially misleading Dependabot security alerts.) |
### Description This is a part of #8809 Update mio from 0.8.8 to 0.8.11. When using named pipes on Windows, mio will under some circumstances return invalid tokens that correspond to named pipes that have already been deregistered from the mio registry. The impact of this vulnerability depends on how mio is used. For some applications, invalid tokens may be ignored or cause a warning or a crash. On the other hand, for applications that store pointers in the tokens, this vulnerability may result in a use-after-free. ### Connections [named-pipes: fix receiving IOCP events after deregister #1760](tokio-rs/mio#1760) [Windows Named pipes invalid memory access #6369](tokio-rs/tokio#6369) Release Notes: - N/A
Version
tokio v1.36.0
Platform
Windows 10 Enterprise 64-bit
version 10.0.19045
Description
When running a simple named pipes
tokio
program with Application Verifier withheap
turned on, invalid memory access is detected inScheduledIo::set_readiness
.Reproduction code:
Cargo.toml:
main.rs:
With the following settings in Application Verifier
You can produce crash dumps by adding the following settings in the registry (see this article):
In
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\Windows Error Reporting\LocalDumps
:DumpFolder
:C:\path\to\dump\folder
DumpCount
: The number of dumps to keepDumpType
: 2 for a full dumpI expected to see this happen: The program would run without accessing invalid memory. This happens in both debug and release builds.
Instead, this happened: The application crashes with
STATUS_ACCESS_VIOLATION
. The dump shows that the program is trying to access invalid memory inScheduledIo::set_readiness
when trying to load an atomic variable, which should mean thatScheduledIo
itself has likely been freed. We observed this access violation in our larger application when a named pipe client disconnects.The text was updated successfully, but these errors were encountered: