CVE-2026-17495: Moment Path Traversal Vulnerability
MODERATECVE-2026-17495 is a MODERATE (CVSS 5.9) path traversal vulnerability (CWE-27: Path Traversal: 'dir/../../filename') affecting Moment libraries in the npm ecosystem. The issue involves moment vulnerable to path traversal via crafted non-string locale name. Remediation is available by upgrading affected packages to version 2.31.0.
CVE-2026-17495 at a Glance
Security Impact
CVSS: 5.9
The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:N/I:H/A:N).
How to Fix CVE-2026-17495
To remediate this vulnerability, upgrade all affected Moment dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.
npm install moment@2.31.0
Run the following command in your project directory to verify that all resolved dependencies use the patched release:
npm ls moment
How to Check if You Are Affected
To determine whether your Node.js application is affected by CVE-2026-17495, inspect your project dependencies using npm:
npm ls moment
Analyze the terminal output to locate any version of Moment in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 2.31.0), your application is affected.
Note: The npm ls moment command inspects dependencies declared in your package.json and lockfile; it does not perform automated runtime dynamic scanning.
Technical Details
Vulnerability Mechanism & Technical Analysis
This vulnerability is classified under CWE-27: Path Traversal: 'dir/../../filename', where the product uses external input to construct a pathname that should be within a restricted directory, but it does not properly neutralize multiple internal "../" sequences that can resolve to a location that is outside of that directory. In Moment, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.
Source Advisory Statement
CVE-2026-17495 Affected Moment Versions
1 component(s)| Product / Package | Ecosystem | Affected Versions | Fixed Version |
|---|---|---|---|
|
moment
|
npm |
≥ 2.29.2
< 2.31.0
|
2.31.0
|
References
Frequently Asked Questions
What is CVE-2026-17495?
Which Moment versions are affected?
What version fixes CVE-2026-17495?
Is moment affected?
What is the CVSS score of CVE-2026-17495?
What CWE is associated with CVE-2026-17495?
How can I check npm dependencies for CVE-2026-17495?
Machine-readable OSV JSON
OSV v1.5 Schema
{
"schema_version" : "1.4.0",
"id" : "GHSA-4p3w-j4w9-5jqw",
"modified" : "2026-09-29T23:46:02Z",
"published" : "2026-09-29T23:46:02Z",
"aliases" : [ "CVE-2026-17495" ],
"summary" : "moment vulnerable to Path Traversal via crafted non-string locale name",
"details" : "### Impact\n\nmoment before 2.31.0 is vulnerable to path traversal in `moment.locale()`. When an application passes a non-string, attacker-influenced value to `moment.locale()`, a specially crafted object can bypass the locale name validation and cause moment to load a file from an attacker-controlled path. This is a further bypass of the validation added in 2.29.2 for [CVE-2022-24785](https://github.com/moment/moment/security/advisories/GHSA-8hfj-j24r-96c4).\n\nThis affects server-side (npm) users only. Plain string input is not affected: the existing validation correctly rejects strings that contain path separators.\n\n### Patches\n\nThis issue is patched in moment 2.31.0.\n\n### Workarounds\n\nValidate that any user-supplied input is a string before passing it to `moment.locale()`.",
"severity" : [ {
"type" : "CVSS_V3",
"score" : "CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:N/I:H/A:N"
} ],
"affected" : [ {
"package" : {
"ecosystem" : "npm",
"name" : "moment"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "2.29.2"
}, {
"fixed" : "2.31.0"
} ]
} ]
} ],
"references" : [ {
"type" : "WEB",
"url" : "https://github.com/moment/moment/security/advisories/GHSA-4p3w-j4w9-5jqw"
}, {
"type" : "ADVISORY",
"url" : "https://nvd.nist.gov/vuln/detail/CVE-2026-17495"
}, {
"type" : "WEB",
"url" : "https://github.com/moment/moment/pull/6386"
}, {
"type" : "WEB",
"url" : "https://github.com/moment/moment/commit/5f7d983c9881e65e07574de9dda3190d99520c07"
}, {
"type" : "WEB",
"url" : "https://cna.openjsf.org/security-advisories.html"
}, {
"type" : "PACKAGE",
"url" : "https://github.com/moment/moment"
}, {
"type" : "WEB",
"url" : "https://github.com/moment/moment/releases/tag/2.31.0"
} ],
"database_specific" : {
"cwe_ids" : [ "CWE-27" ],
"severity" : "MODERATE",
"github_reviewed" : true,
"github_reviewed_at" : "2026-09-29T23:46:02Z",
"nvd_published_at" : "2026-09-15T06:16:57Z"
}
}