wasmtime_trap_code C API function has out of bounds write vulnerability
Key facts
- Attack vector
- Network
- Privileges required
- None
- User interaction
- None
- Attack complexity
- Low
- Impact type
- Code execution
- Confidentiality · integrity · availability
- High · High · High
- Fix status
- Fixed
Attack profile from CVSS 3.1 · NVD. Fix status from CNA and GitHub. Impact type from CWE-787 and the CVSS impact.
Summary
Wasmtime is a standalone runtime for WebAssembly. Prior to version 2.0.2, there is a bug in Wasmtime's C API implementation where the definition of the `wasmtime_trap_code` does not match its declared signature in the `wasmtime/trap.h` header file. This discrepancy causes the function implementation to perform a 4-byte write into a 1-byte buffer provided by the caller. This can lead to three zero bytes being written beyond the 1-byte location provided by the caller. This bug has been patched and users should upgrade to Wasmtime 2.0.2. This bug can be worked around by providing a 4-byte buffer casted to a 1-byte buffer when calling `wasmtime_trap_code`. Users of the `wasmtime` crate are not affected by this issue, only users of the C API function `wasmtime_trap_code` are affected.
Why it matters now
SSVC decision points
CISA ADP · SSVC 2.0.3
- Exploitation
- None
- Automatable
- No
- Technical impact
- Partial
The decision (Track, Attend, Act) also depends on your mission and well-being impact; see CISA's SSVC guide.
Affected products
| Vendor | Product | Affected versions | Fixed in | Status | Source |
|---|---|---|---|---|---|
| bytecodealliance | wasmtime | before 2.0.2 | 2.0.2 | Patch available | CNA |
| — | wasmtime (crates.io) | 2.0.0 to before 2.0.2 | 2.0.2 | Patch available | GHSA-h84q-m8rr-3v9q |
| — | wasmtime (crates.io) | before 1.0.2 | 1.0.2 | Patch available | GHSA-h84q-m8rr-3v9q |
- wasmtime Vendorbytecodealliance Affected before 2.0.2 Fixed in 2.0.2 Patch available CNA
- wasmtime (crates.io) Vendor— Affected 2.0.0 to before 2.0.2 Fixed in 2.0.2 Patch available GHSA-h84q-m8rr-3v9q
- wasmtime (crates.io) Vendor— Affected before 1.0.2 Fixed in 1.0.2 Patch available GHSA-h84q-m8rr-3v9q
CPE configurations NVD · 1
| CPE | Versions | Role | Vendor |
|---|---|---|---|
| cpe:2.3:a:bytecodealliance:wasmtime:*:*:*:*:*:rust:*:* | before 1.0.2; 2.0.0 to before 2.0.2 | Vulnerable | bytecodealliance |
- cpe:2.3:a:bytecodealliance:wasmtime:*:*:*:*:*:rust:*:* Versions before 1.0.2; 2.0.0 to before 2.0.2 Vulnerable ·bytecodealliance
Remediation
- Fix · CNA wasmtime (bytecodealliance) Fixed in 2.0.2
- Fix · GHSA-h84q-m8rr-3v9q wasmtime (crates.io) Fixed in 2.0.2 Advisory →
- Fix · GHSA-h84q-m8rr-3v9q wasmtime (crates.io) Fixed in 1.0.2 Advisory →
Timeline
- 2026-10-02 Threatist record created from CVE-2022-39394
- 2026-10-03 Alias added: GHSA-h84q-m8rr-3v9q
References
Advisory 2
More bytecodealliance Wasmtime vulnerabilities
- TI-2026-21632 Wasmtime is vulnerable to panic when dropping a `[Typed]Func::call_async` future CVSS 4.0MEDIUM 6.9
- TI-2023-11636 Guest-controlled out-of-bounds read/write on x86_64 in wasmtime CVSS 3.1CRITICAL 10.0
- TI-2022-18765 Wasmtime vulnerable to data leakage between instances in the pooling allocator CVSS 3.1HIGH 8.6
- TI-2022-08604 Use after free in Wasmtime CVSS 3.1CRITICAL 9.8
- TI-2026-27209 Wasmtime with Winch compiler backend on aarch64 may allow a sandbox-escaping memory access CVSS 4.0CRITICAL 9.0
- TI-2026-27193 Wasmtime miscompiled guest heap access enables sandbox escape on aarch64 Cranelift CVSS 4.0CRITICAL 9.0
Sources
- CVE-2022-39394 · CVE Program
- CVE-2022-39394 · NVD
- FIRST EPSS
- GHSA-h84q-m8rr-3v9q · GitHub Advisory Database · CC BY 4.0
This product uses the NVD API but is not endorsed or certified by the NVD. Sources and licences