Advisory

GHSA-753c-phhg-cj29

Also known as: CVE-2021-23352, SNYK-JS-MADGE-1082875

Summary

Madge vulnerable to command injection

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

const madge = require('madge'); 
madge('..', {graphVizPath: "touch HELLO;"}) .then((res) => res.svg()) .then((writtenImagePath) => { console.log('Image written to ' + writtenImagePath); });

Severity

High Basis: The source's own band: HIGH

Dates

Published
2021-03-12 23:01 UTC
Modified
2026-07-08 06:50 UTC

Affected packages and fixes

madge

npm · All systems

Affected

  • introduced 0, fixed 4.0.1 (semver)

Fixed versions

4.0.1

Fix

Fix commands are the export's own generic commands. Ojuju never runs them. Check them against your setup first.

Check your own computer: guard packages check

View this record on OSV.dev

Source

Source: GitHub Advisory Database (reviewed advisories) · CC BY 4.0

Sources & licences