Vulnerabilities in pkg:npm/@fastly/js-compute

PACKAGE
Advisory Identifier: GHSA-mp3g-vpm9-9vqv
Advisory Summary

CVE-2024-38375 is a MODERATE (CVSS 5.3) @fastly/js-compute has a use-after-free vulnerability (CWE-416: Use After Free) affecting @fastly/js compute libraries in the npm ecosystem. The issue involves @fastly/js-compute has a use-after-free in some host call implementations. Remediation is available by upgrading affected packages to version 3.16.0.

2 Known Advisory Record(s)
Package Vulnerability Intelligence

pkg:npm/@fastly/js-compute

2 Known Advisory Record(s)

Vulnerability advisories affecting package pkg:npm/@fastly/js-compute. Select an advisory below to view technical details or fixes.

Advisory ID CVE / NVD Severity Summary
GHSA-mp3g-vpm9-9vqv CVE-2024-38375 MODERATE @fastly/js-compute has a use-after-free in some host call implementations
GHSA-cmr8-5w4c-44v8 CVE-2022-39218 HIGH Fastly Compute@Edge JS Runtime has fixed random number seed during compilation

CVE-2024-38375 at a Glance

CVE Identifier CVE-2024-38375
GHSA Identifier GHSA-mp3g-vpm9-9vqv
Severity MODERATE
CVSS v3.1 Base Score 5.3
CWE Classification CWE-416: Use After Free
Affected Product @fastly/js compute
Package Ecosystem npm
Published Date
Last Updated

Security Impact

CVSS: 5.3

The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:H/PR:H/UI:R/S:U/C:L/I:L/A:H).

Attack Vector Network (AV:N)
Attack Complexity High (AC:H)
Privileges Required High (PR:H)
User Interaction Required (UI:R)
Scope Unchanged (S:U)
Confidentiality Low (C:L)
Integrity Low (I:L)
Availability High (A:H)

How to Fix CVE-2024-38375

To remediate this vulnerability, upgrade all affected @fastly/js compute dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.

@fastly/js-compute fixed: 3.16.0
npm install @fastly/js-compute@3.16.0
Verify Direct and Transitive Dependencies

Run the following command in your project directory to verify that all resolved dependencies use the patched release:

npm ls @fastly/js-compute

How to Check if You Are Affected

To determine whether your Node.js application is affected by CVE-2024-38375, inspect your project dependencies using npm:

npm ls @fastly/js-compute

Analyze the terminal output to locate any version of @fastly/js compute in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 3.16.0), your application is affected.

Note: The npm ls @fastly/js-compute command inspects dependencies declared in your package.json and lockfile; it does not perform automated runtime dynamic scanning.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-416: Use After Free, where the product reuses or references memory after it has been freed. at some point afterward, the memory may be allocated again and saved in another pointer, while the original pointer references a location somewhere within the new allocation. any operations using the original pointer are no longer valid because the memory "belongs" to the code that operates on the new pointer. In @fastly/js compute, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.

Source Advisory Statement

### Impact The implementation of the following functions were determined to include a use-after-free bug: * `FetchEvent.client.tlsCipherOpensslName` * `FetchEvent.client.tlsProtocol` * `FetchEvent.client.tlsClientCertificate` * `FetchEvent.client.tlsJA3MD5` * `FetchEvent.client.tlsClientHello` * `CacheEntry.prototype.userMetadata` of the `fastly:cache` subsystem * `Device.lookup` of the `fastly:device` subsystem This bug could allow for an unintended data leak if the result of the preceding functions were sent anywhere else, and often results in a Compute service crash causing an HTTP 500 error to be returned. As all requests to Compute are isolated from one another, the only data at risk is data present for a single request. ### Patches This bug has been fixed in version 3.16.0 of the `@fastly/js-compute` package. ### Workarounds There are no workarounds for this bug, any use of the affected functions introduces the possibility of a data leak or crash in guest code.

CVE-2024-38375 Affected @fastly/js compute Versions

1 component(s)
Fixed Versions:
3.16.0
Product / Package Ecosystem Affected Versions Fixed Version
@fastly/js-compute
npm
≥ 3.0.0
< 3.16.0
3.16.0

References

Frequently Asked Questions

What is CVE-2024-38375?
CVE-2024-38375 is a security vulnerability in @fastly/js compute involving @fastly/js-compute has a use-after-free in some host call implementations under CWE-416: Use After Free.
Which @fastly/js compute versions are affected?
Affected versions include releases prior to 3.16.0 across affected packages: @fastly/js-compute.
What version fixes CVE-2024-38375?
Upgrading to 3.16.0 (or the latest patched release for your respective branch) resolves the vulnerability.
Is @fastly/js-compute affected?
Yes, @fastly/js-compute is affected in releases prior to 3.16.0. Upgrade your dependency to 3.16.0 or later.
What is the CVSS score of CVE-2024-38375?
CVE-2024-38375 has a CVSS v3.1 base score of 5.3 (MODERATE) with vector string CVSS:3.1/AV:N/AC:H/PR:H/UI:R/S:U/C:L/I:L/A:H.
What CWE is associated with CVE-2024-38375?
CVE-2024-38375 is classified under CWE-416: Use After Free (The product reuses or references memory after it has been freed. At some point afterward, the memory may be allocated again and saved in another pointer, while the original pointer references a location somewhere within the new allocation. Any operations using the original pointer are no longer valid because the memory "belongs" to the code that operates on the new pointer.).
How can I check npm dependencies for CVE-2024-38375?
Run the dependency tree command: 'npm ls @fastly/js-compute'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "schema_version" : "1.4.0",
  "id" : "GHSA-mp3g-vpm9-9vqv",
  "modified" : "2024-06-26T21:56:15Z",
  "published" : "2024-06-26T19:12:23Z",
  "aliases" : [ "CVE-2024-38375" ],
  "summary" : "@fastly/js-compute has a use-after-free in some host call implementations",
  "details" : "### Impact\nThe implementation of the following functions were determined to include a use-after-free bug:\n\n* `FetchEvent.client.tlsCipherOpensslName`\n* `FetchEvent.client.tlsProtocol`\n* `FetchEvent.client.tlsClientCertificate`\n* `FetchEvent.client.tlsJA3MD5`\n* `FetchEvent.client.tlsClientHello`\n* `CacheEntry.prototype.userMetadata` of the `fastly:cache` subsystem\n* `Device.lookup` of the `fastly:device` subsystem\n\nThis bug could allow for an unintended data leak if the result of the preceding functions were sent anywhere else, and often results in a Compute service crash causing an HTTP 500 error to be returned. As all requests to Compute are isolated from one another, the only data at risk is data present for a single request.\n\n### Patches\nThis bug has been fixed in version 3.16.0 of the `@fastly/js-compute` package.\n\n### Workarounds\nThere are no workarounds for this bug, any use of the affected functions introduces the possibility of a data leak or crash in guest code.",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:H/PR:H/UI:R/S:U/C:L/I:L/A:H"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "npm",
      "name" : "@fastly/js-compute"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "3.0.0"
      }, {
        "fixed" : "3.16.0"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/fastly/js-compute-runtime/security/advisories/GHSA-mp3g-vpm9-9vqv"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2024-38375"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/fastly/js-compute-runtime/commit/4e16641ef4e159c4a11b500ac861b8fa8d9ff5d3"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/fastly/js-compute-runtime"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-416" ],
    "severity" : "MODERATE",
    "github_reviewed" : true,
    "github_reviewed_at" : "2024-06-26T19:12:23Z",
    "nvd_published_at" : "2024-06-26T19:15:13Z"
  }
}