LiveActive security incident?Get immediate response
CVE Record

CVE-2021-32629: Memory access due to code generation flaw in Cranelift module

Cranelift is an open-source code generator maintained by Bytecode Alliance. It translates a target-independent intermediate representation into executable machine code. There is a bug in 0.73 of the Cranelift x64 backend that can create a scenario that could result in a potential sandbox escape in a Wasm program. This bug was introduced in the new backend on 2020-09-08 and first included in a release on 2020-09-30, but the new backend was not the default prior to 0.73. The recently-released version 0.73 with default settings, and prior versions with an explicit build flag to select the new backend, are vulnerable. The bug in question performs a sign-extend instead of a zero-extend on a value loaded from the stack, under a specific set of circumstances. If those circumstances occur, the bug could allow access to memory addresses upto 2GiB before the start of the Wasm program heap. If the heap bound is larger than 2GiB, then it would be possible to read memory from a computable range dependent on the size of the heaps bound. The impact of this bug is highly dependent on heap implementation, specifically: * if the heap has bounds checks, and * does not rely exclusively on guard pages, and * the heap bound is 2GiB or smaller * then this bug cannot be used to reach memory from another Wasm program heap. The impact of the vulnerability is mitigated if there is no memory mapped in the range accessible using this bug, for example, if there is a 2 GiB guard region before the Wasm program heap. The bug in question performs a sign-extend instead of a zero-extend on a value loaded from the stack, when the register allocator reloads a spilled integer value narrower than 64 bits. This interacts poorly with another optimization: the instruction selector elides a 32-to-64-bit zero-extend operator when we know that an instruction producing a 32-bit value actually zeros the upper 32 bits of its destination register. Hence, we rely on these zeroed bits, but the type of the value is still i32, and the spill/reload reconstitutes those bits as the sign extension of the i32’s MSB. The issue would thus occur when: * An i32 value in a Wasm program is greater than or equal to 0x8000_0000; * The value is spilled and reloaded by the register allocator due to high register pressure in the program between the value’s definition and its use; * The value is produced by an instruction that we know to be “special” in that it zeroes the upper 32 bits of its destination: add, sub, mul, and, or; * The value is then zero-extended to 64 bits in the Wasm program; * The resulting 64-bit value is used. Under these circumstances there is a potential sandbox escape when the i32 value is a pointer. The usual code emitted for heap accesses zero-extends the Wasm heap address, adds it to a 64-bit heap base, and accesses the resulting address. If the zero-extend becomes a sign-extend, the program could reach backward and access memory up to 2GiB before the start of its heap. In addition to assessing the nature of the code generation bug in Cranelift, we have also determined that under specific circumstances, both Lucet and Wasmtime using this version of Cranelift may be exploitable. See referenced GitHub Advisory for more details.

HighCVSS 7.2Not KEV-listedUpdated
Glexia's TakeAutomated analysishigh

Security readout for executives and security teams

Plain-English summary

A Cranelift code-generation bug could let a malicious Wasm program reach memory outside its heap under specific runtime conditions. This matters most for platforms running untrusted Wasm through affected Cranelift, Wasmtime, or Lucet configurations. The provided sources do not show active exploitation.

Executive priority

Prioritize remediation for any product or service offering customer-controlled Wasm execution. Lower urgency applies to environments without untrusted Wasm or without the affected backend, but asset owners should still confirm versions because sandbox escapes can cross tenant boundaries.

Technical view

In Cranelift 0.73 x64 backend, a spilled narrow integer can be reloaded with sign extension instead of zero extension. If that value becomes a heap pointer after Wasm zero-extension, memory up to 2GiB before the heap may be reachable, depending on heap bounds and guard-region design.

Likely exposure

Exposure is most likely where services execute untrusted Wasm using Cranelift 0.73 defaults, or prior versions explicitly selecting the new x64 backend. Risk depends on whether heap implementation relies on guard pages, heap bound size, and mapped memory before the Wasm heap.

Exploitation context

The CVSS vector requires local access, low privileges, user interaction, and high attack complexity. The source bundle says Wasmtime and Lucet may be exploitable under specific circumstances. KEV is false, and no cited source in the bundle reports active exploitation.

Researcher notes

The bug needs a specific i32 value, register spilling, certain arithmetic or bitwise producers, a zero-extension use, and heap-pointer use. Impact is environment-specific; bounded heaps with suitable checks and no reachable mapped memory before the heap may reduce practical exposure.

Mitigation direction

  • Review Bytecode Alliance and Fastly advisories for the supported fixed release path.
  • Upgrade affected Cranelift, Wasmtime, or Lucet deployments according to vendor guidance.
  • Avoid the vulnerable new x64 backend where upgrade is not immediately possible.
  • Verify heap isolation does not rely exclusively on guard pages in affected environments.
  • Use large guard regions before Wasm heaps where vendor guidance supports that design.

Validation and detection

  • Inventory services that compile or execute untrusted Wasm.
  • Identify Cranelift versions and x64 backend selection flags in builds.
  • Check whether Wasmtime or Lucet embeds the vulnerable Cranelift codegen version.
  • Review heap bounds, guard-page strategy, and pre-heap memory mappings.
  • Confirm patched dependency versions against the vendor advisory or fix commit.
Prepared
Confidence
high
Sources
6

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-788: 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
description · low confidence lookup

Privilege behavior lookup

The CVE wording references privilege impact, so privilege escalation and authorization behavior review may help. This is a Glexia inferred lookup path, not an official MITRE, ATT&CK, or CVE Program mapping.

Open ATT&CK lookup
cve · low confidence lookup

CVE-2021-32629 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
High
CVSS
7.2 (3.1)
Known Exploited
No
Published

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

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
5Source 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
7.2CVSS 3.1HighCVSS:3.1/AV:L/AC:H/PR:L/UI:R/S:C/C:H/I:H/A:N0.85.8Primary CVE score

Vulnerability scoring details

Base CVSS 3.1 score

7.2High
CVSS 3.1 vector shape for CVE-2021-32629Attack VectorAttack ComplexityPrivileges RequiredUser InteractionScopeConfidentiality ImpactIntegrity ImpactAvailability Impact

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

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

Products and packages named in the record

VendorProductVersion / packageStatus
bytecodealliancewasmtime<= 0.73.0Listed
Weakness

CWE details

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

CWE-788 · source CWE mapping

Access of Memory Location After End of Buffer

Access of Memory Location After End of Buffer represents a recurring weakness pattern that can create exploitable paths when design, validation, or implementation controls are missing.