Patchfirst
CVE-2022-24785 Public exploit High · 7.5 EPSS 5.3%

Path Traversal in Moment.js

Fix:upgrade moment to 2.29.2 or later Details ↓

moment · moment

Summary

Moment.js, the JavaScript date library, contains a path traversal flaw affecting its npm (server-side) usage in versions 1.0.1 through 2.29.1, particularly where a user-provided locale string is passed directly to switch the moment locale. An attacker who can supply that locale string over the network, without authentication or user interaction, can traverse directories to reach files outside the intended locale path, with the impact on integrity.

Official description · CVE.org

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.

Breakdown
65.4 / 100
Exploited
Yes, in VulnCheck KEV
Reports
0
Tactics
0/15

First seen exploited 2 years after disclosure. Public exploit code (PoC-in-GitHub) appeared 14 months after disclosure.

  1. Disclosedday 0
  2. Public exploit codePoC-in-GitHub+14 mo
  3. First seen exploitedVulnCheck KEV evidence+2 yrs

A fix was bypassed or incomplete once over 4 years. The latest fix listed for moment is 2.31.0.

Linked vulnerabilitiesLinked by evidence that a fix failed or the same code was patched again. Oldest first.

  1. This CVECVE-2022-24785Path Traversal in Moment.js4 Apr 2022
  2. incomplete fixHigh

    Why these are linked:

    • Stated in the CVE textThis is an incomplete fix for CVE-2022-24785 and primarily affects npm (server-side) users that pass user-provided input directly to moment.locale().
    • Similar weakness in the same product (machine-matched)same product + CWE + description similarity
    CVE-2026-17495moment vulnerable to Path Traversal via crafted non-string…15 Sep 2026

Fixes in momentnpm package, by fixed version. Earlier and later fixes in the same package, not necessarily the same bug.

  1. 2.11.2CVE-2016-405523 Jan 2017
  2. 2.19.3CVE-2017-182144 Mar 2018
  3. 2.29.2CVE-2022-247854 Apr 2022
  4. 2.29.4CVE-2022-311296 Jul 2022
  5. 2.31.0CVE-2026-1749515 Sep 2026Latest listed

Affected versions and fixes

as published in the CVE record

moment moment

Affected: >= 1.0.1, < 2.29.2

Am I affected? What do I upgrade to?

From GitHub Security Advisories and OSV

2 packages in 2 ecosystems. Main package: moment.

Upgrade to 2.29.2 or later

npmnpm install moment@2.29.2

The first fix for CVE-2022-24785. No other CVE tracked by Patchfirst affects this package.

Affected versions

If you runUpgrade to
All versions before 2.29.22.29.2

“Up to” means the second version is the fix and is not affected.

Other packages that bundle this code (1)

Forks, repackagings and products that include the affected code. Each has its own fixed version.

  • NuGetMoment.js
    Affected: All versions before 2.29.2Upgrade to 2.29.2 or later

Check your lockfile against all CVEs

What security researchers reported

Not named in any threat report yet

Also mentioned in 4 community threat pulses (AlienVault OTX)

Weaker evidence

Pulses are indicator collections that anyone can publish. A mention is not confirmation of exploitation.

References

8 links, grouped by NVD tag
↑ ↓ chooseEnter openEsc close