# CVE-2022-39394: wasmtime_trap_code C API function has out of bounds write vulnerability

- Severity: Low 3.8 (CVSS:3.1, scored by GitHub_M) `CVSS:3.1/AV:L/AC:H/PR:H/UI:R/S:U/C:L/I:L/A:L`
- Known to be exploited: not in CISA's catalogue, which lists only what CISA has confirmed
- Likelihood of exploitation in the next 30 days (EPSS): 0.43%, higher than 39% of CVEs (2026-12-01)
- Published: 2022-11-07T12:00:00.000Z
- Modified: 2026-10-12T18:00:06.112Z
- Also known as: GHSA-h84q-m8rr-3v9q, RUSTSEC-2022-0097
- Weaknesses: CWE-787
- SSVC (CISA-ADP): exploitation none, automatable no, technical impact partial
- Assigned by: GitHub_M

## 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.

(As written by CVE List.)

## Affected

- bytecodealliance wasmtime: < 2.0.2; before 1.0.2; from 2.0.0 before 2.0.2
- wasmtime (crates.io): from 2.0.0 before 2.0.2; before 1.0.2; from 0.0.0-0 before 1.0.2

## Every score

- GitHub_M: CVSS:3.1 3.8 Low `CVSS:3.1/AV:L/AC:H/PR:H/UI:R/S:U/C:L/I:L/A:L`
- GitHub: CVSS:3.1 3.8 Low `CVSS:3.1/AV:L/AC:H/PR:H/UI:R/S:U/C:L/I:L/A:L`
- RustSec Advisory Database: CVSS:3.1 3.8 Low `CVSS:3.1/AV:L/AC:H/PR:H/UI:R/S:U/C:L/I:L/A:L`
- NVD: CVSS:3.1 9.8 Critical `CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H`

## References

- <https://github.com/bytecodealliance/wasmtime/security/advisories/GHSA-h84q-m8rr-3v9q> (third-party-advisory, web)
- <https://github.com/bytecodealliance/wasmtime/commit/087d9d7becf7422b3f872a3bcd5d97bb7ce7ff36> (patch, third-party-advisory, web)
- <https://nvd.nist.gov/vuln/detail/CVE-2022-39394> (advisory)
- <https://github.com/bytecodealliance/wasmtime/commit/5b6d5e78de106503b3b9add218bb3d2b1d63c493> (web)
- <https://github.com/bytecodealliance/wasmtime> (package)
- <https://groups.google.com/a/bytecodealliance.org/g/sec-announce/c/c1HBDDJwNPA> (web)
- <https://rustsec.org/advisories/RUSTSEC-2022-0097.html> (advisory, web)
- <https://crates.io/crates/wasmtime> (package)

## Sources

- CVE List: [CVE-2022-39394](https://www.cve.org/CVERecord?id=CVE-2022-39394), CVE Terms of Use, modified 2025-04-23
- GitHub Advisory Database: [GHSA-h84q-m8rr-3v9q](https://github.com/advisories/GHSA-h84q-m8rr-3v9q), CC-BY-4.0, modified 2025-05-02
- RustSec Advisory Database: [RUSTSEC-2022-0097](https://rustsec.org/advisories/RUSTSEC-2022-0097.html), CC0-1.0, modified 2026-10-12
- NVD: [CVE-2022-39394](https://nvd.nist.gov/vuln/detail/CVE-2022-39394), Public domain, modified 2026-06-17

---

Page: https://cve.day/CVE-2022-39394 · Whole record: https://cve.day/CVE-2022-39394.json · Rebuilt by cve.day 2026-11-25T22:58:16.387Z
