GitHub Advisoryadvisory · npm

GHSA-4p3w-j4w9-5jqw moment vulnerable to Path Traversal via crafted non-string locale name

MEDIUM Published 2026-09-29 Modified 2026-09-29 Official page ↗
Aliases
CVE-2026-17495
Ecosystem
npm
Packages
moment
Severity
Moderate
CVSS vector
CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:N/I:H/A:N
Weaknesses
CWE-27
Reviewed
2026-09-29

Affected packages

• npm moment: >= 2.29.2, < 2.31.0 → fixed in 2.31.0

Description

Impact moment 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. This affects server-side (npm) users only. Plain string input is not affected: the existing validation correctly rejects strings that contain path separators. Patches This issue is patched in moment 2.31.0. Workarounds Validate that any user-supplied input is a string before passing it to `moment.locale()`.

Related

Alias · CVE (1)

  • CVE-2026-17495 moment is a JavaScript date library for parsing, validating, manipulating, and formatting dates. vulnerability

Weakness · CWE (1)

  • CWE-27 Path Traversal: 'dir/../../filename' weakness

References