CVE-2022-24785: Path Traversal in Moment.js

Published Apr 4, 2022
·
Updated

Impact This vulnerability impacts npm (server) users of moment.js, especially if user provided locale string, eg fr is directly used to switch moment locale.

Patches This problem is patched in 2.29.2, and the patch can be applied to all affected versions (from 1.0.1 up until 2.29.1, inclusive).

Workarounds Sanitize user-provided locale name before passing it to moment.js.

References Are there any links users can visit to find out more?

For more information If you have any questions or comments about this advisory: Open an issue in moment repo

Other sources

A path traversal vulnerability was found in Moment.js that impacts npm (server) users. This issue occurs if a user-provided locale string is directly used to switch moment locale, which an attacker can exploit to change the correct path to one of their choice. This can result in a loss of integrity.

Moment.js could allow a remote attacker to traverse directories on the system, caused by improper validation of user supplied input. An attacker could send a specially-crafted locale string containing "dot dot" sequences (/../) to switch arbitrary moment locale.

— IBM

Moment.js is a JavaScript date library for parsing, validating, manipulating, and formatting dates. A path traversal vulnerability impacts npm (server) users of Moment.js between versions 1.0.1 and 2.29.1, especially if a user-provided locale string is directly used to switch moment locale. This problem is patched in 2.29.2, and the patch can be applied to all affected versions. As a workaround, sanitize the user-provided locale name before passing it to Moment.js.

Affected Software

29 affected componentsFixes available
redhat/servicemesh-prometheus<0:2.14.0-18.el8.1
0:2.14.0-18.el8.1
redhat/servicemesh-prometheus<0:2.23.0-9.el8
0:2.23.0-9.el8
redhat/ceph<2:16.2.10-94.el8c
2:16.2.10-94.el8c
redhat/eap7-hal-console<0:3.3.12-1.Final_redhat_00001.1.el8ea
0:3.3.12-1.Final_redhat_00001.1.el8ea
redhat/eap7-hal-console<0:3.3.12-1.Final_redhat_00001.1.el7ea
0:3.3.12-1.Final_redhat_00001.1.el7ea
redhat/rh-sso7-keycloak<0:18.0.6-1.redhat_00001.1.el7
0:18.0.6-1.redhat_00001.1.el7
redhat/rh-sso7-keycloak<0:18.0.6-1.redhat_00001.1.el8
0:18.0.6-1.redhat_00001.1.el8
redhat/rh-sso7-keycloak<0:18.0.6-1.redhat_00001.1.el9
0:18.0.6-1.redhat_00001.1.el9
nuget/moment.js<2.29.2
2.29.2
npm/moment<2.29.2
2.29.2
Momentjs Moment Node.js>=1.0.1<2.29.2
Momentjs Moment Nuget>=1.0.1<2.29.2
Tenable Tenable.Sc<5.21.0
NetApp Active Iq
Fedoraproject Fedora=35
Fedoraproject Fedora=36
Debian Debian Linux=10.0
redhat/moment v<2.29.2
2.29.2
IBM Db2 Genius Hub<=1.1, 1.1.1, 1.1.2
IBM Agentics<=1.0
ubuntu/nikola*
ubuntu/node-moment<2.11.0+ds-1ubuntu0.1~esm2
2.11.0+ds-1ubuntu0.1~esm2
ubuntu/node-moment<2.20.1+ds-1ubuntu0.1
2.20.1+ds-1ubuntu0.1
ubuntu/node-moment<2.24.0+ds-2ubuntu0.1
2.24.0+ds-2ubuntu0.1
ubuntu/node-moment<2.29.1+ds-3ubuntu0.2
2.29.1+ds-3ubuntu0.2
debian/node-moment<2.29.2+ds-1
2.29.2+ds-1
debian/node-moment<2.29.2+ds-1
2.29.2+ds-1
debian/node-moment<2.29.2+ds-1
2.29.2+ds-1
debian/node-moment
2.24.0+ds-1+deb10u12.29.1+ds-2+deb11u12.29.2+ds-1

Remediation

Recommended actions to resolve this vulnerability, in priority order.

  1. Upgrade

    Upgrade redhat/servicemesh-prometheus to a version that resolves this vulnerability.

    Fixed in 0:2.14.0-18.el8.1
  2. Upgrade

    Upgrade redhat/servicemesh-prometheus to a version that resolves this vulnerability.

    Fixed in 0:2.23.0-9.el8
  3. Upgrade

    Upgrade redhat/ceph to a version that resolves this vulnerability.

    Fixed in 2:16.2.10-94.el8c
  4. Upgrade

    Upgrade redhat/eap7-hal-console to a version that resolves this vulnerability.

    Fixed in 0:3.3.12-1.Final_redhat_00001.1.el8ea
  5. Upgrade

    Upgrade redhat/eap7-hal-console to a version that resolves this vulnerability.

    Fixed in 0:3.3.12-1.Final_redhat_00001.1.el7ea
  6. Upgrade

    Upgrade redhat/rh-sso7-keycloak to a version that resolves this vulnerability.

    Fixed in 0:18.0.6-1.redhat_00001.1.el7
  7. Upgrade

    Upgrade redhat/rh-sso7-keycloak to a version that resolves this vulnerability.

    Fixed in 0:18.0.6-1.redhat_00001.1.el8
  8. Upgrade

    Upgrade redhat/rh-sso7-keycloak to a version that resolves this vulnerability.

    Fixed in 0:18.0.6-1.redhat_00001.1.el9
  9. Upgrade

    Upgrade nuget/Moment.js to a version that resolves this vulnerability.

    Fixed in 2.29.2
  10. Upgrade

    Upgrade npm/moment to a version that resolves this vulnerability.

    Fixed in 2.29.2
  11. Upgrade

    Upgrade redhat/moment v to a version that resolves this vulnerability.

    Fixed in 2.29.2
  12. Upgrade

    Upgrade ubuntu/node-moment to a version that resolves this vulnerability.

    Fixed in 2.11.0+ds-1ubuntu0.1~esm2
  13. Upgrade

    Upgrade ubuntu/node-moment to a version that resolves this vulnerability.

    Fixed in 2.20.1+ds-1ubuntu0.1
  14. Upgrade

    Upgrade ubuntu/node-moment to a version that resolves this vulnerability.

    Fixed in 2.24.0+ds-2ubuntu0.1
  15. Upgrade

    Upgrade ubuntu/node-moment to a version that resolves this vulnerability.

    Fixed in 2.29.1+ds-3ubuntu0.2
  16. Upgrade

    Upgrade debian/node-moment to a version that resolves this vulnerability.

    Fixed in 2.29.2+ds-1
  17. Upgrade

    Upgrade debian/node-moment to a version that resolves this vulnerability.

    Fixed in 2.24.0+ds-1+deb10u1Fixed in 2.29.1+ds-2+deb11u1Fixed in 2.29.2+ds-1
  18. Upgrade

    Upgrade moment to a version that resolves this vulnerability.

    Fixed in 2.29.2
  19. Compensating control

    Sanitize the user-provided locale name before passing it to Moment.js when switching moment locale (e.g., do not directly use attacker-controlled locale strings like `fr` to set the locale).

Event History

Apr 4, 2022
CVE Published
via MITRE·12:00 AM
Data Sourced
12:00 AM
RemedyDescriptionSeverityWeaknessAffected Software
Data Sourced
via Ubuntu·12:00 AM
RemedyDescriptionSeverityAffected Software
Data Sourced
via MITRE·12:00 AM
DescriptionSeverityWeakness
Updated
via Ubuntu·12:00 AM
RemedyDescriptionAffected Software
Data Sourced
via OSV·05:15 PM
DescriptionSeverityAffected Software
Advisory Published
09:25 PM
Sep 6, 2022
Updated
via IBM·12:00 AM
Affected Software
May 29, 2023
Exploit Published
via GitHub·11:40 PM
Sep 1, 2023
Data Sourced
via Red Hat·03:08 AM
DescriptionSeverityAffected Software
Nov 7, 2023
Data Sourced
via NVD·03:44 AM
RemedyDescriptionSeverityWeaknessAffected Software
Updated
03:44 AM
Affected Software
Nov 29, 2023
Advisory Published
10:04 PM
Jun 27, 2024
Data Sourced
via IBM·12:00 AM
DescriptionSeverityAffected Software
Updated
via IBM·12:00 AM
Affected Software
Nov 21, 2024
Updated
via NVD·06:51 AM
RemedyAffected Software
Mar 25, 2025
Updated
via IBM·12:00 AM
DescriptionAffected Software
Aug 28, 2025
Updated
via IBM·12:00 AM
DescriptionAffected Software
Mar 12, 2026
Updated
via IBM·12:00 AM
Description
Jun 17, 2026
Updated
via NVD·04:32 AM
Affected Software
Jul 13, 2026
Updated
via IBM·12:00 AM
Affected Software
Nov 18, 2026
Updated
via OSV·12:57 AM
Affected Software

Peer vulnerabilities

Found alongside the following vulnerabilities.

Frequently Asked Questions

1

What is CVE-2022-24785?

CVE-2022-24785 is a path traversal vulnerability in Moment.js that impacts npm (server) users.

2

How does the path traversal vulnerability in Moment.js impact users?

The path traversal vulnerability in Moment.js impacts npm (server) users, especially if a user-provided locale string is directly used to switch moment locale.

3

What versions of Moment.js are affected by CVE-2022-24785?

Versions 1.0.1 to 2.29.1 of Moment.js are affected by CVE-2022-24785.

4

What is the severity of CVE-2022-24785?

CVE-2022-24785 has a severity level of high (7).

5

How can I fix the path traversal vulnerability in Moment.js?

To fix the path traversal vulnerability in Moment.js, update to version 2.29.2.

Contact

SecAlerts Pty Ltd.
132 Wickham Terrace
Fortitude Valley,
QLD 4006, Australia
info@secalerts.co
By using SecAlerts services, you agree to our services end-user license agreement. This website is safeguarded by reCAPTCHA and governed by the Google Privacy Policy and Terms of Service. All names, logos, and brands of products are owned by their respective owners, and any usage of these names, logos, and brands for identification purposes only does not imply endorsement. If you possess any content that requires removal, please get in touch with us.
© 2026 SecAlerts Pty Ltd.
ABN: 70 645 966 203, ACN: 645 966 203