CVE-2023-45133 Babel vulnerable to arbitrary code execution when compiling specifically crafted malicious code
Attackers can execute arbitrary code during compilation if Babel processes malicious code using specific plugins that rely on path evaluation methods.
- Exploited in the wild
- Not known
- Login needed
- Not needed
- Attackable
- Local or same network only
- Victim action needed
- Not needed
- Fix
- Available
What is CVE-2023-45133?
CVE-2023-45133 is a critical code injection vulnerability in Debian Debian Linux, published on 12 Oct 2023. It can only be exploited from the same machine or local network, with no action from the victim.
Official description
Babel is a compiler for writingJavaScript. In `@babel/traverse` prior to versions 7.23.2 and 8.0.0-alpha.4 and all versions of `babel-traverse`, using Babel to compile code that was specifically crafted by an attacker can lead to arbitrary code execution during compilation, when using plugins that rely on the `path.evaluate()`or `path.evaluateTruthy()` internal Babel methods. Known affected plugins are `@babel/plugin-transform-runtime`; `@babel/preset-env` when using its `useBuiltIns` option; and any "polyfill provider" plugin that depends on `@babel/helper-define-polyfill-provider`, such as `babel-plugin-polyfill-corejs3`, `babel-plugin-polyfill-corejs2`, `babel-plugin-polyfill-es-shims`, `babel-plugin-polyfill-regenerator`. No other plugins under the `@babel/` namespace are impacted, but third-party plugins might be. Users that only compile trusted code are not impacted. The vulnerability has been fixed in `@babel/[email protected]` and `@babel/[email protected]`. Those who cannot upgrade `@babel/traverse` and are using one of the affected packages mentioned above should upgrade them to their latest version to avoid triggering the vulnerable code path in affected `@babel/traverse` versions: `@babel/plugin-transform-runtime` v7.23.2, `@babel/preset-env` v7.23.2, `@babel/helper-define-polyfill-provider` v0.4.3, `babel-plugin-polyfill-corejs2` v0.4.6, `babel-plugin-polyfill-corejs3` v0.8.5, `babel-plugin-polyfill-es-shims` v0.10.0, `babel-plugin-polyfill-regenerator` v0.5.3.
Which versions are affected by CVE-2023-45133?
6 open source packages ship an affected version, including @babel/traverse and babel-traverse. It affects 9 products.
| Package | Affected | Fixed in |
|---|---|---|
@babel/traverse npm | All versions | 7.23.2 |
@babel/traverse npm | All versions | 7.23.2 |
@babel/traverse npm | From 8.0.0-alpha.0 | 8.0.0-alpha.4 |
@babel/traverse npm | From 8.0.0-alpha.0 | 8.0.0-alpha.4 |
babel-traverse npm | All versions | None |
babel-traverse npm | All versions | None |
Products include Babeljs Babel, Babeljs Babel-Helper-Define-Polyfill-Provider, Babeljs Babel-Plugin-Polyfill-Corejs2, Babeljs Babel-Plugin-Polyfill-Corejs3, Babeljs Babel-Plugin-Polyfill-Es-Shims, Babeljs Babel-Plugin-Polyfill-Regenerator and 3 more.
How do I fix CVE-2023-45133?
Upgrade @babel/traverse to a fixed version for your release line: 7.23.2 or 8.0.0-alpha.4.
Upgrade, and never evaluate templates, expressions or code built from user input. More about Code injection.
Is CVE-2023-45133 being exploited?
There is no known exploitation of CVE-2023-45133 in the wild and no public exploit code.
Sources
Also known as CLSA-2026-1784683001, CLSA-2026-1784683088, CLSA-2026-1784769527, CLSA-2026-1789066503, CLSA-2026-1789071169, CLSA-2026-1789955725 and 302 more.