Vulnerabilities in pkg:npm/@opentelemetry/instrumentation

PACKAGE
Advisory Summary

GHSA-f8pq-3926-8gx5 is a HIGH (CVSS 8.1) unsanitized user controlled input vulnerability (General Security Weakness) affecting @opentelemetry/instrumentation libraries in the npm ecosystem. The issue involves unsanitized user controlled input in module generation. Remediation is available by upgrading affected packages to version 0.41.2.

1 Known Advisory Record(s)
Package Vulnerability Intelligence

pkg:npm/@opentelemetry/instrumentation

1 Known Advisory Record(s)

Vulnerability advisories affecting package pkg:npm/@opentelemetry/instrumentation. Select an advisory below to view technical details or fixes.

Advisory ID CVE / NVD Severity Summary
GHSA-f8pq-3926-8gx5 - HIGH Unsanitized user controlled input in module generation

GHSA-f8pq-3926-8gx5 at a Glance

CVE Identifier N/A
GHSA Identifier GHSA-f8pq-3926-8gx5
Severity HIGH
CVSS v3.1 Base Score 8.1
CWE Classification General Security Weakness
Affected Product @opentelemetry/instrumentation
Package Ecosystem npm
Published Date
Last Updated

Security Impact

CVSS: 8.1

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

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

How to Fix GHSA-f8pq-3926-8gx5

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

@opentelemetry/instrumentation fixed: 0.41.2
npm install @opentelemetry/instrumentation@0.41.2
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 @opentelemetry/instrumentation

How to Check if You Are Affected

To determine whether your Node.js application is affected by GHSA-f8pq-3926-8gx5, inspect your project dependencies using npm:

npm ls @opentelemetry/instrumentation

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

Note: The npm ls @opentelemetry/instrumentation 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 General Security Weakness. In @opentelemetry/instrumentation, 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 `import-in-the-middle` loader used by `@opentelemetry/instrumentation` works by generating a wrapper module on the fly. The wrapper uses the module specifier to load the original module and add some wrapping code. It allows for remote code execution in cases where an application passes user-supplied input directly to an `import()` function. ## Patches This vulnerability has been patched in `@opentelemetry/instrumentation` version `0.41.2` ## Workarounds - Do not pass any user-supplied input to `import()`. Instead, verify it against a set of allowed values. - If using `@opentelemetry/instrumentation` with support for EcmaScript Modules is not needed, ensure that none of the following options are set (either via command-line or the `NODE_OPTIONS` environment variable): ``` --experimental-loader=@opentelemetry/instrumentation/hook.mjs --experimental-loader @opentelemetry/instrumentation/hook.mjs --loader=import-in-the-middle/hook.mjs --loader import-in-the-middle/hook.mjs ``` ## References - https://github.com/DataDog/import-in-the-middle/security/advisories/GHSA-5r27-rw8r-7967

GHSA-f8pq-3926-8gx5 Affected @opentelemetry/instrumentation Versions

1 component(s)
Fixed Versions:
0.41.2
Product / Package Ecosystem Affected Versions Fixed Version
@opentelemetry/instrumentation
npm
≥ 0.40.0
< 0.41.2
0.41.2

References

Frequently Asked Questions

What is GHSA-f8pq-3926-8gx5?
GHSA-f8pq-3926-8gx5 is a security vulnerability in @opentelemetry/instrumentation involving Unsanitized user controlled input in module generation under General Security Weakness.
Which @opentelemetry/instrumentation versions are affected?
Affected versions include releases prior to 0.41.2 across affected packages: @opentelemetry/instrumentation.
What version fixes GHSA-f8pq-3926-8gx5?
Upgrading to 0.41.2 (or the latest patched release for your respective branch) resolves the vulnerability.
Is @opentelemetry/instrumentation affected?
Yes, @opentelemetry/instrumentation is affected in releases prior to 0.41.2. Upgrade your dependency to 0.41.2 or later.
What is the CVSS score of GHSA-f8pq-3926-8gx5?
GHSA-f8pq-3926-8gx5 has a CVSS v3.1 base score of 8.1 (HIGH) with vector string CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:C/C:H/I:L/A:L.
What CWE is associated with GHSA-f8pq-3926-8gx5?
GHSA-f8pq-3926-8gx5 is classified under General Security Weakness.
How can I check npm dependencies for GHSA-f8pq-3926-8gx5?
Run the dependency tree command: 'npm ls @opentelemetry/instrumentation'. 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-f8pq-3926-8gx5",
  "modified" : "2023-08-09T20:59:14Z",
  "published" : "2023-08-09T20:59:14Z",
  "aliases" : [ ],
  "summary" : "Unsanitized user controlled input in module generation",
  "details" : "## Impact\n\nThe `import-in-the-middle` loader used by `@opentelemetry/instrumentation` works by generating a wrapper module on the fly. The wrapper uses the module specifier to load the original module and add some wrapping code. It allows for remote code execution in cases where an application passes user-supplied input directly to an `import()` function.\n\n## Patches\n\nThis vulnerability has been patched in `@opentelemetry/instrumentation` version `0.41.2`\n\n## Workarounds\n\n- Do not pass any user-supplied input to `import()`. Instead, verify it against a set of allowed values.\n- If using `@opentelemetry/instrumentation` with support for EcmaScript Modules is not needed, ensure that none of the following options are set (either via command-line or the `NODE_OPTIONS` environment variable):\n```\n--experimental-loader=@opentelemetry/instrumentation/hook.mjs\n--experimental-loader @opentelemetry/instrumentation/hook.mjs\n--loader=import-in-the-middle/hook.mjs\n--loader import-in-the-middle/hook.mjs\n```\n\n## References\n\n- https://github.com/DataDog/import-in-the-middle/security/advisories/GHSA-5r27-rw8r-7967",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:C/C:H/I:L/A:L"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "npm",
      "name" : "@opentelemetry/instrumentation"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0.40.0"
      }, {
        "fixed" : "0.41.2"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/open-telemetry/opentelemetry-js/security/advisories/GHSA-f8pq-3926-8gx5"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/open-telemetry/opentelemetry-js/commit/ffe641c08c69f41ca8d292221dc1804d511efb28"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/open-telemetry/opentelemetry-js"
  } ],
  "database_specific" : {
    "cwe_ids" : [ ],
    "severity" : "HIGH",
    "github_reviewed" : true,
    "github_reviewed_at" : "2023-08-09T20:59:14Z",
    "nvd_published_at" : null
  }
}