# GHSA-5M8G-XHQ4-4H93: wasmtime-wasi: Unbounded host memory growth via empty writes to AsyncWriteStream

- Database: GitHub
- Severity: CVSS 6.9 (Medium)
- Published: 2026-11-16
- Modified: 2026-11-16

## Affected versions

- wasmtime-wasi (crates.io): fixed in 36.0.21
- wasmtime-wasi (crates.io): from 37.0.0, fixed in 48.0.9
- wasmtime-wasi (crates.io): from 49.0.0, fixed in 49.0.6
- wasmtime-wasi (crates.io): from 50.0.0, fixed in 50.0.2

## Description

### Summary

`wasmtime-wasi` provides the type `wasmtime_wasi::p2::pipe::AsyncWriteStream`, which takes ownership of the `list<u8>` argument passed to `wasi:io/streams.output-stream.write`, including zero-length ones. There is a write budget tracked to limit resource consumption in this buffer, but a zero-length write does not consume any of this budget. A guest which repeatedly calls `write` with an empty argument can consume a small amount of host memory per call, potentially leading to host memory exhaustion.

### Details

A guest can trigger this when an output stream it can reach is an `AsyncWriteStream`. The primary use of this comes through `AsyncStdoutStream`; there are a few other paths to this including `wasi_config_set_stdout_custom` in the C API.  Embedders may also be using the aforementioned types in their own hostcall implementations. Not all embeddings with wasip2 support include the vulnerable code; notably, the Wasmtime CLI itself does not use `AsyncWriteStream`.

The vulnerable code pushes an empty `Bytes` to the back of a `VecDeque` owned by `AsyncWriteStream`. Each empty `Bytes` consumes 32 bytes of memory on x86_64 and aarch64.

### Impact

This vulnerability gives guests a fairly direct way to cause unbounded host heap usage, leading to memory exhaustion on the host (CWE-770) which could be used as part of a DoS attack. The vulnerable code may be used by many embedders supporting wasip2.

## References

- https://github.com/bytecodealliance/wasmtime/security/advisories/GHSA-5m8g-xhq4-4h93

Page: https://cve.now/GHSA-5M8G-XHQ4-4H93

Wrong or missing data? Send feedback: POST https://cve.now/api/v1/feedback (see https://cve.now/agents#feedback).
