VDB
Sign up
HIGH

GHSA-753c-phhg-cj29

Madge vulnerable to command injection

Quick fix

GHSA-753c-phhg-cj29 — madge: upgrade to the fixed version with the command below.

npm install madge@4.0.1

Details

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); }); ```

Are you affected?

Enter the version of the package you're using.

Affected packages

npm/madge
Introduced in: 0Fixed in: 4.0.1
Fixnpm install madge@4.0.1

References