mochajs / mocha

☕️ simple, flexible, fun javascript test framework for node.js & the browser
https://mochajs.org
MIT License
22.6k stars 3.01k forks source link

High severity security alert in Lodash via yargs-unparser #3965

Closed soryy708 closed 5 years ago

soryy708 commented 5 years ago

Prerequisites

Description

Mocha depends on yargs-unparser, which depends on Lodash, which is vulnerable to prototype pollution in versions < 4.17.13. This does not show in npm audit, rather on GitHub if you publish a repository that depends on mocha (^6.1.4).

Steps to Reproduce

  1. Create a new git repository
  2. npm i mocha --save-dev
  3. Upload to GitHub
  4. Get a message saying "We found a potential security vulnerability in one of your dependencies. "

Expected behavior: No vulnerabilities in Mocha

Actual behavior:

We found a potential security vulnerability in one of your dependencies. Only the owner of this repository can see this message. 1 lodash vulnerability found in package-lock.json CVE-2019-10744 Affected versions of lodash are vulnerable to Prototype Pollution. The function defaultsDeep could be tricked into adding or modifying properties of Object.prototype using a constructor payload.

Reproduces how often: Every time

Versions

Additional Information

None

Whathecode commented 5 years ago

Confirmed. This is also reported in the yargs-unparser repo: https://github.com/yargs/yargs-unparser/issues/35

However, yargs-unparser specifies the dependency as "requires": { "lodash": "^4.17.11" }. Thus, a temporary workaround is making sure a more recent version of lodash (>=4.17.13) is installed.