Security mailing lists by PureSourceCode

CVE-2022-24791

CRITICAL 9.8CVSS 3.1

Use after free in Wasmtime

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).

Published
31 Mar 2022
Last modified
12 Oct 2026
Assigned by
security-advisories@github.com
NVD status
Modified
Weakness
CWE-416
Also known as
GHSA-gwc9-348x-qwv2RUSTSEC-2022-0016RUSTSEC-2022-0099
Sources
NVDJSONOSV GHSA-gwc9-348x-qwv2JSONOSV RUSTSEC-2022-0016JSONOSV RUSTSEC-2022-0099JSON

Scores

SourceScored byVersionScoreVector / decision
NVD nvd@nist.gov (Primary) CVSS 3.1 CRITICAL 9.8 CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H
NVD security-advisories@github.com (Secondary) CVSS 3.1 HIGH 8.1 CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:H
OSV GitHub CVSS 3.1 HIGH 8.1 CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:H
NVD nvd@nist.gov (Primary) CVSS 2.0 MEDIUM 6.8 AV:N/AC:M/Au:N/C:P/I:P/A:P

Affected

SourceVendor / ecosystemProduct / packageAffected versionsFixed in
NVD bytecodealliance wasmtime
cpe:2.3:a:bytecodealliance:wasmtime:*:*:*:*:*:rust:*:*
>= 0.34.0, < 0.34.2 0.34.2
NVD bytecodealliance wasmtime
cpe:2.3:a:bytecodealliance:wasmtime:*:*:*:*:*:rust:*:*
>= 0.35.0, < 0.35.2 0.35.2
OSV crates.io wasmtime < 0.34.2 0.34.2
OSV crates.io wasmtime >= 0.35.0, < 0.35.2 0.35.2
OSV crates.io wasmtime >= 0.34.0, < 0.34.2; >= 0.35.0, < 0.35.2 0.34.2, 0.35.2
OSV crates.io wasmtime >= 0.0.0-0, < 0.34.2; >= 0.35.0, < 0.35.2 0.34.2, 0.35.2

References

History

  • 25 Nov 2026 20:34 UTC · NVD: first stored (published 31 Mar 2022)
  • 25 Nov 2026 20:14 UTC · OSV: first stored (published 31 Mar 2022)
  • 25 Nov 2026 20:14 UTC · OSV: first stored (published 28 Mar 2022)
  • 25 Nov 2026 20:14 UTC · OSV: first stored (published 1 Apr 2022)
An unhandled error has occurred. Reload ×

Rejoining the server...

Rejoin failed... trying again in seconds.

Failed to rejoin.
Please retry or reload the page.

The session has been paused by the server.

Failed to resume the session.
Please retry or reload the page.