CVE-2022-39394
wasmtime_trap_code C API function has out of bounds write vulnerability
Also known as GHSA-h84q-m8rr-3v9q, RUSTSEC-2022-0097
Mitigation
- Upgrade wasmtime to one of 2.0.2, 1.0.2 (or later in the same release line).
Who should check
- Projects that depend on crates.io package wasmtime (>= 2.0.0, < 2.0.2)
- Anyone running bytecodealliance wasmtime < 2.0.2
Vulnerability facts
- Affected
- wasmtime >= 2.0.0, < 2.0.2
- Fixed in
- 2.0.2, 1.0.2
- Exploited in the wild
- Not in CISA KEV
- Public exploit / PoC
- None known
- Remote exploitation
- Not remotely exploitable (local or adjacent access needed)
- CVSS
- 3.8 (v3.1, CNA)CVSS:3.1/AV:L/AC:H/PR:H/UI:R/S:U/C:L/I:L/A:LOpen in CVSS calculator
Show all 8 CVSS metrics
- Attack vector: Local
- Attack complexity: High
- Privileges required: High
- User interaction: Required
- Scope: Unchanged
- Confidentiality impact: Low
- Integrity impact: Low
- Availability impact: Low
- EPSS
- 0.47% chance of exploitation in 30 days (percentile 33, 2026-11-26)
- CWE
- CWE-787
- Modified
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.
Affected and fixed versions
| Package / product | Affected | Fixed | Source |
|---|---|---|---|
| crates.io wasmtime | >= 2.0.0, < 2.0.2 | 2.0.2, 1.0.2 | osv |
| bytecodealliance wasmtime | < 2.0.2 | — | cvelist |
Check your systems with an agent
Paste this into Claude Code, Cursor or another coding agent. It only reads; it changes nothing.
Check whether anything I run is affected by CVE-2022-39394. Work read-only: do not install, upgrade, delete or change anything. Details: https://flawdb.com/CVE-2022-39394.md Affected: wasmtime >= 2.0.0, < 2.0.2 Fixed in: 2.0.2, 1.0.2 Steps: 1. Search this machine and project for wasmtime (crates.io), bytecodealliance wasmtime: dependency manifests and lockfiles, installed packages, container images and running services. 2. For each match, note the installed version and whether it is inside the affected range. 3. Report a table: location, installed version, affected (yes / no / unsure), evidence. If affected, say which fixed version or mitigation from the details link applies, but don't apply it.
References
Vendor advisories
Patches
FAQ
Is CVE-2022-39394 being exploited?
There is no confirmed exploitation: CVE-2022-39394 is not in the CISA Known Exploited Vulnerabilities catalog. No public exploit code is known. EPSS estimates a 0.47% chance of exploitation in the next 30 days (as of 2026-11-26).
How serious is CVE-2022-39394?
Low: CVSS 3.8 (v3.1, scored by CNA). Not remotely exploitable (local or adjacent access needed). A user has to take an action, such as opening a link, for the attack to work. The attack needs conditions outside the attacker's control, which makes it harder.
Which versions are affected by CVE-2022-39394?
wasmtime >= 2.0.0, < 2.0.2.
Is there a fix for CVE-2022-39394?
Yes. Fixed in 2.0.2, 1.0.2. Upgrade wasmtime to one of 2.0.2, 1.0.2 (or later in the same release line).
How do I check if I'm affected by CVE-2022-39394?
Find where you use the affected software (dependency lockfiles, installed packages, container images, servers) and compare the installed version with the affected range above. The agent prompt on this page does this read-only.