Details
Description
This issue also affects SaaS.
NPM-1081761 suppress
-
-
- Impact * using string-to-date parsing in moment (more specifically rfc2822 parsing, which is tried by default) has quadratic (N^2) complexity on specific inputs * 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 ### Patches The problem is patched in 2.29.4, the patch can be applied to all affected versions with minimal tweaking. ### Workarounds In general, given the proliferation of ReDoS attacks, it makes sense to limit the length of the user input to something sane, like 200 characters or less. I haven't seen legitimate cases of date-time strings longer than that, so all moment users who do pass a user-originating string to constructor are encouraged to apply such a rudimentary filter, that would help with this but also most future ReDoS vulnerabilities. ### References There is an excellent writeup of the issue here: https://github.com/moment/moment/pull/6015#issuecomment-1152961973= ### Details The issue is rooted in the code that removes legacy comments (stuff inside parenthesis) from strings during rfc2822 parsing. `moment("(".repeat(500000))` will take a few minutes to process, which is unacceptable.
-
Unscored:
- Severity: high
References:
- Advisory 1081761: Inefficient Regular Expression Complexity in moment - - https://github.com/moment/moment/security/advisories/GHSA-wc69-rhjr-hc9g - https://github.com/moment/moment/pull/6015#issuecomment-1152961973 - https://github.com/moment/moment/commit/9a3b5894f3d5d602948ac8a02e4ee528a49ca3a3 - https://nvd.nist.gov/vuln/detail/CVE-2022-31129 - https://huntr.dev/bounties/f0952b67-f2ff-44a9-a9cd-99e0a87cb633/ - https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/6QIO6YNLTK2T7SPKDS4JEL45FANLNC2Q/ - https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/ORJX2LF6KMPIHP6B2P6KZIVKMLE3LVJ5/ - https://github.com/advisories/GHSA-wc69-rhjr-hc9g
Vulnerable Software & Versions (NPM):
- cpe:2.3:a::moment:\>\=2.18.0\<2.29.4:::::::
CVE-2022-31129 (OSSINDEX) suppress
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.
CWE-400 Uncontrolled Resource Consumption ('Resource Exhaustion')
CVSSv2:
- Base Score: HIGH (7.5)
- Vector: /AV:N/AC:L/Au:/C:N/I:N/A:H
References:
- OSSINDEX - [CVE-2022-31129] CWE-400: Uncontrolled Resource Consumption ('Resource Exhaustion')
- OSSIndex - http://web.nvd.nist.gov/view/vuln/detail?vulnId=CVE-2022-31129
- OSSIndex - https://github.com/moment/moment/issues/6012
- OSSIndex - https://github.com/moment/moment/pull/6015
- OSSIndex - https://github.com/moment/moment/security/advisories/GHSA-wc69-rhjr-hc9g
Vulnerable Software & Versions (OSSINDEX):
- cpe:2.3:a::moment:2.29.3:::::::
NPM-1070447 suppress
-
-
- Impact This vulnerability impacts npm (server) users of moment.js, especially if user provided locale string, eg `fr` is directly used to switch moment locale. ### Patches This problem is patched in 2.29.2, and the patch can be applied to all affected versions (from 1.0.1 up until 2.29.1, inclusive). ### Workarounds Sanitize user-provided locale name before passing it to moment.js. ### References Are there any links users can visit to find out more? ### For more information If you have any questions or comments about this advisory: * Open an issue in [moment repo](https://github.com/moment/moment)
-
Unscored:
- Severity: high
References:
- Advisory 1070447: Path Traversal: 'dir/../../filename' in moment.locale - - https://github.com/moment/moment/security/advisories/GHSA-8hfj-j24r-96c4 - https://nvd.nist.gov/vuln/detail/CVE-2022-24785 - https://github.com/moment/moment/commit/4211bfc8f15746be4019bba557e29a7ba83d54c5 - https://www.tenable.com/security/tns-2022-09 - https://security.netapp.com/advisory/ntap-20220513-0006/ - https://github.com/advisories/GHSA-8hfj-j24r-96c4
Vulnerable Software & Versions (NPM):
- cpe:2.3:a::moment:\<2.29.2:::::::
CVE-2022-24785 (OSSINDEX) suppress
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.
CWE-22 Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal')
CVSSv2:
- Base Score: HIGH (7.5)
- Vector: /AV:N/AC:L/Au:/C:N/I:H/A:N
References:
- OSSINDEX - [CVE-2022-24785] CWE-22: Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal')
- OSSIndex - http://web.nvd.nist.gov/view/vuln/detail?vulnId=CVE-2022-24785
- OSSIndex - https://github.com/moment/moment/security/advisories/GHSA-8hfj-j24r-96c4
Vulnerable Software & Versions (OSSINDEX):
- cpe:2.3:a::moment:2.29.1:::::::