🌐 Nodejs.cn
security

2026年3月安全更新

Ulises GasconMarch 30, 2026

Express 团队已发布 path-to-regexp 的新补丁版本,以解决三个正则表达式拒绝服务漏洞。

🌐 The Express team has released new patch versions of path-to-regexp addressing three regular expression denial of service vulnerabilities.

Warning

我们建议升级到最新版本的 path-to-regexp 以保障你的应用安全。如果你有 package-lock.json,可以通过运行以下命令更新依赖:

🌐 We recommend upgrading to the latest version of path-to-regexp to secure your applications. If you have a package-lock.json, you can update the dependency by running:

Terminal window
npm update path-to-regexp

以下漏洞已被修复:

🌐 The following vulnerabilities have been addressed:

path-to-regexp 工具模块中的 CVE-2026-4867(高风险)

🌐 CVE-2026-4867 in path-to-regexp utility module (High)

path-to-regexp 版本 <= 0.1.12 易受到通过多个路由参数的正则表达式拒绝服务攻击的影响

每当在单个段中有三个或更多参数,并且它们被非点号的字符分隔时,就会生成一个错误的正则表达式。例如,/:a-:b-:c。在 v0.1.12 中添加的回溯保护仅防止两个参数的歧义。对于三个或更多参数,生成的前瞻不阻止单个分隔符字符,从而导致灾难性回溯。

🌐 A bad regular expression is generated any time you have three or more parameters within a single segment, separated by something that is not a period. For example, /:a-:b-:c. The backtrack protection added in v0.1.12 only prevents ambiguity for two parameters. With three or more, the generated lookahead does not block single separator characters, causing catastrophic backtracking.

受影响版本: <= 0.1.12 修补版本: >= 0.1.13

欲了解更多详情,请参见 GHSA-37ch-88jc-xwx2

🌐 For more details, see GHSA-37ch-88jc-xwx2.

path-to-regexp 工具模块中的 CVE-2026-4926(高风险)

🌐 CVE-2026-4926 in path-to-regexp utility module (High)

path-to-regexp 版本 >= 8.0.0 易受到通过顺序可选组的拒绝服务攻击

每当你有多个连续的可选组时,例如 {a}{b}{c}:z,就会生成一个不良的正则表达式。生成的正则表达式会随着组的数量呈指数增长,从而导致拒绝服务。避免将用户控制的输入作为路由模式传递。

🌐 A bad regular expression is generated any time you have multiple sequential optional groups, such as {a}{b}{c}:z. The generated regex grows exponentially with the number of groups, causing denial of service. Avoid passing user-controlled input as route patterns.

受影响版本: >= 8.0.0 修补版本: >= 8.4.0

有关更多详情,请参见 GHSA-j3q9-mxjg-w52f

🌐 For more details, see GHSA-j3q9-mxjg-w52f.

path-to-regexp 工具模块中的 CVE-2026-4923(中等)

🌐 CVE-2026-4923 in path-to-regexp utility module (Medium)

path-to-regexp 版本 >= 8.0.0, <= 8.3.0 易受到通过多个通配符的正则表达式拒绝服务攻击的影响

当使用多个通配符并至少有一个参数时,可以生成易受 ReDoS 攻击的正则表达式。第二个通配符必须位于路径的末尾以外的某处。例如,/*foo-*bar-:baz

🌐 When using multiple wildcards combined with at least one parameter, a regular expression can be generated that is vulnerable to ReDoS. The second wildcard must be somewhere other than the end of the path. For example, /*foo-*bar-:baz.

受影响版本: >= 8.0.0, <= 8.3.0 修补版本: >= 8.4.0

欲了解更多详情,请参见 GHSA-27v5-c462-wpq7

🌐 For more details, see GHSA-27v5-c462-wpq7.


我们建议升级到最新版本的 path-to-regexp 以保护你的应用安全。

🌐 We recommend upgrading to the latest version of path-to-regexp to secure your applications.

有兴趣写一篇文章吗?查看我们的指南以开始吧。

阅读指南