Vulnerability · Published Mar 11, 2025 · Assigned by GitHub_M

CVE-2025-27789Inefficient RexExp complexity in generated code with .replace when transpiling named capturing groups

Medium 6.2

In plain English

A medium-severity regular-expression denial of service in babel from babel. Proof-of-concept exploit code is public. The chance it is exploited in the next 30 days is estimated at 0.6% (higher than 47% of all known vulnerabilities). Fixed versions are available - upgrade the affected package.

Severity (CVSS 3.1)6.2Medium
Exploit odds (30 days)0.6%top 53.0% of all CVEs
Exploited in the wildNo reportsCISA SSVC: poc
Attack toolingNoneno public tooling known

Official description

Babel is a compiler for writing next generation JavaScript. When using versions of Babel prior to 7.26.10 and 8.0.0-alpha.17 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`). Generated code is vulnerable if all the following conditions are true: Using Babel to compile regular expression named capturing groups, using the `.replace` method on a regular expression that contains named capturing groups, and the code using untrusted strings as the second argument of `.replace`. This problem has been fixed in `@babel/helpers` and `@babel/runtime` 7.26.10 and 8.0.0-alpha.17. It's likely that individual users do not directly depend on `@babel/helpers`, and instead depend on `@babel/core` (which itself depends on `@babel/helpers`). Upgrading to `@babel/core` 7.26.10 is not required, but it guarantees use of a new enough `@babel/helpers` version. Note that just updating Babel dependencies is not enough; one will also need to re-compile the code. No known workarounds are available.

Affected packages & fixed versions

EcosystemPackageFixed inAdvisory
Ubuntu:22.04:LTSnode-babel7no fix listedUBUNTU-CVE-2025-27789
Ubuntu:24.04:LTSnode-babel7no fix listedUBUNTU-CVE-2025-27789
Ubuntu:25.10node-babel7no fix listedUBUNTU-CVE-2025-27789
Ubuntu:26.04:LTSnode-babel7no fix listedUBUNTU-CVE-2025-27789
Ubuntu:26.10node-babel7no fix listedUBUNTU-CVE-2025-27789
npm@babel/helpers7.26.10GHSA-968p-4wvh-cqc8
npm@babel/helpers8.0.0-alpha.17GHSA-968p-4wvh-cqc8
npm@babel/runtime8.0.0-alpha.17GHSA-968p-4wvh-cqc8
npm@babel/runtime7.26.10GHSA-968p-4wvh-cqc8
npm@babel/runtime-corejs28.0.0-alpha.17GHSA-968p-4wvh-cqc8
npm@babel/runtime-corejs27.26.10GHSA-968p-4wvh-cqc8
npm@babel/runtime-corejs38.0.0-alpha.17GHSA-968p-4wvh-cqc8
npm@babel/runtime-corejs37.26.10GHSA-968p-4wvh-cqc8

Affected products (as reported)

VendorProductVersions
babel babel < 7.26.10>= 8.0.0-alpha.0, < 8.0.0-alpha.17

Weakness: CWE-1333 · Vector: CVSS:3.1/AV:L/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H

References