cve.bz

CVE-2022-31146 bytecodealliance: Use After Free

8.8 highEPSS 1.3%Fix available

High (8.8) in bytecodealliance. EPSS 1.3% estimated probability of exploitation activity in the next 30 days. Fixed in wasmtime 0.38.2.

On this page
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.

Severity

CVSS 3.1

8.8 high
CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H
EPSS
1.3% (unchanged from 1.2% a week ago; 1.2% 30 days ago) estimated probability of exploitation activity in the next 30 days; 71st percentile. Scored 2026-11-22. A forecast for this CVE across the internet, not for your own systems.
CISA's assessment (SSVC)
Exploitation: none · Automatable: no · Technical impact: partial, assessed 2025-04-23. From CISA's Vulnrichment in the CVE List: whether it is exploited, whether exploiting it can be automated, and how much control it gives.
CWE
CWE-416 Use After Free
Published
Modified
NVD analysis
Analyzed, since modified
Record from
the NVD, synced

Fix and patched versions

  • wasmtime (crates.io): fixed in 0.38.2
  • cranelift-codegen (crates.io): fixed in 0.85.2

Ask an AI about this CVE

Show the promptExplain CVE-2022-31146 for an engineer deciding whether to act. Use https://cve.bz/api/public/cves/CVE-2022-31146?via=ask-ai-copy and https://cve.bz/cve/CVE-2022-31146?via=ask-ai-copy as the source of truth: what is affected and which versions fix it, whether it is in CISA KEV, public exploits, and its EPSS (an internet-wide 30-day estimate of exploitation activity, not a forecast for my systems). If they give no fixed versions, use the CVE record https://cveawg.mitre.org/api/cve/CVE-2022-31146 or the vendor advisory, not third-party mirrors. Tell me how to check whether I am affected and how to verify a fix. Cite the sources and say where they are uncertain.

Opens a third-party assistant; its answer is its own, not cve.bz's. The prompt holds only this CVE's id and public links.

Affected

Versions

From the NVD's CPE matches.

ProductAffected
bytecodealliance:cranelift-codegenfrom 0.84.0 before 0.85.2
bytecodealliance:wasmtimefrom 0.37.0 before 0.38.2

Packages (OSV)

AdvisoryEcosystemPackageAffectedFixed in
GHSA-5fhj-g3p3-pq9gcrates.iowasmtime>=0.37.0 <0.38.20.38.2
GHSA-5fhj-g3p3-pq9gcrates.iocranelift-codegen>=0.84.0 <0.85.20.85.2
RUSTSEC-2022-0100crates.iowasmtime>=0.0.0-0 <0.38.20.38.2

Linux distributions

DistributionReleasePackageFixed inAdvisory
Ubuntu18.04:LTSmozjs38, mozjs52no fix listedUBUNTU-CVE-2022-31146
Ubuntu20.04:LTSmozjs52, mozjs68no fix listedUBUNTU-CVE-2022-31146
Ubuntu22.04:LTSmozjs78, mozjs91, thunderbirdno fix listedUBUNTU-CVE-2022-31146
Ubuntu24.04:LTSthunderbirdno fix listedUBUNTU-CVE-2022-31146

From the distributions' data via OSV.dev: Ubuntu Security Notices © Canonical Ltd., CC BY-SA 4.0. Modified: reformatted and linked to CVE records. Credits. On the distributions' own pages: Ubuntu.

References

Check your stackJSON