CVE-2022-24791

Wasmtime is a standalone JIT-style runtime for WebAssembly, using Cranelift. There is a use after free vulnerability in Wasmtime when both running Wasm that uses externrefs and enabling epoch interruption in Wasmtime. If you are not explicitly enabling epoch interruption (it is disabled by default) then you are not affected. If you are explicitly disabling the Wasm reference types proposal (it is enabled by default) then you are also not affected. The use after free is caused by Cranelift failing to emit stack maps when there are safepoints inside cold blocks. Cold blocks occur when epoch interruption is enabled. Cold blocks are emitted at the end of compiled functions, and change the order blocks are emitted versus defined. This reordering accidentally caused Cranelift to skip emitting some stack maps because it expected to emit the stack maps in block definition order, rather than block emission order. When Wasmtime would eventually collect garbage, it would fail to find live references on the stack because of the missing stack maps, think that they were unreferenced garbage, and therefore reclaim them. Then after the collection ended, the Wasm code could use the reclaimed-too-early references, which is a use after free. Patches have been released in versions 0.34.2 and 0.35.2, which fix the vulnerability. All Wasmtime users are recommended to upgrade to these patched versions. If upgrading is not an option for you at this time, you can avoid the vulnerability by either: disabling the Wasm reference types proposal, config.wasm_reference_types(false); or by disabling epoch interruption if you were previously enabling it. config.epoch_interruption(false).
Configurations

Configuration 1 (hide)

OR cpe:2.3:a:bytecodealliance:wasmtime:*:*:*:*:*:rust:*:*
cpe:2.3:a:bytecodealliance:wasmtime:*:*:*:*:*:rust:*:*

History

08 Apr 2022, 16:35

Type Values Removed Values Added
References (MISC) https://github.com/bytecodealliance/wasmtime/commit/666c2554ea0e1728c35aa41178cf235920db888a - (MISC) https://github.com/bytecodealliance/wasmtime/commit/666c2554ea0e1728c35aa41178cf235920db888a - Patch, Third Party Advisory
References (CONFIRM) https://github.com/bytecodealliance/wasmtime/security/advisories/GHSA-gwc9-348x-qwv2 - (CONFIRM) https://github.com/bytecodealliance/wasmtime/security/advisories/GHSA-gwc9-348x-qwv2 - Mitigation, Third Party Advisory
CPE cpe:2.3:a:bytecodealliance:wasmtime:*:*:*:*:*:rust:*:*
CVSS v2 : unknown
v3 : unknown
v2 : 6.8
v3 : 9.8
First Time Bytecodealliance wasmtime
Bytecodealliance

31 Mar 2022, 23:15

Type Values Removed Values Added
New CVE

Information

Published : 2022-03-31 23:15

Updated : 2023-12-10 14:22


NVD link : CVE-2022-24791

Mitre link : CVE-2022-24791

CVE.ORG link : CVE-2022-24791


JSON object : View

Products Affected

bytecodealliance

  • wasmtime
CWE
CWE-416

Use After Free