{"id":"CVE-2022-31129","published":"2022-07-06T00:00:00Z","modified":"2025-11-03T21:46:17Z","title":"Inefficient Regular Expression Complexity in moment","vendor":"moment","product":"moment","tier":"tail","description":{"text":"moment is a JavaScript date library for parsing, validating, manipulating, and formatting dates. Affected versions of moment were found to use an inefficient parsing algorithm. Specifically using string-to-date parsing in moment (more specifically rfc2822 parsing, which is tried by default) has quadratic (N^2) complexity on specific inputs. Users may notice a noticeable slowdown is observed with inputs above 10k characters. Users who pass user-provided strings without sanity length checks to moment constructor are vulnerable to (Re)DoS attacks. The problem is patched in 2.29.4, the patch can be applied to all affected versions with minimal tweaking. Users are advised to upgrade. Users unable to upgrade should consider limiting date lengths accepted from user input.","provenance":"source","from":"CVE.org"},"cvss":{"score":7.5,"severity":"HIGH","version":"3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H","provenance":"source","from":"CVE.org CNA"},"epss":{"score":0.05551,"percentile":0.93032,"provenance":"source"},"cwes":[{"id":"CWE-400","name":"Uncontrolled Resource Consumption"}],"references":[{"url":"https://github.com/moment/moment/security/advisories/GHSA-wc69-rhjr-hc9g","tags":[]},{"url":"https://github.com/moment/moment/pull/6015#issuecomment-1152961973","tags":[]},{"url":"https://github.com/moment/moment/commit/9a3b5894f3d5d602948ac8a02e4ee528a49ca3a3","tags":[]},{"url":"https://huntr.dev/bounties/f0952b67-f2ff-44a9-a9cd-99e0a87cb633/","tags":[]},{"url":"https://lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/6QIO6YNLTK2T7SPKDS4JEL45FANLNC2Q/","tags":["vendor-advisory"]},{"url":"https://lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/ORJX2LF6KMPIHP6B2P6KZIVKMLE3LVJ5/","tags":["vendor-advisory"]},{"url":"https://lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/IWY24RJA3SBJGA5N4CU4VBPHJPPPJL5O/","tags":["vendor-advisory"]},{"url":"https://lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/ZMX5YHELQVCGKKQVFXIYOTBMN23YYSRO/","tags":["vendor-advisory"]},{"url":"https://security.netapp.com/advisory/ntap-20221014-0003/","tags":[]},{"url":"https://lists.debian.org/debian-lts-announce/2023/01/msg00035.html","tags":["mailing-list"]},{"url":"https://security.netapp.com/advisory/ntap-20241108-0002/","tags":[]}],"priority":{"score":23.9,"factors":[{"name":"EPSS percentile","points":18.61},{"name":"CVSS severity","points":5.25}]},"vendorSlug":"moment","affectedVersions":[{"vendor":"moment","product":"moment","versions":[">= 2.18.0, < 2.29.4"]}],"ssvc":{"exploitation":"poc","automatable":"yes","technicalImpact":"partial","timestamp":"2025-04-22T15:40:27.412408Z","from":"CISA ADP","provenance":"source"},"affected":[{"ecosystem":"npm","package":"moment","vulnerableRanges":[">=2.18.0, <2.29.4"],"patched":["2.29.4"],"from":["GHSA-wc69-rhjr-hc9g"],"provenance":"source"},{"ecosystem":"NuGet","package":"Moment.js","vulnerableRanges":[">=2.18.0, <2.29.4"],"patched":["2.29.4"],"from":["GHSA-wc69-rhjr-hc9g"],"provenance":"source"}],"summary":{"text":"The moment JavaScript date library uses an inefficient parsing algorithm in its string-to-date path, particularly the RFC 2822 parser that is tried by default, which has quadratic complexity on specific inputs. An attacker who can get the application to pass an unauthenticated network request's user-supplied string of more than about 10,000 characters into the moment constructor, without a length check, can cause a denial of service through heavy CPU consumption.","provenance":"ai","model":"claude-haiku-5-5","generatedAt":"2026-11-20T06:38:35Z"},"euvd":{"id":"EUVD-2022-6433","exploited":false,"provenance":"source"},"lineage":{"familyId":"fam-moment-cve-2022-31129","children":[{"from":"CVE-2022-31129","to":"CVE-2023-22467","relation":"related","confidence":"high","kind":"lineage","evidence":[{"kind":"osv-related","provenance":"source","id":"GHSA-wc69-rhjr-hc9g","via":"related"},{"kind":"osv-related","provenance":"source","id":"GHSA-3xq5-wjfh-ppjc","via":"reference","url":"https://github.com/moment/moment/security/advisories/GHSA-wc69-rhjr-hc9g"}]}],"packageHistory":[{"cve":"CVE-2016-4055","published":"2017-01-23","fixed":"2.11.2","kev":false},{"cve":"CVE-2017-18214","published":"2018-03-04","fixed":"2.19.3","kev":false},{"cve":"CVE-2022-24785","published":"2022-04-04","fixed":"2.29.2","kev":false,"link":{"from":"CVE-2022-24785","to":"CVE-2022-31129","relation":"successor","confidence":"low","kind":"sequence","evidence":[{"kind":"version-step","provenance":"source","package":"npm:moment","fromFixed":"2.29.2","toFixed":"2.29.4","daysApart":93},{"kind":"version-step","provenance":"source","package":"NuGet:Moment.js","fromFixed":"2.29.2","toFixed":"2.29.4","daysApart":93}]}},{"cve":"CVE-2022-31129","published":"2022-07-06","fixed":"2.29.4","kev":false},{"cve":"CVE-2026-17495","published":"2026-09-15","fixed":"2.31.0","kev":false}],"package":"npm:moment"}}