Skip to main content

moment.js CVE-2026-17495

| EUVDEUVD-2026-78277 MEDIUM
Path Traversal: 'dir/../../filename' (CWE-27)
2026-09-15 openjs GHSA-4p3w-j4w9-5jqw
5.9
CVSS 3.1 · Vendor: openjs
View

Attack ChainAIDerived

Hypothetical attack flow derived from CVE metadata – not a confirmed exploit chain

  1. Access
    Identify Node.js app passing unsanitized user input to moment.locale()
  2. Delivery
    Deliver crafted non-string object with overridden match()/toString()
  3. Exploit
    match() satisfies path-traversal guard check
  4. Execution
    toString() returns attacker-controlled traversal path
  5. Persist
    Internal require() loads attacker-specified module path
  6. Impact
    Unintended module loaded on server

Vulnerability Assessment

Weakness
CWE
OWASP Top 10:2025
A01:2025 - Broken Access Control
ASVS 5.0
V5 - File Handling Path traversal prevention
Exploitation Conditions

Exploitation requires a server-side Node.js application using moment 2.29.2-2.30.1 that passes user-controlled input directly to moment.locale() without first validating it is a primitive string type. The critical prerequisite is that the attacker must deliver a non-string JavaScript object with custom match() and toString() method implementations to the locale() call - standard JSON deserialization cannot encode method overrides, so exploitation requires a separate deserialization vulnerability, prototype pollution, or an application-layer code path that constructs JavaScript objects from user-supplied data. Passing a plain user-supplied string (the overwhelmingly common case) is not exploitable even in vulnerable versions. Browser-side moment.js usage is entirely unaffected regardless of version.

Impact

The official CVSS 3.1 score of 5.9 (AV:N/AC:H/PR:N/UI:N/S:U/C:N/I:H/A:N) is reasonable: AC:H reflects that constructing a non-string JavaScript object with divergent match()/toString() behaviors cannot be achieved through standard JSON deserialization alone (JSON cannot encode method overrides), materially limiting the attack surface to applications with additional deserialization or object-construction vectors. The impact is scoped to integrity - arbitrary module loading via require(). No EPSS score was included in the input data, no CISA KEV listing exists, and no POC has been confirmed, indicating this is not actively exploited at time of analysis. Real-world risk is elevated only for server-side Node.js applications that directly pass user-supplied locale values from untrusted sources to moment.locale() without type-checking - a narrower pattern than the library's broad deployment footprint might suggest. The 'Authentication Bypass' tag in the input is misleading; this is a guard-bypass/type-confusion leading to path traversal, not a credential or session mechanism bypass.

Exploit ScenarioDerived

An attacker targets a Node.js API that accepts a user-supplied locale parameter and passes it unsanitized to moment.locale(). By supplying a crafted non-string object - delivered via a deserialization endpoint, prototype pollution, or an application code path that constructs objects from user input - with a match() that returns a guard-passing result and a toString() that yields a path like '../../malicious/module', the attacker causes require() to load an attacker-specified module. Depending on the server's filesystem contents and module resolution, this could result in loading attacker-influenced or sensitive files.

This Month Plan within 30 days. Why: MEDIUM severity (CVSS 4.0-6.9).
Patch available 0.4% exploitation probability (EPSS)

Get an e-mail when this CVE is exploited, patched or re-scored. Free account.

Alert me

AnalysisAIv1 – Sep 15, 2026

Path-traversal guard bypass in moment.js 2.29.2-2.30.1 allows a remote unauthenticated attacker (in server-side Node.js contexts) to supply a crafted non-string object to moment.locale() that satisfies the string-assuming guard via a custom match() method while its toString() returns a traversal path - delivering attacker-controlled path segments to an internal require() call. This is an incomplete fix for CVE-2022-24785 and is resolved in version 2.31.0; no public exploit has been identified at time of analysis.

RemediationAI

Upgrade to moment 2.31.0 or later; this is a vendor-released patch confirmed by GitHub Security Advisory GHSA-4p3w-j4w9-5jqw and EUVD-2026-78277. As an immediate workaround without upgrading, validate that any user-supplied locale input is a string before passing it to moment.locale() - for example, enforcing typeof input === 'string' before the call. This type-guard blocks the type-confusion attack with no functional side effects. No compensating controls are needed for browser-side deployments, which are unaffected. Advisory reference: https://github.com/moment/moment/security/advisories/GHSA-4p3w-j4w9-5jqw.

Affected VersionsENISA

moment 2.29.2 <2.31.0

Affected Packages

npm moment fix: 2.31.0

Source: OSV (Open Source Vulnerabilities)

Affects your stack

Affects 1 package in npm

Checking this CVE against your own stacks and servers is part of the Basic plan and up.

Technical ContextAI · show details

moment.js is a widely-used JavaScript date/time library (CPE: cpe:2.3:a:moment:moment). Its locale() function accepts a locale name string, validates it against a path-traversal guard, and passes it to an internal require() call to load locale files. The original CVE-2022-24785 fix implemented a guard that relies on String.prototype.match(), implicitly assuming all inputs are strings. A crafted JavaScript object can override match() to return a guard-passing value while toString() returns a different string - specifically a path containing '/../' traversal sequences - exploiting the type-confusion to deliver attacker-controlled segments to require() (CWE-27: Path Traversal '/../filedir'). This divergence between the object's match() and toString() behaviors is the core of the incomplete-fix regression. Exploitation is confined to server-side Node.js (npm) environments; browser builds do not expose the require() mechanism.

Know when Moment gets its next vulnerability

  • Watch products and get an email when something new is published
  • Check this CVE against your own stack and servers
  • Exploit and PoC references, threat intelligence from 22 sources

No credit card · 7-day full trial

Severity by source

Vendor (openjs) PRIMARY 5.9 MEDIUM
AV:N/AC:H/PR:N/UI:N/S:U/C:N/I:H/A:N
vuln.today AI 5.9 MEDIUM

AC:H because crafting a non-string object with divergent match()/toString() is not achievable via standard JSON input, limiting practical attack paths; integrity-only impact reflects arbitrary module loading via require().

3.1 AV:N/AC:H/PR:N/UI:N/S:U/C:N/I:H/A:N
4.0 AV:N/AC:H/AT:N/PR:N/UI:N/VC:N/VI:H/VA:N/SC:N/SI:N/SA:N
SUSE 7.5 HIGH
AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:H/A:N
Red Hat 5.9 MEDIUM

Primary rating from Vendor (openjs).

CVSS VectorVendor: openjs

Attack Vector
Network
Attack Complexity
High
Privileges Required
None
User Interaction
None
Scope
Unchanged
Confidentiality
None
Integrity
High
Availability
None

Lifecycle Timeline

2
Patch available
Sep 15, 2026 - 07:01 EUVD
CVE Published
Sep 15, 2026 - 05:40 cve.org
MEDIUM 5.9

DescriptionCVE.org

moment is a JavaScript date library for parsing, validating, manipulating, and formatting dates. In versions 2.29.2 through 2.30.1, a specially crafted non-string object passed to moment.locale() can bypass the locale-name path-traversal guard. The guard assumes the input is a string, so an object whose match() method satisfies the check while its toString() returns a traversal path reaches an internal require() call with attacker-controlled path segments. This is an incomplete fix for CVE-2022-24785 and primarily affects npm (server-side) users that pass user-provided input directly to moment.locale(). The issue is fixed in moment 2.31.0, and users should upgrade to 2.31.0 or later. As a workaround, validate that any user-supplied input is a string before passing it to moment.locale().

Threat Intelligence Overview

EPSS Score
0.4%
Top 71% exploitable
Prevalence
High
widely used JavaScript date library, billions of historical npm downloads
Threat Intel
1
1 source
Social Media
1
Sightings
Data Quality
7 sources
Confidence: High
EUVD NVD CVE.org EPSS Vulnrichment GHSA Vendor CIRCL GitHub VulDB

How this decision was reached

The engine reads each signal below and applies a fixed list of rules from top to bottom. The first rule that matches sets the recommended action – like a statement, every line is shown.

SignalValue
Severity MEDIUM
CISA KEV No
Public POC No
EPSS 0.4%
Patch available Yes
Active threat No
Deciding rule
MEDIUM severity (CVSS 4.0-6.9)
What every action level means
Emergency Immediate action required. Criteria: CRITICAL + in CISA KEV (actively exploited) without patch, OR CRITICAL + EPSS > 30% without patch, OR CRITICAL + active threat signals without patch.
Act Now Prioritize within 24-48h. Criteria: in KEV with patch available, OR CRITICAL + public POC, OR HIGH + EPSS > 10%, OR CRITICAL + active threat, OR any CRITICAL severity.
This Week Schedule remediation this week. Criteria: HIGH severity (CVSS 7.0-8.9). Patch within normal change window.
This Month Plan within 30 days. Criteria: MEDIUM severity (CVSS 4.0-6.9), lower exploitation probability. Include in regular patch cycle.
Monitor Track and reassess. Criteria: LOW severity (CVSS 0.1-3.9), minimal exploitation risk. No immediate action needed.

SSVC AssessmentENISA

SSVC Decision· derived
Scheduled
Exploitation
None
System Exposure· derived
Open
Automatable
No
Human Impact· derived
Medium
Technical Impact
Partial

Priority Score

30
Low Medium High Critical
KEV: 0
EPSS: 0
CVSS: +30
PoC: 0
Weaponized: 0
Threat intel: 0
Gov advisory: 0

Vendor StatusVendor

SUSE

Severity: Important
Product Status
SUSE Linux Enterprise Desktop 15 SP7 Affected
SUSE Linux Enterprise High Performance Computing 12 Not-Affected
SUSE Linux Enterprise Micro 5.3 Affected
SUSE Linux Enterprise Micro 5.3 Affected
SUSE Linux Enterprise Micro 5.4 Affected

This site uses cookies essential for authentication and security. No tracking or analytics cookies are used. Privacy Policy