CVE-2022-24785 Path Traversal in Moment.js

High 7.5 Published Updated

Attackers can exploit path traversal in Moment.js via user-provided locale strings to access unauthorized files or cause errors.

Exploited in the wild
Not known
Login needed
Not needed
Attackable
Over the internet
Victim action needed
Not needed
Fix
Available

What is CVE-2022-24785?

CVE-2022-24785 is a high-severity path traversal vulnerability in Debian Debian Linux, published on 4 Apr 2022. An attacker can exploit it over the internet without logging in, with no action from the victim.

Official description

Moment.js is a JavaScript date library for parsing, validating, manipulating, and formatting dates. A path traversal vulnerability impacts npm (server) users of Moment.js between versions 1.0.1 and 2.29.1, especially if a user-provided locale string is directly used to switch moment locale. This problem is patched in 2.29.2, and the patch can be applied to all affected versions. As a workaround, sanitize the user-provided locale name before passing it to Moment.js.

Weakness: CWE-27, CWE-22

Which versions are affected by CVE-2022-24785?

4 open source packages ship an affected version, including Moment.js and moment. It affects 5 products.

PackageAffectedFixed in
Moment.js NuGetAll versions2.29.2
Moment.js NuGetAll versions2.29.2
moment npmAll versions2.29.2
moment npmAll versions2.29.2
Linux distribution packages (36)
ceph Red Hat:ceph_storage:5.3::el8All versions2:16.2.10-94.el8cp
ceph-base Red Hat:ceph_storage:5.3::el8All versions2:16.2.10-94.el8cp
ceph-base-debuginfo Red Hat:ceph_storage:5.3::el8All versions2:16.2.10-94.el8cp
ceph-common Red Hat:ceph_storage:5.3::el8All versions2:16.2.10-94.el8cp
ceph-common-debuginfo Red Hat:ceph_storage:5.3::el8All versions2:16.2.10-94.el8cp
ceph-debugsource Red Hat:ceph_storage:5.3::el8All versions2:16.2.10-94.el8cp
ceph-fuse Red Hat:ceph_storage:5.3::el8All versions2:16.2.10-94.el8cp
ceph-fuse-debuginfo Red Hat:ceph_storage:5.3::el8All versions2:16.2.10-94.el8cp
ceph-grafana-dashboards Red Hat:ceph_storage:5.3::el8All versions2:16.2.10-94.el8cp
ceph-immutable-object-cache Red Hat:ceph_storage:5.3::el8All versions2:16.2.10-94.el8cp
ceph-immutable-object-cache-debuginfo Red Hat:ceph_storage:5.3::el8All versions2:16.2.10-94.el8cp
ceph-mds Red Hat:ceph_storage:5.3::el8All versions2:16.2.10-94.el8cp
ceph-mds-debuginfo Red Hat:ceph_storage:5.3::el8All versions2:16.2.10-94.el8cp
ceph-mgr Red Hat:ceph_storage:5.3::el8All versions2:16.2.10-94.el8cp
ceph-mgr-cephadm Red Hat:ceph_storage:5.3::el8All versions2:16.2.10-94.el8cp
ceph-mgr-dashboard Red Hat:ceph_storage:5.3::el8All versions2:16.2.10-94.el8cp
ceph-mgr-debuginfo Red Hat:ceph_storage:5.3::el8All versions2:16.2.10-94.el8cp
ceph-mgr-diskprediction-local Red Hat:ceph_storage:5.3::el8All versions2:16.2.10-94.el8cp
ceph-mgr-k8sevents Red Hat:ceph_storage:5.3::el8All versions2:16.2.10-94.el8cp
ceph-mgr-modules-core Red Hat:ceph_storage:5.3::el8All versions2:16.2.10-94.el8cp
ceph-mgr-rook Red Hat:ceph_storage:5.3::el8All versions2:16.2.10-94.el8cp
ceph-mib Red Hat:ceph_storage:5.3::el8All versions2:16.2.10-94.el8cp
ceph-mon Red Hat:ceph_storage:5.3::el8All versions2:16.2.10-94.el8cp
ceph-mon-debuginfo Red Hat:ceph_storage:5.3::el8All versions2:16.2.10-94.el8cp
ceph-osd Red Hat:ceph_storage:5.3::el8All versions2:16.2.10-94.el8cp
ceph-osd-debuginfo Red Hat:ceph_storage:5.3::el8All versions2:16.2.10-94.el8cp
ceph-prometheus-alerts Red Hat:ceph_storage:5.3::el8All versions2:16.2.10-94.el8cp
ceph-radosgw Red Hat:ceph_storage:5.3::el8All versions2:16.2.10-94.el8cp
ceph-radosgw-debuginfo Red Hat:ceph_storage:5.3::el8All versions2:16.2.10-94.el8cp
ceph-resource-agents Red Hat:ceph_storage:5.3::el8All versions2:16.2.10-94.el8cp
ceph-selinux Red Hat:ceph_storage:5.3::el8All versions2:16.2.10-94.el8cp
ceph-test Red Hat:ceph_storage:5.3::el8All versions2:16.2.10-94.el8cp
ceph-test-debuginfo Red Hat:ceph_storage:5.3::el8All versions2:16.2.10-94.el8cp
cephadm Red Hat:ceph_storage:5.3::el8All versions2:16.2.10-94.el8cp
cephfs-mirror Red Hat:ceph_storage:5.3::el8All versions2:16.2.10-94.el8cp
cephfs-mirror-debuginfo Red Hat:ceph_storage:5.3::el8All versions2:16.2.10-94.el8cp

Products include Debian Debian Linux, Fedoraproject Fedora, Momentjs Moment, Netapp Active Iq, Tenable Tenable.sc.

How do I fix CVE-2022-24785?

Upgrade Moment.js to 2.29.2 or later.

Upgrade, and resolve every user-supplied path against an allowed base folder before opening it. More about Path traversal.

Is CVE-2022-24785 being exploited?

There is no known exploitation of CVE-2022-24785 in the wild and no public exploit code.

Public exploit code: 1 proofs of concept on GitHub.

All Debian Debian Linux vulnerabilities

Sources

Also known as DEBIAN-CVE-2022-24785, GHSA-8hfj-j24r-96c4, RHSA-2023:0076, ROOT-APP-NPM-CVE-2022-24785, UBUNTU-CVE-2022-24785.

Is CVE-2022-24785 in your software?

Upload an SBOM and sbomify checks it against every vulnerability here, every day.

Check your SBOMs for free