moment vulnerable to Path Traversal via crafted non-string locale name
### 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](https://github.com/moment/moment/security/advisories/GHSA-8hfj-j24r-96c4). 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()`.
GHSA-4p3w-j4w9-5jqw
Primary source · Revision 1
Imported from structured advisory data. Source references identify upstream records or fields; verify affected versions and your deployed configuration.
Security context
Source reference: osv:GHSA-4p3w-j4w9-5jqw
moment
Source reference: /affected/0/package/name
- Affected versions
- Not stated in this record
- Fixed versions
- 2.31.0
Source reference:
/affected/0/ranges - Prerequisites
- Not stated in this record
Structured affected-version data
Original package identities and version rules from this source.
[
{
"ranges": [
{
"type": "SEMVER",
"events": [
{
"introduced": "2.29.2"
},
{
"fixed": "2.31.0"
}
]
}
],
"package": {
"name": "moment",
"purl": "pkg:npm/moment",
"ecosystem": "npm"
},
"database_specific": {
"source": "https://github.com/github/advisory-database/blob/main/advisories/github-reviewed/2026/09/GHSA-4p3w-j4w9-5jqw/GHSA-4p3w-j4w9-5jqw.json"
}
}
]- Related CVEs
- CVE-2026-17495
Source reference:
/aliases
Publisher severity
No explicit severity was provided.
- Event
- #33270 · Revision 1
- Added to Heist Feed
- Publisher date