CVE-2022-31146Use After Free in Wasmtime
Wasmtime is a standalone runtime for WebAssembly. There is a bug in the Wasmtime's code generator, Cranelift, where functions using reference types may be incorrectly missing metadata required for runtime garbage collection. This means that if a GC happens at runtime then the GC pass will mistakenly think these functions do not have live references to GC'd values, reclaiming them and deallocating them. The function will then subsequently continue to use the values assuming they had not been GC'd, leading later to a use-after-free. This bug was introduced in the migration to the `regalloc2` register allocator that occurred in the Wasmtime 0.37.0 release on 2022-05-20. This bug has been patched and users should upgrade to Wasmtime version 0.38.2. Mitigations for this issue can be achieved by disabling the reference types proposal by passing `false` to `wasmtime::Config::wasm_reference_types` or downgrading to Wasmtime 0.36.0 or prior.
What to do
Fixed builds are available from crates.io: see the table below for the fixed version per release.
Is your server affected? One read-only command checks every installed package against this CVE and all others, using each vendor's fixed versions. Get started or get a free API key.
curl -sS "https://api.cvefocus.com/v1/check?format=text" -H "Authorization: Bearer $CVEFOCUS_KEY" \ -H "Content-Type: text/plain" --data-binary @inventory.txt
Vendor status at a glance
Status by vendor and release
From each vendor's own security data and VEX statements. "Fixed" means a fixed build is published for that release.
| Release | Package | Status | Fixed version | Advisory |
|---|---|---|---|---|
| Ubuntu 24.04 | firefox | Not affected vulnerable_code_not_present | ||
| Ubuntu 24.04 | thunderbird | Will not fix mozjs contains a copy of the SpiderMonkey JavaScript engine starting with Ubuntu 22.04, the firefox package is just a script that installs the Firefox snap… | UBUNTU-CVE-2022-31146 | |
| Ubuntu 22.04 | firefox | Not affected vulnerable_code_not_present | ||
| Ubuntu 22.04 | mozjs78 | Will not fix mozjs contains a copy of the SpiderMonkey JavaScript engine starting with Ubuntu 22.04, the firefox package is just a script that installs the Firefox snap… | UBUNTU-CVE-2022-31146 | |
| Ubuntu 22.04 | mozjs91 | Will not fix mozjs contains a copy of the SpiderMonkey JavaScript engine starting with Ubuntu 22.04, the firefox package is just a script that installs the Firefox snap… | UBUNTU-CVE-2022-31146 | |
| Ubuntu 22.04 | thunderbird | Will not fix mozjs contains a copy of the SpiderMonkey JavaScript engine starting with Ubuntu 22.04, the firefox package is just a script that installs the Firefox snap… | UBUNTU-CVE-2022-31146 | |
| Ubuntu 20.04 | firefox | Will not fix mozjs contains a copy of the SpiderMonkey JavaScript engine starting with Ubuntu 22.04, the firefox package is just a script that installs the Firefox snap… | ||
| Ubuntu 20.04 | mozjs52 | Will not fix mozjs contains a copy of the SpiderMonkey JavaScript engine starting with Ubuntu 22.04, the firefox package is just a script that installs the Firefox snap… | UBUNTU-CVE-2022-31146 | |
| Ubuntu 20.04 | mozjs68 | Will not fix mozjs contains a copy of the SpiderMonkey JavaScript engine starting with Ubuntu 22.04, the firefox package is just a script that installs the Firefox snap… | UBUNTU-CVE-2022-31146 | |
| Ubuntu 20.04 | thunderbird | Will not fix mozjs contains a copy of the SpiderMonkey JavaScript engine starting with Ubuntu 22.04, the firefox package is just a script that installs the Firefox snap… | ||
| Ubuntu 18.04 | firefox | Will not fix mozjs contains a copy of the SpiderMonkey JavaScript engine starting with Ubuntu 22.04, the firefox package is just a script that installs the Firefox snap… | ||
| Ubuntu 18.04 | mozjs38 | Will not fix mozjs contains a copy of the SpiderMonkey JavaScript engine starting with Ubuntu 22.04, the firefox package is just a script that installs the Firefox snap… | UBUNTU-CVE-2022-31146 | |
| Ubuntu 18.04 | mozjs52 | Will not fix mozjs contains a copy of the SpiderMonkey JavaScript engine starting with Ubuntu 22.04, the firefox package is just a script that installs the Firefox snap… | UBUNTU-CVE-2022-31146 | |
| Ubuntu 18.04 | thunderbird | Will not fix mozjs contains a copy of the SpiderMonkey JavaScript engine starting with Ubuntu 22.04, the firefox package is just a script that installs the Firefox snap… | ||
| Ubuntu 16.04 | firefox | Will not fix mozjs contains a copy of the SpiderMonkey JavaScript engine starting with Ubuntu 22.04, the firefox package is just a script that installs the Firefox snap… | ||
| Ubuntu 16.04 | thunderbird | Will not fix mozjs contains a copy of the SpiderMonkey JavaScript engine starting with Ubuntu 22.04, the firefox package is just a script that installs the Firefox snap… | ||
| Ubuntu 14.04 | firefox | Will not fix mozjs contains a copy of the SpiderMonkey JavaScript engine starting with Ubuntu 22.04, the firefox package is just a script that installs the Firefox snap… | ||
| Ubuntu 14.04 | thunderbird | Will not fix mozjs contains a copy of the SpiderMonkey JavaScript engine starting with Ubuntu 22.04, the firefox package is just a script that installs the Firefox snap… | ||
| crates.io library | cranelift-codegen | Fixed | 0.85.2 | GHSA-5fhj-g3p3-pq9g |
| crates.io library | wasmtime | Fixed | 0.38.2 | GHSA-5fhj-g3p3-pq9g |
What the vendor says
As published in the CVE record by GitHub_M, the CVE's assigner (usually the vendor). Check the vendor's advisory before acting.
- bytecodealliance wasmtime: affected: >= 0.37.0, < 0.38.2, >= 0.84.0, < 0.85.2
References
- https://github.com/bytecodealliance/wasmtime/security/advisories/GHSA-5fhj-g3p3-pq9g
- https://github.com/WebAssembly/reference-types
- https://github.com/bytecodealliance/wasmtime/
About this page
Compiled by CVEfocus from the CVE List, the security data and VEX statements of Ubuntu, Debian, Red Hat, AlmaLinux, Rocky Linux and Microsoft, CISA's Known Exploited Vulnerabilities catalog and FIRST EPSS, refreshed several times a day (data status). Information only; see the disclaimer. Official record: cve.org · NVD.