{"id":"CVE-2023-38704","published":"2023-08-07T19:24:33Z","modified":"2024-10-03T18:05:54Z","title":"import-in-the-middle allows unsanitized user controlled input in module generation","vendor":"DataDog","product":"import-in-the-middle","tier":"tail","description":{"text":"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.\n\nSome 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.","provenance":"source","from":"CVE.org"},"cvss":{"score":8.1,"severity":"HIGH","version":"3.1","vector":"CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:C/C:H/I:L/A:L","provenance":"source","from":"CVE.org CNA"},"epss":{"score":0.01,"percentile":0.63649,"provenance":"source"},"cwes":[{"id":"CWE-20","name":"Improper Input Validation"}],"references":[{"url":"https://github.com/DataDog/import-in-the-middle/security/advisories/GHSA-5r27-rw8r-7967","tags":["x_refsource_CONFIRM"]},{"url":"https://github.com/DataDog/import-in-the-middle/commit/2531cdd9d1d73f9eaa87c16967f60cb276c1971b","tags":["x_refsource_MISC"]}],"priority":{"score":18.4,"factors":[{"name":"EPSS percentile","points":12.73},{"name":"CVSS severity","points":5.67}]},"vendorSlug":"datadog","affectedVersions":[{"vendor":"DataDog","product":"import-in-the-middle","versions":["< 1.4.2"]}],"ssvc":{"exploitation":"none","automatable":"no","technicalImpact":"partial","timestamp":"2024-10-03T18:05:42.675284Z","from":"CISA ADP","provenance":"source"},"affected":[{"ecosystem":"npm","package":"import-in-the-middle","vulnerableRanges":["<1.4.2"],"patched":["1.4.2"],"from":["GHSA-5r27-rw8r-7967"],"provenance":"source"}],"summary":{"text":"The import-in-the-middle module loading interceptor for ESM modules, used by DataDog's package, contains an input validation flaw in how it generates wrapper modules from module specifiers, affecting versions before 1.4.2. An attacker who can supply input that an application passes directly to the import() function can achieve remote code execution over the network, without authentication or user interaction, though exploiting it requires a specific condition: the application must pass user-supplied data straight into import().","provenance":"ai","model":"claude-haiku-5-5","generatedAt":"2026-11-20T20:34:30Z"},"euvd":{"id":"EUVD-2023-2217","exploited":false,"provenance":"source"}}