CVE intelligence and bounded remediation

CVE-2023-38704 — import-in-the-middle is a module loading interceptor specifically for ESM modules

Critical CVSS 9.8

import-in-the-middle is a module loading interceptor specifically for ESM modules. The import-in-the-middle loader 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. Prior to version 1.4.2, it allows for remote code execution in cases where an application passes user-supplied input directly to the `import()` function. This vulnerability has been patched in import-in-the-middle version 1.4.2. Some workarounds are available. Do not pass any user-supplied input to `import()`. Instead, verify it against a set of allowed values. If using import-in-the-middle, directly or indirectly, and support for EcmaScript Modules is not needed, ensure that no options are set, either via command-line or the `NODE_OPTIONS` environment variable, that would enable loader hooks.

Severity
Critical
CVSS
9.8 (3.1)
Published
2023-08-07
CISA KEV
Not currently listed
Ecosystem
software/application
Weaknesses
CWE-20

Affected products

  • datadoghq / import-in-the-middle

Matched remediation archetype

Command, code, expression, and template injection

This catalog composition supplies bounded fallback guidance. Explicitly reviewed curated workflows load with the complete record below.

Check exposure

  • Trace untrusted values to process execution, interpreters, evaluators, template engines, dynamic imports, and administrative scripting features.
  • Determine whether the affected path is reachable across each trust boundary and which service account or host privilege it inherits.
  • Review configuration for optional execution features, unsafe compatibility modes, and shell invocation.

Remediate safely

  • Replace string-built commands or evaluated code with fixed operations and structured argument APIs that do not invoke a shell.
  • Use strict allowlists for operation identifiers and reject unexpected input before it reaches any interpreter.
  • Update the affected component and add inert regression tests covering metacharacters, encoding variants, and alternate request paths.

Authoritative sources

Complete CVE record and remediation plan

The detailed catalog view below loads this exact record, its source evidence, and the full seven-phase agentic change plan.