Description
moment is a JavaScript date library for parsing, validating, manipulating, and formatting dates. In versions 2.29.2 through 2.30.1, a specially crafted non-string object passed to moment.locale() can bypass the locale-name path-traversal guard. The guard assumes the input is a string, so an object whose match() method satisfies the check while its toString() returns a traversal path reaches an internal require() call with attacker-controlled path segments. This is an incomplete fix for CVE-2022-24785 and primarily affects npm (server-side) users that pass user-provided input directly to moment.locale(). The issue is fixed in moment 2.31.0, and users should upgrade to 2.31.0 or later. As a workaround, validate that any user-supplied input is a string before passing it to moment.locale().
Affected products
| Vendor | Product | Affected | Fixed |
|---|---|---|---|
| moment | moment | 2.29.2 – < 2.31.0 | 2.31.0 |
Fixed in Linux distributions
Distributions backport fixes, so the version that fixes this vulnerability differs per release — upgrade to at least the version shown. From the distributions' security trackers and advisories.
Debian
Security tracker ↗| Release | Package | Fixed in | Advisory |
|---|---|---|---|
| Debian 14 | node-moment | 2.31.0+ds1-1 | — |
| Debian 13 | node-moment | No fix yet | — |
| Debian 12 | node-moment | No fix yet | — |
Ubuntu
Security tracker ↗| Release | Package | Fixed in | Advisory |
|---|---|---|---|
| Ubuntu 26.10 | node-moment +1 | No fix yet | — |
| Ubuntu 26.04 LTS | node-moment +1 | No fix yet | — |
| Ubuntu 24.04 LTS | node-moment +1 | No fix yet | — |
| Ubuntu 22.04 LTS | node-moment +1 | No fix yet | — |
| Ubuntu 20.04 LTS | node-moment | No fix yet | — |
Show 2 more (older releases, extended support, other products)Fewer releases
| Release | Package | Fixed in | Advisory |
|---|---|---|---|
| Ubuntu 18.04 LTS | node-moment | No fix yet | — |
| Ubuntu Pro 16.04 LTS | node-moment | No fix yet | — |
Wolfi
| Release | Package | Fixed in | Advisory |
|---|---|---|---|
| Wolfi rolling | kubeflow-centraldashboard | 2.0.0-r4 | — |
| Wolfi rolling | nextcloud-server-33 | 33.0.9-r2 | — |
| Wolfi rolling | opensearch-dashboards-3 +1 | 3.8.0-r11 | — |
| Wolfi rolling | py3.10-jupyterhub +3 | 6.0.1-r2 | — |
| Wolfi rolling | sqlpad | 7.5.7-r46 | — |
Affected packages
| Ecosystem | Package | Affected | Fixed | Record |
|---|---|---|---|---|
| npm | moment | >= 2.29.2, < 2.31.0 | 2.31.0 | GHSA-4p3w-j4w9-5jqw |