LiveActive security incident?Get immediate response
CVE Record

CVE-2022-31146: Use 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.

MediumCVSS 6.4Not KEV-listedUpdated
Glexia's TakeAutomated analysismoderate

Security readout for executives and security teams

Plain-English summary

Wasmtime may mishandle WebAssembly reference values during garbage collection. Under specific conditions, memory that is still in use can be freed and then reused, creating a use-after-free risk. The issue is important where untrusted or tenant-supplied WebAssembly runs in Wasmtime, but the published scoring indicates high attack complexity.

Executive priority

Treat as a moderate-priority platform runtime issue. Escalate if Wasmtime is used for untrusted WebAssembly workloads, because the impact includes potential confidentiality loss. For internal-only trusted WebAssembly, handle through normal dependency remediation timelines unless local risk factors increase exposure.

Technical view

The bug is in Wasmtime's Cranelift code generator. Functions using WebAssembly reference types may miss metadata needed by runtime GC, causing live GC references to be reclaimed and later used. It was introduced with the regalloc2 migration in Wasmtime 0.37.0 and is classified as CWE-416 with CVSS 6.4.

Likely exposure

Exposure is most likely in services embedding Wasmtime to execute untrusted, customer-supplied, or sandboxed WebAssembly with reference types enabled. Affected ranges listed are >=0.37.0 <0.38.2 and >=0.84.0 <0.85.2. Deployments not using Wasmtime or not enabling reference types are less likely exposed.

Exploitation context

The source bundle does not show CISA KEV listing or cited active exploitation. The CVSS vector indicates network reachability, low privileges, no user interaction, and high attack complexity. Practical exploitation depends on an attacker being able to run suitable WebAssembly in an affected Wasmtime environment.

Researcher notes

Key evidence is the vendor advisory and CVE record. The root cause is missing GC metadata for reference-typed functions in Cranelift after regalloc2 migration. The bundle names mitigations and affected ranges, but does not provide exploit details or evidence of exploitation in the wild.

Mitigation direction

  • Upgrade Wasmtime to 0.38.2 or a fixed branch version such as 0.85.2.
  • Disable WebAssembly reference types using wasmtime::Config::wasm_reference_types(false).
  • If upgrade is not immediately possible, downgrade to Wasmtime 0.36.0 or earlier.
  • Prioritize remediation for systems running untrusted or multi-tenant WebAssembly.
  • Check Bytecode Alliance advisory for branch-specific guidance before deployment.

Validation and detection

  • Inventory applications and services embedding Wasmtime.
  • Confirm deployed Wasmtime versions against the affected ranges.
  • Check whether reference types are enabled in runtime configuration.
  • Identify whether untrusted users can submit or influence WebAssembly modules.
  • Run existing unit and integration tests after upgrading or changing runtime configuration.
Prepared
Confidence
high
Sources
5

Generated from the cited source records. This long-tail analysis has not been individually reviewed by a named human.

Potential ATT&CK relevance

Conservative CVE-to-ATT&CK context

These mappings and lookup hints may be relevant to the vulnerability behavior, CWE, affected product, or exposure path. Glexia-inferred context is not an official MITRE, ATT&CK, CWE, or CVE Program mapping.

ATT&CK lookup starting points

Use these exact CWE pages and searches to review the Glexia ATT&CK library from this CVE's weakness and description context.

cwe · low confidence lookup

CWE-416: Exact CWE lookup

Use the exact CWE identifier as the starting point before reviewing related ATT&CK behavior. Open the exact CWE lookup page first, then review the ATT&CK searches from that MITRE weakness context. This is a Glexia lookup hint, not an official ATT&CK mapping.

Open ATT&CK lookup
cve · low confidence lookup

CVE-2022-31146 mapping review

Open the CVE-to-ATT&CK bridge for reviewed, inferred, or future official mappings tied to this CVE.

Open ATT&CK lookup
Vulnerability profileCVE Program record
Severity
Medium
CVSS
6.4 (3.1)
Known Exploited
No
Published

Vector: CVSS:3.1/AV:N/AC:H/PR:L/UI:N/S:U/C:H/I:L/A:L

Official CVE source material

CNA and ADP enrichment extracted from CVE v5

These fields come from the CVE record and ADP containers, not from Glexia's Take. They preserve time-varying source decisions such as CISA SSVC, KEV status, CVSS metrics, and provider references.

1CVSS vectors
0Timeline events
0ADP providers
4Source links

CVSS vector scores

1 official score

We collect every scored CVSS vector available in the official CNA and ADP containers. When more than one version is present, the table keeps the source vectors side by side instead of collapsing them into the highest score.

ScoreVersionSeverityVectorExploitImpactSource
6.4CVSS 3.1MediumCVSS:3.1/AV:N/AC:H/PR:L/UI:N/S:U/C:H/I:L/A:L1.64.7Primary CVE score

Vulnerability scoring details

Base CVSS 3.1 score

6.4Medium
CVSS 3.1 vector shape for CVE-2022-31146Attack VectorAttack ComplexityPrivileges RequiredUser InteractionScopeConfidentiality ImpactIntegrity ImpactAvailability Impact

Vector: CVSS:3.1/AV:N/AC:H/PR:L/UI:N/S:U/C:H/I:L/A:L

Attack Vector
NetworkAdjacentLocalPhysical
Attack Complexity
LowHigh
Privileges Required
NoneLowHigh
User Interaction
NoneRequired
Scope
ChangedUnchanged
Confidentiality Impact
HighLowNone
Integrity Impact
HighLowNone
Availability Impact
HighLowNone

Source materials

Affected products

Products and packages named in the record

VendorProductVersion / packageStatus
bytecodealliancewasmtime>= 0.37.0, < 0.38.2, >= 0.84.0, < 0.85.2Listed
Weakness

CWE details

CWE links open Glexia weakness intelligence pages with official CWE context, developer remediation guidance, and related CVE mappings.

CWE-416 · source CWE mapping

Use After Free

Use After Free represents a recurring weakness pattern that can create exploitable paths when design, validation, or implementation controls are missing.