NodeJS/moment/2.22.0
Parse, validate, manipulate, and display dates
https://www.npmjs.com/package/moment
MIT
2 Security Vulnerabilities
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://github.com/advisories/GHSA-8hfj-j24r-96c4
- https://www.tenable.com/security/tns-2022-09
- https://security.netapp.com/advisory/ntap-20220513-0006/
- 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://lists.debian.org/debian-lts-announce/2023/01/msg00035.html
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
Moment.js vulnerable to Inefficient Regular Expression Complexity
- 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://github.com/advisories/GHSA-wc69-rhjr-hc9g
- 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://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/IWY24RJA3SBJGA5N4CU4VBPHJPPPJL5O/
- https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/ZMX5YHELQVCGKKQVFXIYOTBMN23YYSRO/
- https://security.netapp.com/advisory/ntap-20221014-0003/
- https://lists.debian.org/debian-lts-announce/2023/01/msg00035.html
- https://github.com/moment/moment/pull/6015/commits/4bbb9f3ccbe231de40207503f344fe5ce97584f4
- https://github.com/moment/moment/pull/6015/commits/bfd4f2375d5c1a2106246721d693a9611dddfbfe
- https://github.com/moment/moment/pull/6015/commits/dc0d180e90d8a84f7ff13572363330a22b3ea504
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.
76 Other Versions
Version | License | Security | Released | |
---|---|---|---|---|
2.30.1 | MIT | 2023-12-27 - 10:38 | 11 months | |
2.30.0 | MIT | 2023-12-26 - 19:36 | 11 months | |
2.29.4 | MIT | 2022-07-06 - 16:01 | over 2 years | |
2.29.3 | MIT | 1 | 2022-04-17 - 18:27 | over 2 years |
2.29.2 | MIT | 1 | 2022-04-03 - 13:18 | over 2 years |
2.29.1 | MIT | 2 | 2020-10-06 - 11:21 | about 4 years |
2.29.0 | MIT | 2 | 2020-09-22 - 08:31 | about 4 years |
2.28.0 | MIT | 2 | 2020-09-13 - 11:27 | about 4 years |
2.27.0 | MIT | 2 | 2020-06-18 - 22:00 | over 4 years |
2.26.0 | MIT | 2 | 2020-05-20 - 06:46 | over 4 years |
2.25.3 | MIT | 2 | 2020-05-04 - 15:13 | over 4 years |
2.25.2 | MIT | 2 | 2020-05-04 - 12:29 | over 4 years |
2.25.1 | MIT | 2 | 2020-05-01 - 18:51 | over 4 years |
2.25.0 | MIT | 2 | 2020-05-01 - 01:27 | over 4 years |
2.24.0 | MIT | 2 | 2019-01-21 - 21:10 | almost 6 years |
2.23.0 | MIT | 2 | 2018-12-13 - 06:49 | almost 6 years |
2.22.2 | MIT | 2 | 2018-06-01 - 06:58 | over 6 years |
2.22.1 | MIT | 2 | 2018-04-15 - 06:06 | over 6 years |
2.22.0 | MIT | 2 | 2018-03-30 - 22:06 | over 6 years |
2.21.0 | MIT | 2 | 2018-03-02 - 20:41 | over 6 years |
2.20.1 | MIT | 2 | 2017-12-19 - 04:44 | almost 7 years |
2.20.0 | MIT | 2 | 2017-12-17 - 01:15 | almost 7 years |
2.19.4 | MIT | 2 | 2017-12-11 - 01:11 | almost 7 years |
2.19.3 | MIT | 2 | 2017-11-29 - 16:28 | almost 7 years |
2.19.2 | MIT | 3 | 2017-11-11 - 20:34 | about 7 years |
2.19.1 | MIT | 3 | 2017-10-11 - 21:02 | about 7 years |
2.19.0 | MIT | 3 | 2017-10-10 - 09:40 | about 7 years |
2.18.1 | MIT | 3 | 2017-03-21 - 22:58 | over 7 years |
2.18.0 | MIT | 3 | 2017-03-18 - 21:14 | over 7 years |
2.17.1 | MIT | 2 | 2016-12-04 - 05:48 | almost 8 years |
2.17.0 | MIT | 2 | 2016-11-22 - 13:48 | almost 8 years |
2.16.0 | MIT | 2 | 2016-11-10 - 06:54 | about 8 years |
2.15.2 | MIT | 2 | 2016-10-24 - 06:49 | about 8 years |
2.15.1 | MIT | 2 | 2016-09-21 - 03:39 | about 8 years |
2.15.0 | MIT | 2 | 2016-09-12 - 09:27 | about 8 years |
2.14.1 | MIT | 2 | 2016-07-04 - 06:44 | over 8 years |
2.14.0 | MIT | 2 | 2016-07-04 - 05:11 | over 8 years |
2.13.0 | MIT | 2 | 2016-04-18 - 07:41 | over 8 years |
2.12.0 | MIT | 2 | 2016-03-07 - 09:23 | over 8 years |
2.11.2 | MIT | 2 | 2016-02-03 - 22:47 | almost 9 years |
2.11.1 | MIT | 5 | 2016-01-09 - 13:17 | almost 9 years |
2.11.0 | MIT | 5 | 2016-01-02 - 23:38 | almost 9 years |
2.10.6 | MIT | 5 | 2015-07-28 - 04:45 | over 9 years |
2.10.5 | MIT | 5 | 2015-07-26 - 09:33 | over 9 years |
2.10.3 | MIT | 5 | 2015-05-13 - 07:54 | over 9 years |
2.10.2 | MIT | 5 | 2015-04-09 - 06:39 | over 9 years |
2.9.0 | MIT | 5 | 2015-01-08 - 15:01 | almost 10 years |
2.8.4 | MIT | 5 | 2014-11-19 - 04:47 | almost 10 years |
2.8.3 | MIT | 5 | 2014-09-05 - 08:06 | about 10 years |
2.8.2 | MIT | 5 | 2014-08-22 - 13:55 | about 10 years |
2.8.1 | MIT | 5 | 2014-08-01 - 17:21 | over 10 years |
2.7.0 | MIT | 5 | 2014-06-12 - 07:05 | over 10 years |
2.6.0 | MIT | 5 | 2014-04-12 - 16:39 | over 10 years |
2.5.1 | MIT | 5 | 2014-01-22 - 09:28 | almost 11 years |
2.5.0 | MIT | 5 | 2013-12-23 - 21:09 | almost 11 years |
2.4.0 | MIT | 5 | 2013-10-27 - 02:26 | about 11 years |
2.3.1 | MIT | 5 | 2013-10-09 - 02:38 | about 11 years |
2.3.0 | MIT | 5 | 2013-10-07 - 08:30 | about 11 years |
2.2.1 | MIT | 5 | 2013-09-12 - 08:39 | about 11 years |
2.1.0 | MIT | 5 | 2013-07-07 - 20:33 | over 11 years |
2.0.0 | MIT | 5 | 2013-02-08 - 19:13 | almost 12 years |
1.7.2 | MIT | 5 | 2012-10-02 - 17:17 | about 12 years |
1.7.1 | MIT | 5 | 2012-10-01 - 17:33 | about 12 years |
1.7.0 | MIT | 5 | 2012-07-25 - 19:10 | over 12 years |
1.6.2 | MIT | 5 | 2012-05-04 - 17:20 | over 12 years |
1.6.1 | MIT | 5 | 2012-04-26 - 22:30 | over 12 years |
1.6.0 | MIT | 5 | 2012-04-26 - 16:50 | over 12 years |
1.5.1 | MIT | 5 | 2012-04-06 - 02:08 | over 12 years |
1.5.0 | MIT | 5 | 2012-03-19 - 19:44 | over 12 years |
1.4.0 | MIT | 5 | 2012-02-03 - 19:16 | almost 13 years |
1.3.0 | MIT | 5 | 2012-01-05 - 17:51 | almost 13 years |
1.2.0 | MIT | 5 | 2011-12-06 - 18:33 | almost 13 years |
1.1.1 | MIT | 5 | 2011-11-11 - 19:16 | about 13 years |
1.1.0 | MIT | 5 | 2011-10-27 - 23:21 | about 13 years |
1.0.1 | MIT | 5 | 2011-12-06 - 18:33 | almost 13 years |
1.0.0 | MIT | 5 | 2011-12-06 - 18:33 | almost 13 years |