Rule Definition
The `'path'` module in the Node.js 4.x release line contains a potential regular expression denial of service (ReDoS) vector. The regular expression, `splitPathRe`, used within the `'path'` module for the various path parsing functions, including `path.dirname()`, `path.extname()` and `path.parse()`. This rule has been listed as CVE-2018-7158 in the CVE registry.
All versions of Node.js 4.x before 4.9.0 are impacted.
Remediation
Update the Node.js library
Violation Code Sample
import * as path from "path"
path.dirname(foopath);
path.extname(foopath);
path.parse(foopath);
Reference
https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2018-7158
https://nodejs.org/en/blog/vulnerability/march-2018-security-releases/
Related Technologies
Technical Criterion
CWE-676 - Use of Potentially Dangerous Function
About CAST Appmarq
CAST Appmarq is by far the biggest repository of data about real IT systems. It's built on thousands of analyzed applications, made of 35 different technologies, by over 300 business organizations across major verticals. It provides IT Leaders with factual key analytics to let them know if their applications are on track.