{"cve":"CVE-2022-31146","nvd":{"published":"2022-07-21T04:15:11.937","modified":"2026-06-17T04:44:54.013","status":"Modified","description":"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.","cvss_v4":null,"cvss_v3":{"version":"3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H","score":8.8},"cwes":["CWE-416"],"references":["https://github.com/WebAssembly/reference-types","https://github.com/bytecodealliance/wasmtime/","https://github.com/bytecodealliance/wasmtime/security/advisories/GHSA-5fhj-g3p3-pq9g","https://github.com/WebAssembly/reference-types","https://github.com/bytecodealliance/wasmtime/"],"products":["bytecodealliance:cranelift-codegen","bytecodealliance:wasmtime"],"source":"nvd","synced_at":"2026-10-19T21:33:44.859608815+00:00"},"epss":{"cve":"CVE-2022-31146","score":0.0125,"percentile":0.69405,"date":"2026-10-31"},"kev":null,"osv":[{"id":"GHSA-5fhj-g3p3-pq9g","url":"https://osv.dev/vulnerability/GHSA-5fhj-g3p3-pq9g","summary":"Wasmtime vulnerable to Use After Free with `externref`s","modified":"2025-05-02T12:48:59Z","packages":[{"ecosystem":"crates.io","name":"wasmtime","purl":"pkg:cargo/wasmtime","ranges":[">=0.37.0 <0.38.2"],"fixed":["0.38.2"]},{"ecosystem":"crates.io","name":"cranelift-codegen","purl":"pkg:cargo/cranelift-codegen","ranges":[">=0.84.0 <0.85.2"],"fixed":["0.85.2"]}]},{"id":"RUSTSEC-2022-0100","url":"https://osv.dev/vulnerability/RUSTSEC-2022-0100","summary":"Use After Free with `externref`s in Wasmtime","modified":"2026-10-12T18:00:06.108579592Z","packages":[{"ecosystem":"crates.io","name":"wasmtime","purl":"pkg:cargo/wasmtime","ranges":[">=0.0.0-0 <0.38.2"],"fixed":["0.38.2"]}]}],"attribution":["This product uses the NVD API but is not endorsed or certified by the NVD.","EPSS scores: FIRST Exploit Prediction Scoring System, https://www.first.org/epss","Known exploited vulnerabilities: CISA Known Exploited Vulnerabilities Catalog, https://www.cisa.gov/known-exploited-vulnerabilities-catalog","Package advisories: OSV (https://osv.dev), from the GitHub Advisory Database, PyPA, Go, RustSec and other ecosystem databases, under CC-BY 4.0 or CC0","CVE records: the CVE Program's CVE List (https://www.cve.org), under its terms of use (https://www.cve.org/Legal/TermsOfUse). CVE is a registered trademark of The MITRE Corporation; this product is not affiliated with the CVE Program."]}