CVE-2023-26489
Severity CVSS v4.0:
Pending analysis
Type:
CWE-125
Out-of-bounds Read
Publication date:
08/03/2023
Last modified:
07/11/2023
Description
wasmtime is a fast and secure runtime for WebAssembly. In affected versions wasmtime's code generator, Cranelift, has a bug on x86_64 targets where address-mode computation mistakenly would calculate a 35-bit effective address instead of WebAssembly's defined 33-bit effective address. This bug means that, with default codegen settings, a wasm-controlled load/store operation could read/write addresses up to 35 bits away from the base of linear memory. Due to this bug, however, addresses up to `0xffffffff * 8 + 0x7ffffffc = 36507222004 = ~34G` bytes away from the base of linear memory are possible from guest code. This means that the virtual memory 6G away from the base of linear memory up to ~34G away can be read/written by a malicious module. A guest module can, without the knowledge of the embedder, read/write memory in this region. The memory may belong to other WebAssembly instances when using the pooling allocator, for example. Affected embedders are recommended to analyze preexisting wasm modules to see if they're affected by the incorrect codegen rules and possibly correlate that with an anomalous number of traps during historical execution to locate possibly suspicious modules. The specific bug in Cranelift's x86_64 backend is that a WebAssembly address which is left-shifted by a constant amount from 1 to 3 will get folded into x86_64's addressing modes which perform shifts. For example `(i32.load (i32.shl (local.get 0) (i32.const 3)))` loads from the WebAssembly address `$local0
Impact
Base Score 3.x
9.90
Severity 3.x
CRITICAL
Vulnerable products and versions
| CPE | From | Up to |
|---|---|---|
| cpe:2.3:a:bytecodealliance:cranelift-codegen:*:*:*:*:*:rust:*:* | 0.84.0 (including) | 0.91.1 (excluding) |
| cpe:2.3:a:bytecodealliance:cranelift-codegen:0.92.0:*:*:*:*:rust:*:* | ||
| cpe:2.3:a:bytecodealliance:cranelift-codegen:0.93.0:*:*:*:*:rust:*:* | ||
| cpe:2.3:a:bytecodealliance:wasmtime:*:*:*:*:*:rust:*:* | 0.37.0 (including) | 4.0.1 (excluding) |
| cpe:2.3:a:bytecodealliance:wasmtime:5.0.0:*:*:*:*:rust:*:* | ||
| cpe:2.3:a:bytecodealliance:wasmtime:6.0.0:*:*:*:*:rust:*:* |
To consult the complete list of CPE names with products and versions, see this page
References to Advisories, Solutions, and Tools
- https://docs.rs/wasmtime/latest/wasmtime/struct.Config.html#method.static_memory_guard_size
- https://docs.rs/wasmtime/latest/wasmtime/struct.Config.html#method.static_memory_maximum_size
- https://github.com/bytecodealliance/wasmtime/commit/63fb30e4b4415455d47b3da5a19d79c12f4f2d1f
- https://github.com/bytecodealliance/wasmtime/security/advisories/GHSA-ff4p-7xrq-q5r8
- https://groups.google.com/a/bytecodealliance.org/g/sec-announce/c/Mov-ItrNJsQ



