# CVE-2024-38375: @fastly/js-compute use-after-free in some host call implementations

> A use-after-free bug in the Fastly JS Compute SDK can cause service crashes and potential data loss, requiring an upgrade to the latest version.

- **Severity:** Medium 5.3 (`CVSS:3.1/AV:N/AC:H/PR:H/UI:R/S:U/C:L/I:L/A:H`)
- **Exploited in the wild:** Not known
- **Login needed:** An administrator
- **Attackable:** Over the internet
- **Victim action needed:** A user has to click or open something
- **Fix available:** Yes
- **Published:** 26 Jun 2024
- **Updated:** 2 Aug 2024
- **Also known as:** GHSA-mp3g-vpm9-9vqv

## What is CVE-2024-38375?

CVE-2024-38375 is a medium-severity use after free vulnerability in fastly js-compute-runtime, published on 26 Jun 2024. An attacker needs administrator access to exploit it, and only if a user opens a file or follows a link.

### Official description

@fastly/js-compute is a JavaScript SDK and runtime for building Fastly Compute applications. The implementation of several functions were determined to include a use-after-free bug. This bug could allow for unintended data loss if the result of the preceding functions were sent anywhere else, and often results in a guest trap causing services to return a 500. This bug has been fixed in version 3.16.0 of the `@fastly/js-compute` package.

Weakness: CWE-416 (Use After Free)

## Which versions are affected by CVE-2024-38375?

2 open source packages ship an affected version, including @fastly/js-compute.


| Package | Ecosystem | Affected | Fixed in |
| --- | --- | --- | --- |
| `@fastly/js-compute` | npm | From 3.0.0 | 3.16.0 |
| `@fastly/js-compute` | npm | From 3.0.0 | 3.16.0 |

## How do I fix CVE-2024-38375?

Upgrade @fastly/js-compute to 3.16.0 or later.

## Is CVE-2024-38375 being exploited?

There is no known exploitation of CVE-2024-38375 in the wild and no public exploit code.

## Fix prompt for AI coding agents

```text
Check this codebase for CVE-2024-38375 and fix it if it is affected.

What it is: CVE-2024-38375 is a medium-severity use after free vulnerability in fastly js-compute-runtime, published on 26 Jun 2024. An attacker needs administrator access to exploit it, and only if a user opens a file or follows a link.
Exploitation: There is no known exploitation of CVE-2024-38375 in the wild and no public exploit code.

Affected packages and fixed versions:
- @fastly/js-compute (npm): affected from 3.0.0; fixed in 3.16.0
- @fastly/js-compute (npm): affected from 3.0.0; fixed in 3.16.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/CVE-2024-38375/ (Markdown: https://insights.sbomify.com/CVE-2024-38375/index.md)
```

## Sources

- CVE record: https://www.cve.org/CVERecord?id=CVE-2024-38375
- NVD: https://nvd.nist.gov/vuln/detail/CVE-2024-38375
- OSV: https://osv.dev/vulnerability/CVE-2024-38375

---
From sbomify Insights: https://insights.sbomify.com/CVE-2024-38375/
Summaries are generated and may contain mistakes; the official description above is the record.
