# GHSA-9ghp-w2hm-vfpf: Dump Undefined Memory by `JitDumpFile`

> An internal Wasmtime crate allows dumping undefined memory to a file due to unsound pointer handling, potentially leaking sensitive data.

- **Severity:** Not scored
- **Exploited in the wild:** Not known
- **Login needed:** Not needed
- **Attackable:** Not stated
- **Victim action needed:** Not needed
- **Fix available:** Yes
- **Published:** 6 Jul 2024
- **Also known as:** RUSTSEC-2024-0442

## What is GHSA-9ghp-w2hm-vfpf?

GHSA-9ghp-w2hm-vfpf is a vulnerability in wasmtime-jit-debug, published on 6 Jul 2024. 

### Official description

The unsound function `dump_code_load_record` uses `from_raw_parts` to directly convert 
the pointer `addr` and `len` into a slice without any validation and that memory block 
would be dumped.

Thus, the 'safe' function dump_code_load_record is actually 'unsafe' since it requires 
the caller to guarantee that the addr is valid and len must not overflow.
Otherwise, the function could dump the memory into file illegally, causing memory leak.

> **Note**: this is an internal-only crate in the Wasmtime project not intended for
external use and is more strongly signaled nowadays as of
[bytecodealliance/wasmtime#10963](https://github.com/bytecodealliance/wasmtime/pull/10963).
Please open an issue in Wasmtime if you're using this crate directly.

## Which versions are affected by GHSA-9ghp-w2hm-vfpf?

3 open source packages ship an affected version, including wasmtime-jit-debug.


| Package | Ecosystem | Affected | Fixed in |
| --- | --- | --- | --- |
| `wasmtime-jit-debug` | crates.io | All versions | 24.0.0 |
| `wasmtime-jit-debug` | crates.io | All versions | 24.0.0 |
| `wasmtime-jit-debug` | crates.io | From 0.0.0-0 | 24.0.0 |

## How do I fix GHSA-9ghp-w2hm-vfpf?

Upgrade wasmtime-jit-debug to 24.0.0 or later.

## Is GHSA-9ghp-w2hm-vfpf being exploited?

There is no known exploitation of GHSA-9ghp-w2hm-vfpf in the wild and no public exploit code.

## Fix prompt for AI coding agents

```text
Check this codebase for GHSA-9ghp-w2hm-vfpf and fix it if it is affected.

What it is: GHSA-9ghp-w2hm-vfpf is a vulnerability in wasmtime-jit-debug, published on 6 Jul 2024. 
Exploitation: There is no known exploitation of GHSA-9ghp-w2hm-vfpf in the wild and no public exploit code.

Affected packages and fixed versions:
- wasmtime-jit-debug (crates.io): affected all versions; fixed in 24.0.0
- wasmtime-jit-debug (crates.io): affected all versions; fixed in 24.0.0
- wasmtime-jit-debug (crates.io): affected from 0.0.0-0; fixed in 24.0.0

Task:
1. Search the dependency manifests and lockfiles (for example package.json, package-lock.json, requirements.txt, poetry.lock, uv.lock, pom.xml, build.gradle, go.mod, Cargo.lock, Gemfile.lock) and any Dockerfiles for the affected packages, including transitive dependencies.
2. If an affected version is in use, upgrade it to the fixed version for its release line with the project's package manager, so the lockfile is regenerated. Prefer the smallest upgrade that fixes it.
3. If there is no fix, or the upgrade would break the build, do not guess: explain the risk and the safest workaround instead.
4. Run the tests and summarise what changed and why.
5. If nothing in the project is affected, say so and change nothing.

Reference: https://insights.sbomify.com/GHSA-9ghp-w2hm-vfpf/ (Markdown: https://insights.sbomify.com/GHSA-9ghp-w2hm-vfpf/index.md)
```

## Sources

- OSV: https://osv.dev/vulnerability/GHSA-9ghp-w2hm-vfpf

---
From sbomify Insights: https://insights.sbomify.com/GHSA-9ghp-w2hm-vfpf/
Summaries are generated and may contain mistakes; the official description above is the record.
