ghsa-5fhj-g3p3-pq9g
Vulnerability from github
There is a bug in Wasmtime's code generator, Cranelift, where functions using reference types may be incorrectly missing metadata required for runtime garbage collection (GC). This means that if a GC happens at runtime then the collector will mistakenly think some Wasm stack frames do not have live references to garbage collected values and therefore reclaim and deallocate them. The function can then subsequently continue to use the values, leading later to use-after-free bugs. This bug was introduced in Cranelift's migration to the regalloc2
register allocator 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 doing one of:
- Disabling the reference types proposal by passing
false
towasmtime::Config::wasm_reference_types
. - Downgrading to Wasmtime 0.36.0 or prior.
{ "affected": [ { "package": { "ecosystem": "crates.io", "name": "wasmtime" }, "ranges": [ { "events": [ { "introduced": "0.37.0" }, { "fixed": "0.38.2" } ], "type": "ECOSYSTEM" } ] }, { "package": { "ecosystem": "crates.io", "name": "cranelift-codegen" }, "ranges": [ { "events": [ { "introduced": "0.84.0" }, { "fixed": "0.85.2" } ], "type": "ECOSYSTEM" } ] } ], "aliases": [ "CVE-2022-31146" ], "database_specific": { "cwe_ids": [ "CWE-416" ], "github_reviewed": true, "github_reviewed_at": "2022-07-20T22:47:13Z", "nvd_published_at": "2022-07-21T04:15:00Z", "severity": "MODERATE" }, "details": "There is a bug in Wasmtime\u0027s code generator, Cranelift, where functions using reference types may be incorrectly missing metadata required for runtime garbage collection (GC). This means that if a GC happens at runtime then the collector will mistakenly think some Wasm stack frames do not have live references to garbage collected values and therefore reclaim and deallocate them. The function can then subsequently continue to use the values, leading later to use-after-free bugs. This bug was introduced in Cranelift\u0027s migration to the `regalloc2` register allocator 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.\n\nMitigations for this issue can be achieved by doing one of:\n\n* Disabling the reference types proposal by passing `false` to [`wasmtime::Config::wasm_reference_types`](https://docs.rs/wasmtime/0.38.0/wasmtime/struct.Config.html#method.wasm_reference_types).\n* Downgrading to Wasmtime 0.36.0 or prior.", "id": "GHSA-5fhj-g3p3-pq9g", "modified": "2022-08-05T13:56:03Z", "published": "2022-07-20T22:47:13Z", "references": [ { "type": "WEB", "url": "https://github.com/bytecodealliance/wasmtime/security/advisories/GHSA-5fhj-g3p3-pq9g" }, { "type": "ADVISORY", "url": "https://nvd.nist.gov/vuln/detail/CVE-2022-31146" }, { "type": "WEB", "url": "https://github.com/bytecodealliance/wasmtime/commit/2ba4bce5cc719e5a74e571a534424614e62ecc41" }, { "type": "WEB", "url": "https://github.com/WebAssembly/reference-types" }, { "type": "PACKAGE", "url": "https://github.com/bytecodealliance/wasmtime" } ], "schema_version": "1.4.0", "severity": [ { "score": "CVSS:3.1/AV:N/AC:H/PR:L/UI:N/S:U/C:H/I:L/A:L", "type": "CVSS_V3" } ], "summary": "Wasmtime vulnerable to Use After Free with `externref`s" }
Sightings
Author | Source | Type | Date |
---|
Nomenclature
- Seen: The vulnerability was mentioned, discussed, or seen somewhere by the user.
- Confirmed: The vulnerability is confirmed from an analyst perspective.
- Exploited: This vulnerability was exploited and seen by the user reporting the sighting.
- Patched: This vulnerability was successfully patched by the user reporting the sighting.
- Not exploited: This vulnerability was not exploited or seen by the user reporting the sighting.
- Not confirmed: The user expresses doubt about the veracity of the vulnerability.
- Not patched: This vulnerability was not successfully patched by the user reporting the sighting.