ZeroHour

CVE-2026-90648

mass

Sandbox Escape via Unchecked calloc in wasm2c (WebAssembly wabt) through 1.0.41

CVSS 4.0
7.1 high
EPSS
Published
()
Modified
AI analysis

wasm2c in the WebAssembly Binary Toolkit (wabt) through version 1.0.41 fails to check the return value of calloc() in wasm_rt_allocate_funcref_table(), leaving the funcref table's data pointer NULL while its size retains the guest-declared element count. Because bounds checks still pass, table element accesses (table.get, table.set, call_indirect) resolve to absolute host memory addresses, giving an attacker arbitrary read/write and ultimately arbitrary code execution outside the sandbox — a complete defeat of the isolation wasm2c exists to provide (a 'table flip' attack). The flaw is triggered only when the table allocation fails, which occurs primarily on 32-bit platforms, under RLIMIT_AS limits, with vm.overcommit_memory=2, or under heavy memory pressure; on 64-bit Linux with default overcommit the allocation succeeds and the bug does not fire. The bug was introduced in commit ab9e0b55 (PR #813) and affects downstream in-process sandboxing frameworks RLBox and WasmBoxC, including Firefox, which uses wasm2c to contain untrusted font, media, and XML parsing (Graphite, Hunspell, Ogg, Expat, Woff2). No public proof of concept exists and the issue is not listed in CISA's KEV catalog.

What to do: Upgrade wabt/wasm2c to a release newer than 1.0.41 once a fix is available, rebuild and redeploy all wasm2c-generated code and the bundled wasm-rt runtime, and apply browser vendor updates (e.g., from Mozilla) when patched. As an interim mitigation, run wasm2c-based sandboxes on 64-bit hosts with default memory overcommit and avoid strict RLIMIT_AS or vm.overcommit_memory=2 settings where untrusted WebAssembly executes. Audit crash/OOM logs on 32-bit deployments for failed funcref table allocations as a sign of attempted 'table flip' exploitation.

Affected
WebAssembly wabt (wasm2c)through 1.0.41 (introduced in commit ab9e0b55 / PR #813)
downstream integrations RLBox and WasmBoxC sandboxing frameworks, including Firefox's wasm2c-compiled Graphite, Hunspell, Ogg, Expat, and Woff2
Estimated exposure
mass≈200M+ end users potentially reachable via Firefox's RLBox sandboxing, realistically limited to 32-bit or memory-constrained hosts (likely tens of millions) — Firefox reports on the order of 200 million+ users and ships wasm2c-sandboxed parsing libraries, but the flaw only manifests when the funcref-table allocation fails — chiefly 32-bit builds or memory-starved/overcommit-restricted…

Order-of-magnitude estimate by the model from install counts, market share and public scan data it knows; verify before quoting.

Description

wasm2c in WebAssembly wabt through 1.0.41 allows sandbox escape in some situations that primarily involve 32-bit platforms, aka a "table flip" attack. It does not check the return value of calloc() in wasm_rt_allocate_funcref_table() (wasm2c/wasm-rt-impl-tableops.inc). When the funcref table allocation fails, table->data is left NULL while table->size keeps the guest-declared element count; thus, bounds checks still pass and table element accesses resolve to absolute memory addresses (i * sizeof(wasm_rt_funcref_t)). This gives arbitrary read and write of host process memory and - via table.get, table.set, and call_indirect - arbitrary code execution, defeating the isolation that wasm2c exists to provide (a full sandbox escape). wasm2c is used as an in-process sandboxing boundary by RLBox and WasmBoxC, including in Firefox, which compiles the Graphite, Hunspell, Ogg, Expat, and Woff2 libraries via wasm2c to contain untrusted font, media, and XML input. Therefore, sandboxing in these applications is potentially affected. Exploitation requires the funcref table allocation to fail, for example under an address-space limit (RLIMIT_AS), on 32-bit hosts, with vm.overcommit_memory=2, or under memory pressure. On 64-bit Linux with default overcommit the allocation succeeds and the defect is not triggered. The wasm2c memory allocator aborts on calloc failure in the same runtime; the table allocator lacks this abort behavior. This was introduced in commit ab9e0b55 (PR #813).

Weakness
CWE-252
Vector
CVSS:4.0/AV:L/AC:L/AT:P/PR:N/UI:N/VC:N/VI:H/VA:H/SC:N/SI:H/SA:H/E:X/CR:X/IR:X/AR:X/MAV:X/MAC:X/MAT:X/MPR:X/MUI:X/MVC:X/MVI:X/MVA:X/MSC:X/MSI:X/MSA:X/S:X/AU:X/R:X/V:X/RE:X/U:X

In the news

No ingested article mentions this CVE yet.