{"answers":{"affected":"5 open source packages ship an affected version, including wasmtime and cranelift-codegen. It affects 2 products.","exploited":"There is no known exploitation of CVE-2022-31146 in the wild and no public exploit code.","fix":"Upgrade wasmtime to 0.38.2 or later.","what":"CVE-2022-31146 is a medium-severity use after free vulnerability in bytecodealliance wasmtime, published on 20 Jul 2022. Any signed-in user can exploit it over the network, with no action from the victim."},"fix_prompt":"Check this codebase for CVE-2022-31146 and fix it if it is affected.\n\nWhat it is: CVE-2022-31146 is a medium-severity use after free vulnerability in bytecodealliance wasmtime, published on 20 Jul 2022. Any signed-in user can exploit it over the network, with no action from the victim.\nExploitation: There is no known exploitation of CVE-2022-31146 in the wild and no public exploit code.\n\nAffected packages and fixed versions:\n- wasmtime (crates.io): affected from 0.0.0-0; fixed in 0.38.2\n- wasmtime (crates.io): affected from 0.37.0; fixed in 0.38.2\n- wasmtime (crates.io): affected from 0.37.0; fixed in 0.38.2\n- cranelift-codegen (crates.io): affected from 0.84.0; fixed in 0.85.2\n- cranelift-codegen (crates.io): affected from 0.84.0; fixed in 0.85.2\n\nTask:\n1. Search the dependency manifests and lockfiles (for example package.json, package-lock.json, requirements.txt, poetry.lock, uv.lock, pom.xml, build.gradle, go.mod, Cargo.lock, Gemfile.lock) and any Dockerfiles for the affected packages, including transitive dependencies.\n2. If an affected version is in use, upgrade it to the fixed version for its release line with the project's package manager, so the lockfile is regenerated. Prefer the smallest upgrade that fixes it.\n3. If there is no fix, or the upgrade would break the build, do not guess: explain the risk and the safest workaround instead.\n4. Run the tests and summarise what changed and why.\n5. If nothing in the project is affected, say so and change nothing.\n\nReference: https://insights.sbomify.com/CVE-2022-31146/ (Markdown: https://insights.sbomify.com/CVE-2022-31146/index.md)","id":"CVE-2022-31146","markdown":"https://insights.sbomify.com/CVE-2022-31146/index.md","name":"CVE-2022-31146","record":{"aliases":["GHSA-5fhj-g3p3-pq9g","RUSTSEC-2022-0100","UBUNTU-CVE-2022-31146"],"analysis":{"component_type":"library","fix_type":"upgrade","impacts":["code_execution","denial_of_service"],"network_reachable":"yes","non_default_config":false,"product_category":"WebAssembly runtime","requires_auth":"low_privilege","summary":"A use-after-free vulnerability in Wasmtime's Cranelift code generator allows attackers to execute arbitrary code or cause denial of service via crafted WebAssembly modules.","user_interaction":"not_required","vuln_class":"use_after_free"},"analysis_generated_by":"qwen3.8-flash-next","assigner":"GitHub_M","cpe":[{"product":"cranelift-codegen","vendor":"bytecodealliance"},{"product":"wasmtime","vendor":"bytecodealliance"}],"cvss":{"score":6.4,"severity":"medium","source":"cna","vector":"CVSS:3.1/AV:N/AC:H/PR:L/UI:N/S:U/C:H/I:L/A:L","version":"3.1"},"cwes":[{"id":"CWE-416","name":"Use After Free"}],"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.","ecosystems":["crates.io"],"exploits":{"exploitdb":0,"first_seen":null,"github_poc":0,"max_poc_stars":null,"metasploit":0,"nuclei":0,"refs":[],"tier":"none_known"},"has_fix":true,"headline":"Use After Free in Wasmtime","id":"CVE-2022-31146","indexable":true,"kev":null,"kind":"cve","links":{"ecosystem":"crates.io","product":null,"products":[],"type":"use_after_free","year":"2022"},"n_packages":5,"n_references":3,"next":{"headline":"jquery-validation ReDoS in url2 due to incomplete fix of CVE-2021-43306","id":"CVE-2022-31147"},"packages":[{"ecosystem":"crates.io","fixed":["0.85.2"],"introduced":["0.84.0"],"last_affected":[],"package":"cranelift-codegen","purl":null,"source":"GHSA-5fhj-g3p3-pq9g"},{"ecosystem":"crates.io","fixed":["0.85.2"],"introduced":["0.84.0"],"last_affected":[],"package":"cranelift-codegen","purl":"pkg:cargo/cranelift-codegen","source":"GHSA-5fhj-g3p3-pq9g"},{"ecosystem":"crates.io","fixed":["0.38.2"],"introduced":["0.0.0-0"],"last_affected":[],"package":"wasmtime","purl":"pkg:cargo/wasmtime","source":"RUSTSEC-2022-0100"},{"ecosystem":"crates.io","fixed":["0.38.2"],"introduced":["0.37.0"],"last_affected":[],"package":"wasmtime","purl":null,"source":"GHSA-5fhj-g3p3-pq9g"},{"ecosystem":"crates.io","fixed":["0.38.2"],"introduced":["0.37.0"],"last_affected":[],"package":"wasmtime","purl":"pkg:cargo/wasmtime","source":"GHSA-5fhj-g3p3-pq9g"}],"prev":{"headline":"Insufficient AccessToken Expiration Check in FlyteAdmin","id":"CVE-2022-31145"},"products":["wasmtime"],"published":"2022-07-20","related":[{"cvss_score":10,"headline":"Guest-controlled out-of-bounds read/write on x86_64 in wasmtime","id":"CVE-2023-26489","kev_date_added":null,"published":"2023-03-08"},{"cvss_score":7.2,"headline":"Memory access due to code generation flaw in Cranelift module","id":"CVE-2021-32629","kev_date_added":null,"published":"2021-05-24"},{"cvss_score":5.9,"headline":"Cranelift vulnerable to miscompilation of constant values in division on AArch64","id":"CVE-2022-31169","kev_date_added":null,"published":"2022-07-21"},{"cvss_score":4.8,"headline":"Miscompilation of `i8x16.swizzle` and `select` with v128 inputs in Wasmtime","id":"CVE-2022-31104","kev_date_added":null,"published":"2022-06-27"},{"cvss_score":3.1,"headline":"wasmtime vulnerable to miscompilation of `i8x16.select` with the same inputs on x86_64","id":"CVE-2023-27477","kev_date_added":null,"published":"2023-03-08"}],"sources":[{"class":"attribution","licence":"CVE Terms of Use (MITRE)","name":"CVE List","prefix":"CVE"},{"class":"attribution","licence":"CC BY 4.0","name":"GitHub Advisory Database","prefix":"GHSA"},{"class":"open","licence":"CC0 1.0","name":"RustSec","prefix":"RUSTSEC"},{"class":"attribution","licence":"US public information, NVD API terms","name":"NVD"},{"class":"attribution","licence":"CWE Terms of Use","name":"CWE (MITRE)"},{"class":"attribution","licence":"FIRST CVSS licence","name":"CVSS (FIRST)"}],"ssvc":{"automatable":"no","exploitation":"none","technical_impact":"partial"},"state":"PUBLISHED","updated":"2025-04-23","vendors":["bytecodealliance"]},"summary":"A use-after-free vulnerability in Wasmtime's Cranelift code generator allows attackers to execute arbitrary code or cause denial of service via crafted WebAssembly modules.","url":"https://insights.sbomify.com/CVE-2022-31146/"}