CVE-2023-45133

9.3 CRITICAL

📋 TL;DR

This vulnerability in Babel's @babel/traverse allows arbitrary code execution during JavaScript compilation when processing maliciously crafted code. It affects users who compile untrusted code using specific Babel plugins that rely on path.evaluate() or path.evaluateTruthy() methods. Only users compiling untrusted code are impacted.

💻 Affected Systems

Products:
  • @babel/traverse
  • babel-traverse
  • @babel/plugin-transform-runtime
  • @babel/preset-env
  • @babel/helper-define-polyfill-provider
  • babel-plugin-polyfill-corejs3
  • babel-plugin-polyfill-corejs2
  • babel-plugin-polyfill-es-shims
  • babel-plugin-polyfill-regenerator
Versions: @babel/traverse <7.23.2 and <8.0.0-alpha.4, all versions of babel-traverse
Operating Systems: All
Default Config Vulnerable: ⚠️ Yes
Notes: Only vulnerable when using affected plugins to compile untrusted code. Third-party plugins using path.evaluate() may also be affected.

📦 What is this software?

⚠️ Risk & Real-World Impact

🔴

Worst Case

Remote code execution on the compilation server, potentially leading to full system compromise and data exfiltration.

🟠

Likely Case

Compilation server compromise allowing attacker to execute arbitrary code in the compilation environment.

🟢

If Mitigated

No impact if only compiling trusted code or using unaffected plugins.

🌐 Internet-Facing: HIGH if compilation service accepts user-submitted code
🏢 Internal Only: MEDIUM if internal developers compile untrusted code, LOW if only trusted code is compiled

🎯 Exploit Status

Public PoC: ✅ No
Weaponized: UNKNOWN
Unauthenticated Exploit: ⚠️ Yes
Complexity: MEDIUM

Exploitation requires crafting malicious JavaScript code that triggers vulnerable code paths during compilation.

🛠️ Fix & Mitigation

✅ Official Fix

Patch Version: @babel/traverse@7.23.2 or @babel/traverse@8.0.0-alpha.4

Vendor Advisory: https://github.com/babel/babel/security/advisories/GHSA-67hx-6x53-jw92

Restart Required: No

Instructions:

1. Update @babel/traverse to v7.23.2 or v8.0.0-alpha.4. 2. Update affected plugins: @babel/plugin-transform-runtime to v7.23.2, @babel/preset-env to v7.23.2, @babel/helper-define-polyfill-provider to v0.4.3, babel-plugin-polyfill-corejs2 to v0.4.6, babel-plugin-polyfill-corejs3 to v0.8.5, babel-plugin-polyfill-es-shims to v0.10.0, babel-plugin-polyfill-regenerator to v0.5.3.

🔧 Temporary Workarounds

Disable affected plugins

all

Remove or disable vulnerable plugins if not essential

Remove affected plugins from babel.config.js or .babelrc

Restrict code compilation

all

Only compile trusted code sources

🧯 If You Can't Patch

  • Isolate compilation environment in sandbox/container
  • Implement strict input validation for compiled code

🔍 How to Verify

Check if Vulnerable:

Check package.json or lock files for vulnerable versions of @babel/traverse (<7.23.2) or affected plugins

Check Version:

npm list @babel/traverse @babel/plugin-transform-runtime @babel/preset-env @babel/helper-define-polyfill-provider

Verify Fix Applied:

Verify installed versions match patched versions: @babel/traverse >=7.23.2 or >=8.0.0-alpha.4

📡 Detection & Monitoring

Log Indicators:

  • Unusual compilation errors
  • Suspicious code patterns in compilation input
  • Unexpected process execution during compilation

Network Indicators:

  • Outbound connections from compilation process to unexpected destinations

SIEM Query:

Process execution from babel or node processes with unusual arguments or parent processes

🔗 References

📤 Share & Export