Prototype Pollution Vulnerability in node-yargs-parser

node-yargs-parser Updated 02 Oct 2025

Summary

16/03/2020
N/A
Yes i
Medium
5.3

CVE-2020-7608: yargs-parser could be tricked into adding or modifying properties of Object.prototype using a "proto" payload. Affects node-yargs-parser across 2 version ranges.

< 18.1.1-1 < eab6c039888bd5d51f33dda7a98808564acfa938

Fixed in 18.1.1-1. How to fix ↓

Free scan

Check if this vulnerability affects your application

Upload a manifest or SBOM and we'll show whether you're affected, plus every other risky package in the same scan.

Check my app free

No signup required · Results in about 60 seconds

Upload your dependency manifest or SBOM

Drag & drop your file here or

Java Javascript PHP Python Go Rust Ruby Dart C/C++ Elixir CycloneDX SPDX

Upload a supported dependency manifest or SBOM. No installation or source-code access required.

See supported files and SBOM formats
SBOM sbom.json · bom.json · bom.xml · *.spdx.json · *.cdx.json · *.cdx.xml
Java pom.xml · gradle.lockfile · buildscript-gradle.lockfile
Javascript package-lock.json · yarn.lock · pnpm-lock.yaml
PHP composer.lock
Python poetry.lock · requirements.txt · Pipfile.lock
Go go.mod
Rust Cargo.lock
Ruby Gemfile.lock
Dart pubspec.lock
C/C++ conan.lock
Elixir mix.lock
Enter your work email to receive your report link.

Verify your email to view the full report and start 30 days of continuous monitoring. No credit card required.

Sponsored Lume, the Habilume companion Habilume Habit tracker with a companion that grows with you Complete habits, earn Lume Points, and watch your Lume grow as you stay consistent. App Store Google Play

Background

node-yargs-parser is a popular JavaScript library used for parsing command-line arguments in Node.js applications. It provides a simple way to handle user inputs and options, making it easier for developers to create command-line interfaces. However, this package has been found to be vulnerable to a prototype pollution issue, which can lead to unintended modifications of the Object.prototype, potentially affecting the behavior of the application and leading to security risks.

Vulnerability Detail

The vulnerability, identified as CVE-2020-7608, allows an attacker to manipulate the properties of Object.prototype using a specially crafted payload that includes a 'proto' key. This can lead to various security issues, such as denial of service or unauthorized access to sensitive data. The vulnerability originates from improper handling of user input in the yargs-parser library, which fails to adequately sanitize and validate the input before processing it.

How To Fix

Minimum fixed version

18.1.1-1

This is the first release that contains the fix.

sudo apt-get install --only-upgrade node-yargs-parser

Tip — Not sure which version your app runs? Vulert can match this fix to it. Scan free →

Workaround

If immediate upgrading is not possible, consider implementing input validation to sanitize user inputs before passing them to the yargs-parser. This can help mitigate the risk of prototype pollution. For example, you can check for the presence of 'proto' in the input and reject it:

const yargs = require('yargs-parser');

function safeParse(args) {
  if ('__proto__' in args) {
    throw new Error('Invalid input detected');
  }
  return yargs(args);
}

Conclusion

The CVE-2020-7608 vulnerability in node-yargs-parser poses a significant risk due to its potential for prototype pollution. It is crucial for developers using this library to upgrade to the latest version to mitigate the risk. Additionally, implementing input validation can serve as a temporary workaround until the upgrade is completed.

See every vulnerability recorded for node-yargs-parser →

Share this vulnerability

FAQ

Prototype pollution is a security vulnerability that allows an attacker to modify the prototype of built-in objects in JavaScript, potentially leading to unexpected behavior in applications.

You can use Vulert to monitor and alert for open-source vulnerabilities in your software. Simply upload your package-lock.json file to the Vulert playground at Vulert Scanner to check for vulnerabilities.

Exploiting this vulnerability can lead to various issues, including denial of service, data leakage, and unauthorized access to application functionalities.

Yes, upgrading to version 18.1.1-1 or later will resolve the vulnerability and ensure that your application is secure.

The CVSS score for CVE-2020-7608 is 5.3, indicating a moderate level of severity.

Related vulnerabilities

Recent vulnerabilities recorded for node-yargs-parser.

Sponsored Lume, the Habilume companion Habilume Habit tracker with a companion that grows with you Complete habits, earn Lume Points, and watch your Lume grow as you stay consistent. App Store Google Play

How To Fix

Minimum fixed version

18.1.1-1

This is the first release that contains the fix.

sudo apt-get install --only-upgrade node-yargs-parser

Tip — Not sure which version your app runs? Vulert can match this fix to it. Scan free →

Subscribe to Vulert on Telegram
Daily digest of new CVEs, critical and high severity, affected packages and fixes — plus a weekly roundup.
Join the channel →
Help improve this record
Report an issue or send feedback