Skip to main content
Menu
Advisories

fd_readdir copies uninitialized struct padding into guest memory

GHSA-96F6-R43R-8C24Published Updated GitHub

Description

Impact

Wasmtime's implementation of the WASIp1 fd_readdir function contained a bug where struct padding bytes on the host were erroneously copied to the guest. This mean that 3 bytes of undefined memory were leaked to the guest on each entry yielded by fd_readdir. These 3 bytes of host memory are whatever happened to be left behind on the host before the host's allocation took the bytes. These 3 bytes could come from either the host's stack or the host's heap. Guests cannot control which three bytes were leaked, however, and only know that three adjacent bytes of information are leaked.

This bug only affects Wasmtime's implementation of the WASIp1 API fd_readdir and does not affect guests using WASIp2-or-later. This bug only affects guests which actually have a preopened directory to list entries from, guests running without a filesystem are unaffected.

Patches

This issue has been fixed in Wasmtime 36.0.17, 48.0.4, and 49.0.2. All other previously published versions of Wasmtime are vulnerable and users are recommended to upgrade.

Workarounds

There is no workaround for this issue if WASIp1 is enabled and guests have access to a preopened directory. Affected users are recommended to update.

Affected versions

References

GitHub · bytecodealliance/wasmtime