CVE-2022-24791 json
Use after free in Wasmtime
published 4y ago modified 28d ago also GHSA-gwc9-348x-qwv2 , RUSTSEC-2022-0016 , RUSTSEC-2022-0099 , EUVD-2022-1747
- cvss
- 8.1
- version 3.1, CNA
- cisa kev
- Not listed
- not in CISA's catalog
- epss
- 1.2%
- EPSS 1.2% chance of exploitation in 30 days, percentile 67%
- public exploits
- 0
- none known
Summary
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).
Patch / fix
- crates.io wasmtime 0.34.2, 0.35.2
- bytecodealliance wasmtime 0.34.2, 0.35.2
- firefox Ubuntu 22.04 LTS 1:1snap1-0ubuntu1
ubuntu advisories UBUNTU-CVE-2022-24791
Ubuntu security data © Canonical Ltd., from https://github.com/canonical/ubuntu-security-notices via OSV; changed: normalised to fixed package versions per release. CC BY-SA 4.0
- cargo-audit-advisory-db openSUSE Tumbleweed 20220420-1.1
opensuse advisories openSUSE-SU-2024:12009-1
Is CVE-2022-24791 in your dependencies? Fencer shows which of your repositories are affected as soon as an advisory lands, and opens the fix as a pull request.
Check with FencerCISA SSVC
- Exploitation
- none
- Automatable
- no
- Technical impact
- total
- Assessed
- last yr.
Exploit prediction
1.18% chance of exploitation in the next 30 days, higher than 67% of all scored CVEs (FIRST EPSS, 2026-11-09).
CVSS scores
| assigned by | version | score | vector |
|---|---|---|---|
| CNA | 3.1 | 8.1 | CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:H |
| NVD | 3.1 | 9.8 | CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H |
| NVD | 2.0 | 6.8 | AV:N/AC:M/Au:N/C:P/I:P/A:P |
| GitHub | 3.1 | 8.1 | CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:H |
Affected packages
| ecosystem | package | affected | fixed in |
|---|---|---|---|
| crates.io | wasmtime | <0.34.2 >=0.35.0, <0.35.2 >=0.0.0-0, <0.34.2 >=0.34.0, <0.34.2 |
0.34.2 0.35.2 |
Affected products
- bytecodealliance wasmtime
Classification
- Weakness
-
- CWE-416 Use After Free
References
-
github.com
/bytecodealliance/wasmtime/commit/666c2554ea0e1728c35aa41178cf235920db888a
web, patch, third-party-advisory
-
github.com
/bytecodealliance/wasmtime/security/advisories/GHSA-gwc9-348x-qwv2
web, mitigation, third-party-advisory
-
nvd.nist.gov
/vuln/detail/CVE-2022-24791
advisory
-
docs.rs
/wasmtime/latest/wasmtime/struct.Config.html#method.epoch_interruption
web
-
github.com
/WebAssembly/reference-types
web
-
github.com
/bytecodealliance/wasmtime
package
-
rustsec.org
/advisories/RUSTSEC-2022-0016.html
web, advisory
-
rustsec.org
/advisories/RUSTSEC-2022-0099.html
web, advisory
-
crates.io
/crates/wasmtime
package
Sources
- CVE List CVE-2022-24791
- GitHub Advisory GHSA-gwc9-348x-qwv2
- NVD CVE-2022-24791
- OSV RUSTSEC-2022-0099
- OSV RUSTSEC-2022-0016
Fencer Intel keeps one entry per vulnerability: the CVE id wins, then GHSA, and records that alias each other are merged, except that two CVEs always keep separate entries. The same data is available as JSON.