The SentinelOne Annual Threat Report - A Defenders Guide from the FrontlinesThe SentinelOne Annual Threat ReportGet the Report
Experiencing a Breach?Blog
Get StartedContact Us
SentinelOne
  • Platform
    Platform Overview
    • Singularity Platform
      Welcome to Integrated Enterprise Security
    • AI for Security
      Leading the Way in AI-Powered Security Solutions
    • Securing AI
      Accelerate AI Adoption with Secure AI Tools, Apps, and Agents.
    • How It Works
      The Singularity XDR Difference
    • Singularity Marketplace
      One-Click Integrations to Unlock the Power of XDR
    • Pricing & Packaging
      Comparisons and Guidance at a Glance
    Data & AI
    • Purple AI
      Accelerate SecOps with Generative AI
    • Singularity Hyperautomation
      Easily Automate Security Processes
    • AI-SIEM
      The AI SIEM for the Autonomous SOC
    • Singularity Data Lake
      AI-Powered, Unified Data Lake
    • Singularity Data Lake for Log Analytics
      Seamlessly Ingest Data from On-Prem, Cloud or Hybrid Environments
    Endpoint Security
    • Singularity Endpoint
      Autonomous Prevention, Detection, and Response
    • Singularity XDR
      Native & Open Protection, Detection, and Response
    • Singularity RemoteOps Forensics
      Orchestrate Forensics at Scale
    • Singularity Threat Intelligence
      Comprehensive Adversary Intelligence
    • Singularity Vulnerability Management
      Application & OS Vulnerability Management
    • Singularity Identity
      Identity Threat Detection and Response
    Cloud Security
    • Singularity Cloud Security
      Block Attacks with an AI-Powered CNAPP
    • Singularity Cloud Native Security
      Secure Cloud and Development Resources
    • Singularity Cloud Workload Security
      Real-Time Cloud Workload Protection Platform
    • Singularity Cloud Data Security
      AI-Powered Threat Detection for Cloud Storage
    • Singularity Cloud Security Posture Management
      Detect and Remediate Cloud Misconfigurations
    Securing AI
    • Prompt Security
      Secure AI Tools Across Your Enterprise
  • Why SentinelOne?
    Why SentinelOne?
    • Why SentinelOne?
      Cybersecurity Built for What’s Next
    • Our Customers
      Trusted by the World’s Leading Enterprises
    • Industry Recognition
      Tested and Proven by the Experts
    • About Us
      The Industry Leader in Autonomous Cybersecurity
    Compare SentinelOne
    • Arctic Wolf
    • Broadcom
    • CrowdStrike
    • Cybereason
    • Microsoft
    • Palo Alto Networks
    • Sophos
    • Splunk
    • Trellix
    • Trend Micro
    • Wiz
    Verticals
    • Energy
    • Federal Government
    • Finance
    • Healthcare
    • Higher Education
    • K-12 Education
    • Manufacturing
    • Retail
    • State and Local Government
  • Services
    Managed Services
    • Managed Services Overview
      Wayfinder Threat Detection & Response
    • Threat Hunting
      World-Class Expertise and Threat Intelligence
    • Managed Detection & Response
      24/7/365 Expert MDR Across Your Entire Environment
    • Incident Readiness & Response
      DFIR, Breach Readiness, & Compromise Assessments
    Support, Deployment, & Health
    • Technical Account Management
      Customer Success with Personalized Service
    • SentinelOne GO
      Guided Onboarding & Deployment Advisory
    • SentinelOne University
      Live and On-Demand Training
    • Services Overview
      Comprehensive Solutions for Seamless Security Operations
    • SentinelOne Community
      Community Login
  • Partners
    Our Network
    • MSSP Partners
      Succeed Faster with SentinelOne
    • Singularity Marketplace
      Extend the Power of S1 Technology
    • Cyber Risk Partners
      Enlist Pro Response and Advisory Teams
    • Technology Alliances
      Integrated, Enterprise-Scale Solutions
    • SentinelOne for AWS
      Hosted in AWS Regions Around the World
    • Channel Partners
      Deliver the Right Solutions, Together
    • SentinelOne for Google Cloud
      Unified, Autonomous Security Giving Defenders the Advantage at Global Scale
    • Partner Locator
      Your Go-to Source for Our Top Partners in Your Region
    Partner Portal→
  • Resources
    Resource Center
    • Case Studies
    • Data Sheets
    • eBooks
    • Reports
    • Videos
    • Webinars
    • Whitepapers
    • Events
    View All Resources→
    Blog
    • Feature Spotlight
    • For CISO/CIO
    • From the Front Lines
    • Identity
    • Cloud
    • macOS
    • SentinelOne Blog
    Blog→
    Tech Resources
    • SentinelLABS
    • Ransomware Anthology
    • Cybersecurity 101
  • About
    About SentinelOne
    • About SentinelOne
      The Industry Leader in Cybersecurity
    • Investor Relations
      Financial Information & Events
    • SentinelLABS
      Threat Research for the Modern Threat Hunter
    • Careers
      The Latest Job Opportunities
    • Press & News
      Company Announcements
    • Cybersecurity Blog
      The Latest Cybersecurity Threats, News, & More
    • FAQ
      Get Answers to Our Most Frequently Asked Questions
    • DataSet
      The Live Data Platform
    • S Foundation
      Securing a Safer Future for All
    • S Ventures
      Investing in the Next Generation of Security, Data and AI
  • Pricing
Get StartedContact Us
CVE Vulnerability Database
Vulnerability Database/CVE-2022-24785

CVE-2022-24785: Moment.js Path Traversal Vulnerability

CVE-2022-24785 is a path traversal vulnerability in Moment.js affecting npm users on versions 1.0.1 to 2.29.1. Attackers can exploit unsanitized locale strings to traverse directories. This article covers technical details, affected versions, impact, and mitigation strategies.

Published: February 25, 2026

CVE-2022-24785 Overview

Moment.js is a widely-used JavaScript date library for parsing, validating, manipulating, and formatting dates. A path traversal vulnerability (CWE-22) affects npm (server) users of Moment.js between versions 1.0.1 and 2.29.1. This vulnerability is particularly dangerous when a user-provided locale string is directly used to switch the moment locale, allowing attackers to traverse the file system and potentially access or include arbitrary files.

Critical Impact

Attackers can exploit user-controlled locale input to perform path traversal attacks on Node.js servers, potentially leading to information disclosure or arbitrary file access through directory traversal sequences.

Affected Products

  • Momentjs Moment (versions 1.0.1 through 2.29.1)
  • Tenable Tenable.sc
  • NetApp Active IQ
  • Fedora 35 and 36
  • Debian Linux 10.0

Discovery Timeline

  • 2022-04-04 - CVE-2022-24785 published to NVD
  • 2025-11-03 - Last updated in NVD database

Technical Details for CVE-2022-24785

Vulnerability Analysis

This path traversal vulnerability exists in the locale loading mechanism of Moment.js. When applications allow user-supplied input to determine which locale file to load, the library fails to properly sanitize the input before constructing file system paths. This oversight enables attackers to inject path traversal sequences (such as ../) into locale names, causing the application to load arbitrary files from the server's file system rather than legitimate locale files.

The vulnerability is accessible via network without requiring authentication or user interaction. The primary security impact is to data integrity, as attackers can potentially manipulate which files are loaded and processed by the application.

Root Cause

The root cause is insufficient input validation in the locale loading functionality. Prior to the patch, Moment.js did not validate that locale names were safe filesystem identifiers. The library would accept locale strings containing path separator characters (/ or \), allowing attackers to escape the intended locale directory and access files elsewhere on the filesystem.

Attack Vector

The attack targets Node.js server-side applications that pass user-controlled input directly to Moment.js locale switching functions. An attacker can craft malicious locale strings containing directory traversal sequences to access files outside the designated locale directory. For example, a request with a locale parameter like ../../etc/passwd could potentially cause the server to attempt loading sensitive system files.

The security patch implemented in version 2.29.2 adds validation to reject any locale name containing path separator characters:

javascript
     return globalLocale;
 }
 
+function isLocaleNameSane(name) {
+    // Prevent names that look like filesystem paths, i.e contain '/' or '\\'
+    return name.match('^[^/\\\\]*$') != null;
+}
+
 function loadLocale(name) {
     var oldLocale = null,
         aliasedRequire;

Source: GitHub Commit Details

Detection Methods for CVE-2022-24785

Indicators of Compromise

  • HTTP requests containing path traversal sequences (../, ..\\) in locale-related parameters
  • Application logs showing attempts to load locale files from unexpected directories
  • Error messages indicating failed file access attempts outside the locale directory
  • Unusual file system access patterns from Node.js application processes

Detection Strategies

  • Implement web application firewall (WAF) rules to detect and block path traversal patterns in request parameters
  • Monitor application logs for locale loading errors that reference paths outside the expected locale directory
  • Use software composition analysis (SCA) tools to identify vulnerable Moment.js versions in your codebase
  • Deploy runtime application self-protection (RASP) solutions to detect file system access anomalies

Monitoring Recommendations

  • Enable verbose logging for locale-related operations in applications using Moment.js
  • Set up alerts for repeated failed locale loading attempts from the same source
  • Monitor dependency scanning reports for vulnerable Moment.js versions across your organization
  • Track network requests containing suspicious locale parameter values

How to Mitigate CVE-2022-24785

Immediate Actions Required

  • Upgrade Moment.js to version 2.29.2 or later immediately
  • Audit all code paths where user input is passed to Moment.js locale functions
  • Implement input validation to sanitize locale names before passing to Moment.js
  • Review application logs for any evidence of exploitation attempts

Patch Information

The vulnerability is patched in Moment.js version 2.29.2. The fix can also be backported to earlier versions. The patch adds a validation function isLocaleNameSane() that rejects any locale name containing forward slashes (/) or backslashes (\), preventing path traversal attacks.

For detailed patch information, see the GitHub Security Advisory and the GitHub Commit Details.

Additional vendor advisories:

  • Tenable Security Notification
  • NetApp Security Advisory

Workarounds

  • Sanitize user-provided locale names by removing or rejecting any input containing / or \ characters
  • Use an allowlist of valid locale names and reject any input not matching the list
  • Avoid passing user-controlled input directly to Moment.js locale switching functions
  • Consider migrating to alternative date libraries with active maintenance and security support
bash
# Example input sanitization in Node.js before passing to Moment.js
# Validate locale matches expected format (alphanumeric and hyphens only)
VALID_LOCALE_PATTERN="^[a-zA-Z]{2,3}(-[a-zA-Z]{2,4})?$"
# Reject any locale containing path separators
echo "$locale" | grep -E "^[^/\\\\]*$" || exit 1

Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.

  • Vulnerability Details
  • TypePath Traversal

  • Vendor/TechMomentjs

  • SeverityHIGH

  • CVSS Score7.5

  • EPSS Probability1.67%

  • Known ExploitedNo
  • CVSS Vector
  • CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:H/A:N
  • Impact Assessment
  • ConfidentialityLow
  • IntegrityNone
  • AvailabilityNone
  • CWE References
  • CWE-22
  • Technical References
  • Debian LTS Announcement

  • Fedora Package Announcement

  • Fedora Package Announcement

  • NetApp Security Advisory

  • NetApp Security Advisory
  • Vendor Resources
  • GitHub Commit Details

  • GitHub Security Advisory

  • Tenable Security Notification
  • Related CVEs
  • CVE-2022-31129: Moment.js ReDoS Vulnerability
Experience the World’s Most Advanced Cybersecurity Platform

Experience the World’s Most Advanced Cybersecurity Platform

See how our intelligent, autonomous cybersecurity platform can protect your organization now and into the future.

Try SentinelOne
  • Get Started
  • Get a Demo
  • Product Tour
  • Why SentinelOne
  • Pricing & Packaging
  • FAQ
  • Contact
  • Contact Us
  • Customer Support
  • SentinelOne Status
  • Language
  • Platform
  • Singularity Platform
  • Singularity Endpoint
  • Singularity Cloud
  • Singularity AI-SIEM
  • Singularity Identity
  • Singularity Marketplace
  • Purple AI
  • Services
  • Wayfinder TDR
  • SentinelOne GO
  • Technical Account Management
  • Support Services
  • Verticals
  • Energy
  • Federal Government
  • Finance
  • Healthcare
  • Higher Education
  • K-12 Education
  • Manufacturing
  • Retail
  • State and Local Government
  • Cybersecurity for SMB
  • Resources
  • Blog
  • Labs
  • Case Studies
  • Videos
  • Product Tours
  • Events
  • Cybersecurity 101
  • eBooks
  • Webinars
  • Whitepapers
  • Press
  • News
  • Ransomware Anthology
  • Company
  • About Us
  • Our Customers
  • Careers
  • Partners
  • Legal & Compliance
  • Security & Compliance
  • Investor Relations
  • S Foundation
  • S Ventures

©2026 SentinelOne, All Rights Reserved.

Privacy Notice Terms of Use

English