# CVE-2023-38704: import-in-the-middle allows unsanitized user controlled input in module generation

- Severity: High 8.1 (CVSS:3.1, scored by GitHub_M) `CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:C/C:H/I:L/A:L`
- Known to be exploited: not in CISA's catalogue, which lists only what CISA has confirmed
- Likelihood of exploitation in the next 30 days (EPSS): 1.00%, higher than 63% of CVEs (2026-12-01)
- Published: 2023-08-07T19:24:33.271Z
- Modified: 2026-09-10T03:49:57.367Z
- Also known as: GHSA-5r27-rw8r-7967
- Weaknesses: CWE-20
- SSVC (CISA-ADP): exploitation none, automatable no, technical impact partial
- Assigned by: GitHub_M

## Description

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.

(As written by CVE List.)

## Affected

- DataDog import-in-the-middle: < 1.4.2
- import-in-the-middle (npm): before 1.4.2
- datadoghq import-in-the-middle: before 1.4.2

## Every score

- GitHub_M: CVSS:3.1 8.1 High `CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:C/C:H/I:L/A:L`
- GitHub: CVSS:3.1 8.1 High `CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:C/C:H/I:L/A:L`
- NVD: CVSS:3.1 9.8 Critical `CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H`

## References

- <https://github.com/DataDog/import-in-the-middle/security/advisories/GHSA-5r27-rw8r-7967> (mitigation, third-party-advisory, web)
- <https://github.com/DataDog/import-in-the-middle/commit/2531cdd9d1d73f9eaa87c16967f60cb276c1971b> (patch, web)
- <https://nvd.nist.gov/vuln/detail/CVE-2023-38704> (advisory)
- <https://github.com/DataDog/import-in-the-middle> (package)

## Sources

- CVE List: [CVE-2023-38704](https://www.cve.org/CVERecord?id=CVE-2023-38704), CVE Terms of Use, modified 2024-10-03
- GitHub Advisory Database: [GHSA-5r27-rw8r-7967](https://github.com/advisories/GHSA-5r27-rw8r-7967), CC-BY-4.0, modified 2026-09-10
- NVD: [CVE-2023-38704](https://nvd.nist.gov/vuln/detail/CVE-2023-38704), Public domain, modified 2026-06-17

---

Page: https://cve.day/CVE-2023-38704 · Whole record: https://cve.day/CVE-2023-38704.json · Rebuilt by cve.day 2026-11-25T22:58:26.830Z
