CVE-2022-39394 json
wasmtime_trap_code C API function has out of bounds write vulnerability
published 2022-11-07 4 y ago modified 2026-10-12 27 d ago also GHSA-h84q-m8rr-3v9q , RUSTSEC-2022-0097 , EUVD-2024-0651
- cvss
- 3.8
- version 3.1, CNA
- cisa kev
- Not listed
- not in CISA's catalog
- epss
- 0.4%
- EPSS 0.4% chance of exploitation in 30 days, percentile 36%
- public exploits
- 0
- none known
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.
Patch / fix
- crates.io wasmtime 1.0.2, 2.0.2
- bytecodealliance wasmtime 1.0.2, 2.0.2
CISA SSVC
- Exploitation
- none
- Automatable
- no
- Technical impact
- partial
- Assessed
- 18 mo ago
Exploit prediction
0.42% chance of exploitation in the next 30 days, higher than 36% of all scored CVEs (FIRST EPSS, 2026-11-08).
CVSS scores
| assigned by | version | score | vector |
|---|---|---|---|
| CNA | 3.1 | 3.8 | CVSS:3.1/AV:L/AC:H/PR:H/UI:R/S:U/C:L/I:L/A:L |
| NVD | 3.1 | 9.8 | CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H |
| GitHub | 3.1 | 3.8 | CVSS:3.1/AV:L/AC:H/PR:H/UI:R/S:U/C:L/I:L/A:L |
| OSV | 3.1 | 3.8 | CVSS:3.1/AV:L/AC:H/PR:H/UI:R/S:U/C:L/I:L/A:L |
Affected packages
| ecosystem | package | affected | fixed in |
|---|---|---|---|
| crates.io | wasmtime | >=2.0.0, <2.0.2 <1.0.2 >=0.0.0-0, <1.0.2 |
2.0.2 1.0.2 |
Affected products
- bytecodealliance wasmtime
Classification
- Weakness
-
- CWE-787 Out-of-bounds Write
References
-
github.com
/bytecodealliance/wasmtime/commit/087d9d7becf7422b3f872a3bcd5d97bb7ce7ff36
web, patch, third-party-advisory
-
github.com
/bytecodealliance/wasmtime/commit/5b6d5e78de106503b3b9add218bb3d2b1d63c493
web
-
github.com
/bytecodealliance/wasmtime/security/advisories/GHSA-h84q-m8rr-3v9q
web, third-party-advisory
-
nvd.nist.gov
/vuln/detail/CVE-2022-39394
advisory
-
github.com
/bytecodealliance/wasmtime
package
-
groups.google.com
/a/bytecodealliance.org/g/sec-announce/c/c1HBDDJwNPA
web
-
rustsec.org
/advisories/RUSTSEC-2022-0097.html
web, advisory
-
crates.io
/crates/wasmtime
package
Sources
- CVE List CVE-2022-39394
- GitHub Advisory GHSA-h84q-m8rr-3v9q
- NVD CVE-2022-39394
- OSV RUSTSEC-2022-0097
Fencer Vulns keeps one entry per vulnerability: the CVE id wins, then GHSA, and records that alias each other are merged, except that two CVEs always keep separate entries. The same data is available as JSON.