CVE-2019-10795: Prototype Pollution in undefsafe

undefsafe Updated 02 Oct 2025

Summary

09/02/2022
Yes i
Moderate
6.3

CVE-2019-10795: Prototype Pollution in undefsafe. Affects undefsafe versions < 2.0.3. Fixed in 2.0.3. 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 MarkAI Find prospects already talking about the problem you solve AI watches the communities your customers use to find qualified prospects, then alerts you when a conversation is worth joining. See MarkAI

Background

The package under scrutiny is undefsafe, an npm package. It is designed to safely access deeply nested properties of an object without throwing any errors. It is commonly used in JavaScript applications to prevent crashes caused by accessing undefined properties. However, versions prior to 2.0.3 are vulnerable to Prototype Pollution. This vulnerability allows an attacker to manipulate or add properties to the Object.prototype using a __proto__ payload.

Vulnerability Detail

The Prototype Pollution vulnerability in undefsafe arises from the 'a' function's susceptibility to a __proto__ payload. By exploiting this vulnerability, an attacker can modify or add properties to the Object.prototype, potentially leading to unexpected behavior or security issues in the application. The impact of this vulnerability can range from data integrity issues to remote code execution.

How To Fix

Minimum fixed version

2.0.3

This is the first release that contains the fix.

npm install undefsafe@2.0.3

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

Workaround

If upgrading to the fixed version is not immediately feasible, a temporary workaround is to avoid using the vulnerable 'a' function or to implement input validation and sanitization to prevent malicious payloads from reaching the vulnerable function. Here is an example of input validation for the 'a' function:

function safeAccess(obj, path) {
  if (typeof obj !== 'object' || obj === null) {
    return undefined;
  }

  const keys = path.split('.');
  let result = obj;

  for (const key of keys) {
    if (!Object.prototype.hasOwnProperty.call(result, key)) {
      return undefined;
    }

    result = result[key];
  }

  return result;
}

Conclusion

In conclusion, the undefsafe package prior to version 2.0.3 is vulnerable to Prototype Pollution. This vulnerability allows an attacker to manipulate or add properties to the Object.prototype, potentially leading to unexpected behavior or security issues. It is crucial to upgrade to the fixed version or implement the recommended workarounds to mitigate the risk. For further support on vulnerability remediation, please contact DevNack.com.

See every vulnerability recorded for undefsafe →

Share this vulnerability

FAQ

undefsafe is an npm package used to safely access deeply nested properties of an object without throwing errors. It helps prevent crashes caused by accessing undefined properties.

Prototype Pollution is a vulnerability that allows an attacker to modify or add properties to the Object.prototype. This can lead to unexpected behavior or security issues in the application.

The vulnerability in undefsafe allows an attacker to manipulate or add properties to the Object.prototype using a __proto__ payload. This can result in data integrity issues or even remote code execution.

To fix the vulnerability, it is recommended to upgrade to version 2.0.3 or later of the undefsafe package. This version includes a fix for the Prototype Pollution issue.

If upgrading to the fixed version is not immediately feasible, a temporary workaround is to avoid using the vulnerable 'a' function or to implement input validation and sanitization to prevent malicious payloads from reaching the vulnerable function.

How To Fix

Minimum fixed version

2.0.3

This is the first release that contains the fix.

npm install undefsafe@2.0.3

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