CVE-2022-39394
CWE-787Published: November 10, 2022· Updated: Jun 17, 2026
Official Description
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.
Risk Analysis
A memory safety issue in the Wasmtime C API allows a buffer overflow when calling the wasmtime_trap_code function. This critical flaw could lead to unauthorized memory writes, potentially allowing for system compromise.
There is no known public exploit, and it is not in the CISA KEV. The vulnerability is remotely exploitable with low complexity.
Upgrade to Wasmtime version 2.0.2 or use the provided buffer casting workaround when calling the affected function.
Technical Analysis
CVE-2022-39394 can be exploited remotely over the network without requiring physical or adjacent access, significantly expanding the attack surface for threat actors.
The vulnerability requires no privileges and no user interaction, making it a prime target for automated exploitation campaigns and worm-like propagation.
A successful exploit results in complete confidentiality breach (data exposure), full integrity compromise (data manipulation), availability disruption (denial of service), with a CVSS base score of 9.8.
From a weakness classification perspective (CWE-787): Out-of-bounds write vulnerabilities can lead to data corruption, crashes, or arbitrary code execution.
CVSS v3.1 Vector Breakdown
Affected Vendors & Products
Exploit & PoC Resources
Official Patches & Advisories
All References (4)
Quick Facts
Related CVEs (CWE-787)
Recommended Actions
- →Apply vendor patches immediately
- →Monitor CVE-2022-39394 in threat intel feeds
- →Review IDS/IPS signatures for exploitation attempts