NodeJS/@babel/runtime/7.12.18


babel's modular runtime helpers

https://www.npmjs.com/package/@babel/runtime
MIT

1 Security Vulnerabilities

Babel has inefficient RegExp complexity in generated code with .replace when transpiling named capturing groups

Published date: 2025-03-11T20:30:18Z
CVE: CVE-2025-27789
Links:

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 duplicated named capturing groups, and target any browser older than Chrome/Edge 126, Opera 112, Firefox 129, Safari 17.4, or Node.js 23 - you use any named capturing groups, and target any browser older than Chrome 64, Opera 71, Edge 79, Firefox 78, Safari 11.1, or Node.js 10

You can verify what transforms @babel/preset-env is using by enabling the debug option.

Patches

This problem has been fixed in @babel/helpers and @babel/runtime 7.26.10 and 8.0.0-alpha.17, please upgrade. It's likely that you do not directly depend on @babel/helpers, and instead you depend on @babel/core (which itself depends on @babel/helpers). Upgrading to @babel/core 7.26.10 is not required, but it guarantees that you are on a new enough @babel/helpers version.

Please note that just updating your Babel dependencies is not enough: you will also need to re-compile your code.

Workarounds

If you are passing user-provided strings as the second argument of .replace on regular expressions that contain named capturing groups, validate the input and make sure it does not contain the substring $< if it's then not followed by > (possibly with other characters in between).

References

This vulnerability was reported and fixed in https://github.com/babel/babel/pull/17173.

Affected versions: ["8.0.0-alpha.0", "8.0.0-alpha.1", "8.0.0-alpha.2", "8.0.0-alpha.3", "8.0.0-alpha.4", "8.0.0-alpha.5", "8.0.0-alpha.6", "8.0.0-alpha.7", "8.0.0-alpha.8", "8.0.0-alpha.9", "8.0.0-alpha.10", "8.0.0-alpha.11", "8.0.0-alpha.12", "8.0.0-alpha.13", "8.0.0-alpha.14", "8.0.0-alpha.15", "7.0.0-beta.4", "7.0.0-beta.5", "7.0.0-beta.31", "7.0.0-beta.32", "7.0.0-beta.33", "7.0.0-beta.34", "7.0.0-beta.35", "7.0.0-beta.36", "7.0.0-beta.37", "7.0.0-beta.38", "7.0.0-beta.39", "7.0.0-beta.40", "7.0.0-beta.41", "7.0.0-beta.42", "7.0.0-beta.43", "7.0.0-beta.44", "7.0.0-beta.45", "7.0.0-beta.46", "7.0.0-beta.47", "7.0.0-beta.48", "7.0.0-beta.49", "7.0.0-beta.50", "7.0.0-beta.51", "7.0.0-beta.52", "7.0.0-beta.53", "7.0.0-beta.54", "7.0.0-beta.55", "7.0.0-beta.56", "7.0.0-rc.0", "7.0.0-rc.1", "7.0.0-rc.2", "7.0.0-rc.3", "7.0.0-rc.4", "7.0.0", "7.1.1", "7.1.2", "7.1.5", "7.2.0", "7.3.0", "7.3.1", "7.3.4", "7.4.0", "7.4.2", "7.4.3", "7.4.4", "7.4.5", "7.5.0", "7.5.1", "7.5.2", "7.5.3", "7.5.4", "7.5.5", "7.6.0", "7.6.2", "7.6.3", "7.7.0", "7.7.1", "7.7.2", "7.7.4", "7.7.5", "7.7.6", "7.7.7", "7.8.0", "7.8.3", "7.8.4", "7.8.7", "7.9.0", "7.9.2", "7.9.6", "7.10.0", "7.10.1", "7.10.2", "7.10.3", "7.10.4", "7.10.5", "7.11.0", "7.11.1", "7.11.2", "7.12.0", "7.12.1", "7.12.5", "7.12.13", "7.12.17", "7.12.18", "7.13.0", "7.13.1", "7.13.2", "7.13.4", "7.13.6", "7.13.7", "7.13.8", "7.13.9", "7.13.10", "7.13.16", "7.13.17", "7.14.0", "7.14.5", "7.14.6", "7.14.8", "7.15.3", "7.15.4", "7.16.0", "7.16.3", "7.16.5", "7.16.7", "7.17.0", "7.17.2", "7.17.7", "7.17.8", "7.17.9", "7.18.0", "7.18.2", "7.18.3", "7.18.6", "7.18.9", "7.19.0", "7.19.4", "7.20.0", "7.20.1", "7.20.5", "7.20.6", "7.20.7", "7.20.13", "7.21.0", "7.21.4-esm", "7.21.4-esm.1", "7.21.4-esm.2", "7.21.4-esm.3", "7.21.4-esm.4", "7.21.5", "7.22.0", "7.22.3", "7.22.5", "7.22.6", "7.22.10", "7.22.11", "7.22.15", "7.23.0", "7.23.1", "7.23.2", "7.23.4", "7.23.5", "7.23.6", "7.23.7", "7.23.8", "7.23.9", "7.24.0", "7.24.1", "7.24.4", "7.24.5", "7.24.6", "7.24.7", "7.24.8", "7.25.0", "7.25.4", "7.25.6", "7.25.7", "7.25.9", "7.26.0", "7.26.7", "7.26.9"]
Secure versions: [8.0.0-alpha.16, 7.26.10, 8.0.0-alpha.17, 7.27.0, 7.27.1]
Recommendation: Update to version 7.27.1.

182 Other Versions

Version License Security Released
8.0.0-alpha.17 MIT 2025-03-11 - 18:24 2 months
8.0.0-alpha.16 MIT 2025-02-14 - 11:58 3 months
8.0.0-alpha.15 MIT 1 2025-01-10 - 17:24 4 months
8.0.0-alpha.14 MIT 1 2024-12-06 - 16:53 5 months
8.0.0-alpha.13 MIT 1 2024-10-25 - 13:53 7 months
8.0.0-alpha.12 MIT 1 2024-07-26 - 17:33 10 months
8.0.0-alpha.11 MIT 1 2024-06-07 - 09:15 11 months
8.0.0-alpha.10 MIT 1 2024-06-04 - 11:19 11 months
8.0.0-alpha.9 MIT 1 2024-06-03 - 14:03 11 months
8.0.0-alpha.8 MIT 1 2024-04-04 - 13:19 about 1 year
8.0.0-alpha.7 MIT 1 2024-02-28 - 14:04 about 1 year
8.0.0-alpha.6 MIT 1 2024-01-26 - 16:13 over 1 year
8.0.0-alpha.5 MIT 1 2023-12-11 - 15:18 over 1 year
8.0.0-alpha.4 MIT 1 2023-10-12 - 02:05 over 1 year
8.0.0-alpha.3 MIT 1 2023-09-26 - 14:56 over 1 year
8.0.0-alpha.2 MIT 1 2023-08-09 - 15:14 almost 2 years
8.0.0-alpha.1 MIT 1 2023-07-24 - 17:51 almost 2 years
8.0.0-alpha.0 MIT 1 2023-07-20 - 13:59 almost 2 years
7.27.1 MIT 2025-04-30 - 15:08 11 days
7.27.0 MIT 2025-03-24 - 17:41 about 2 months
7.26.10 MIT 2025-03-11 - 17:55 2 months
7.26.9 MIT 1 2025-02-14 - 11:47 3 months
7.26.7 MIT 1 2025-01-24 - 15:04 4 months
7.26.0 MIT 1 2024-10-25 - 13:30 7 months
7.25.9 MIT 1 2024-10-22 - 15:20 7 months
7.25.7 MIT 1 2024-10-02 - 15:14 7 months
7.25.6 MIT 1 2024-08-29 - 10:14 9 months
7.25.4 MIT 1 2024-08-22 - 09:34 9 months
7.25.0 MIT 1 2024-07-26 - 16:59 10 months
7.24.8 MIT 1 2024-07-11 - 14:54 10 months
7.24.7 MIT 1 2024-06-05 - 13:14 11 months
7.24.6 MIT 1 2024-05-24 - 12:24 12 months
7.24.5 MIT 1 2024-04-29 - 18:34 about 1 year
7.24.4 MIT 1 2024-04-03 - 16:53 about 1 year
7.24.1 MIT 1 2024-03-19 - 09:49 about 1 year
7.24.0 MIT 1 2024-02-28 - 11:47 about 1 year
7.23.9 MIT 1 2024-01-25 - 16:57 over 1 year
7.23.8 MIT 1 2024-01-08 - 18:42 over 1 year
7.23.7 MIT 1 2023-12-29 - 20:01 over 1 year
7.23.6 MIT 1 2023-12-11 - 13:09 over 1 year
7.23.5 MIT 1 2023-11-29 - 10:25 over 1 year
7.23.4 MIT 1 2023-11-20 - 14:22 over 1 year
7.23.2 MIT 1 2023-10-11 - 18:51 over 1 year
7.23.1 MIT 1 2023-09-25 - 08:30 over 1 year
7.23.0 MIT 1 2023-09-25 - 08:10 over 1 year
7.22.15 MIT 1 2023-09-04 - 12:25 over 1 year
7.22.11 MIT 1 2023-08-24 - 13:08 over 1 year
7.22.10 MIT 1 2023-08-07 - 17:25 almost 2 years
7.22.6 MIT 1 2023-07-04 - 07:48 almost 2 years
7.22.5 MIT 1 2023-06-08 - 18:21 almost 2 years
7.22.3 MIT 1 2023-05-27 - 10:11 almost 2 years
7.22.0 MIT 1 2023-05-26 - 13:45 almost 2 years
7.21.5 MIT 1 2023-04-28 - 19:50 about 2 years
7.21.4-esm MIT 1 2023-04-04 - 14:09 about 2 years
7.21.4-esm.4 MIT 1 2023-04-04 - 15:13 about 2 years
7.21.4-esm.3 MIT 1 2023-04-04 - 14:55 about 2 years
7.21.4-esm.2 MIT 1 2023-04-04 - 14:38 about 2 years
7.21.4-esm.1 MIT 1 2023-04-04 - 14:20 about 2 years
7.21.0 MIT 1 2023-02-20 - 15:31 about 2 years
7.20.13 MIT 1 2023-01-21 - 14:30 over 2 years
7.20.7 MIT 1 2022-12-22 - 09:45 over 2 years
7.20.6 MIT 1 2022-11-28 - 11:02 over 2 years
7.20.5 MIT 1 2022-11-28 - 10:12 over 2 years
7.20.1 MIT 1 2022-11-01 - 11:25 over 2 years
7.20.0 MIT 1 2022-10-27 - 13:19 over 2 years
7.19.4 MIT 1 2022-10-10 - 10:47 over 2 years
7.19.0 MIT 1 2022-09-05 - 19:02 over 2 years
7.18.9 MIT 1 2022-07-18 - 09:17 almost 3 years
7.18.6 MIT 1 2022-06-27 - 19:49 almost 3 years
7.18.3 MIT 1 2022-05-25 - 14:44 almost 3 years
7.18.2 MIT 1 2022-05-25 - 09:16 almost 3 years
7.18.0 MIT 1 2022-05-19 - 18:16 almost 3 years
7.17.9 MIT 1 2022-04-06 - 15:55 about 3 years
7.17.8 MIT 1 2022-03-18 - 20:31 about 3 years
7.17.7 MIT 1 2022-03-14 - 17:07 about 3 years
7.17.2 MIT 1 2022-02-08 - 15:35 over 3 years
7.17.0 MIT 1 2022-02-02 - 23:04 over 3 years
7.16.7 MIT 1 2021-12-31 - 00:21 over 3 years
7.16.5 MIT 1 2021-12-13 - 22:27 over 3 years
7.16.3 MIT 1 2021-11-09 - 21:53 over 3 years
7.16.0 MIT 1 2021-10-29 - 23:47 over 3 years
7.15.4 MIT 1 2021-09-02 - 21:39 over 3 years
7.15.3 MIT 1 2021-08-11 - 07:19 over 3 years
7.14.8 MIT 1 2021-07-20 - 18:02 almost 4 years
7.14.6 MIT 1 2021-06-14 - 21:57 almost 4 years
7.14.5 MIT 1 2021-06-09 - 23:11 almost 4 years
7.14.0 MIT 1 2021-04-29 - 20:09 about 4 years
7.13.17 MIT 1 2021-04-20 - 23:19 about 4 years
7.13.16 MIT 1 2021-04-20 - 11:21 about 4 years
7.13.10 MIT 1 2021-03-08 - 22:36 about 4 years
7.13.9 MIT 1 2021-03-01 - 21:44 about 4 years
7.13.8 MIT 1 2021-02-26 - 23:39 about 4 years
7.13.7 MIT 1 2021-02-24 - 09:00 about 4 years
7.13.6 MIT 1 2021-02-23 - 17:44 about 4 years
7.13.4 MIT 1 2021-02-23 - 10:40 about 4 years
7.13.2 MIT 1 2021-02-23 - 02:11 about 4 years
7.13.1 MIT 1 2021-02-23 - 01:19 about 4 years
7.13.0 MIT 1 2021-02-22 - 22:49 about 4 years
7.12.18 MIT 1 2021-02-18 - 16:20 about 4 years
7.12.17 MIT 1 2021-02-18 - 15:12 about 4 years