Quick answers
- Is CVE-2022-31129 exploited in the wild?
- No. Junglewise Threat Intelligence has no report of CVE-2022-31129 being exploited in the wild.
- How severe is CVE-2022-31129?
- Low severity, with a CVSS score of 3.1, published 6 July 2022.
- Which products and versions are affected?
- Moment.js (NuGet) ECOSYSTEM:introduced=2.18.0,fixed=2.29.4.
- Is there a fix for CVE-2022-31129?
- Yes. Moment.js (NuGet): upgrade to 2.29.4 or later. Junglewise finds every place you run it, drafts the upgrade and applies it once you approve.
- How is CVE-2022-31129 attacked?
- It is attacked over the network, in a software library.
- Am I affected by CVE-2022-31129?
- Check whether you run Moment.js (NuGet) at an affected version. Junglewise does that check for you around the clock: connect your code, cloud and domains, and it matches new vulnerabilities like this one against what you actually run and tells you when one reaches you.
How to fix
- Moment.js (NuGet): upgrade to 2.29.4 or later
dotnet add package Moment.js --version 2.29.4
Technical details
The vulnerability is an inefficient regular expression complexity issue (CWE-1333) in Moment.js's RFC2822 date parsing logic, specifically in the code that removes legacy comments (content within parentheses) from input strings. The regex pattern exhibits quadratic (N²) complexity on certain malicious inputs. An unauthenticated attacker can trigger this by passing a specially crafted string (e.g., repeated opening parentheses) to the moment() constructor; for example, moment("(".repeat(500000)) will consume several minutes of CPU time. No authentication is required, and the attack succeeds with default parsing behavior. The vulnerability affects versions 2.18.0 through 2.29.3 and is patched in version 2.29.4.
Affected products
- Moment.js Moment.js 2.18.0 through 2.29.3
Identifiers
- CVE-2022-31129
- GHSA-wc69-rhjr-hc9g
Timeline
- 2022-07-06: disclosed
- 2022-07-06: patched: Version 2.29.4 released with fix