Skip to main content
Menu
Advisories

WASI preview 0 implementation of poll_oneoff circumvents fuel consumption

GHSA-J366-H8GG-77PMPublished Updated GitHub

Description

Impact

The WASI preview 0 implementation of poll_oneoff in wasmtime-wasi causes the host to do perform work which is O(n) in the number of subscriptions passed without consuming fuel or checking if fuel has run out. This exposes a DOS attack vector where a guest can perform long-running computations which ignore fuel limits. Systems using the wasmtime cli are affected because WASI preview 0 is enabled by default. Systems using wasmtime as a library are unaffected unless they explicitly enable WASI preview 0 via p0::add_to_linker_async or po::add_to_linker_sync

The root cause is that the WASI preview 1 implementation of poll_oneoff does a fuel check, but the preview 0 version goes through an adapter which mutates each subscription before calling the WASIp1 version (and doesn't do its own fuel check).

WASIp1, WASIp2, and WASIp3 are all unaffected because they either properly consume fuel or don't support this API.

Patches

The fix is present in main and patch releases are made for 36.0.17, 48.0.4 and 49.0.2.

Workarounds

Disable WASI preview 0 support in the cli via -Spreview0=n.

Affected versions

References

GitHub · bytecodealliance/wasmtime