Medium, CVSS 6.2npmPublished
Babel has inefficient RegExp complexity in generated code with .replace when transpiling named capturing groups
CVE-2025-27789 · GHSA-968p-4wvh-cqc8
- Affected
- npm @babel/runtime-corejs2 < 7.26.10; >= 8.0.0-alpha.0, < 8.0.0-alpha.17
- Fixed in
- 7.26.108.0.0-alpha.17· Vendor fix available
- Issue
- Impact When using Babel to compile regular expression named capturing groups, Babel will generate a polyfill for the `.replace` method that has quadratic complexity on some specific replacement pattern strings (i.e. the second argument passed to `.replace`). Your generated code is vulnerable if _all_ the following conditions are true: - You use Babel to compile regular expression named capturing groups - You use the `.replace` method on a regular expression that contains named capturing groups - Your code uses untrusted strings as the second argument of `.replace` If you are using `@babel/preset-env` with the `targets` option, the transform that injects the vulnerable code is automatically enabled if: - you use…
Recommended action: Upgrade to 8.0.0-alpha.17 (pre-release) or 7.26.10 by release line, then redeploy and verify.A vendor fix does not resolve your finding until you verify it in your own systems.