Resource exhaustion in Moment

CVE-2022-31129

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.

Vulnerability class: DoS (Denial of Service)

EPSS: 0.049 (91.2th percentile) — read the EPSS interpretation.

CVSS v3 metric

CVSS v3 base score 7.5 (High). Vector: CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H.

Affected products

Weakness classification (CWE)

Public proof-of-concept exploits

References

Frequently asked questions

What is CVE-2022-31129?
CVE-2022-31129 is a high-severity vulnerability in Moment, classified under Uncontrolled Resource Consumption. CVSS score: 7.5/10. Published 2022-07-06.
How severe is CVE-2022-31129?
High severity. CVSS v3 base score is 7.5 out of 10.
Is CVE-2022-31129 known to be exploited?
4 public proof-of-concept repositories are indexed. Not currently listed in the CISA KEV catalog.