CVE-2021-25928: Prototype Pollution in safe-obj

safe-obj Updated 02 Oct 2025

Summary

21/06/2021
No i
Critical
9.8

CVE-2021-25928: Prototype pollution in safe-obj. Affects safe-obj versions >= 1.0.0, <= 1.0.2. No fix is published. 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 Devnack Your last release was probably never penetration tested Manual testing by engineers who build software, not an auditor's checklist. Trusted by teams at Swift and Google Talk to Devnack

Background

safe-obj is an npm package that provides a safe way to access and manipulate JavaScript objects. It is commonly used in web applications to prevent prototype pollution attacks. Prototype pollution is a vulnerability that occurs when an attacker can modify the prototype of an object, leading to unexpected behavior and potential security issues. In versions 1.0.0 through 1.0.2 of safe-obj, a prototype pollution vulnerability has been identified.

Vulnerability Detail

The prototype pollution vulnerability in safe-obj versions 1.0.0 through 1.0.2 allows an attacker to cause a denial of service and may lead to remote code execution. By manipulating the prototype of an object, an attacker can modify its behavior and potentially execute arbitrary code. This can result in unauthorized access, data leakage, or complete system compromise. The severity of this vulnerability is rated as CRITICAL with a CVSS score of 9.8.

How To Fix

No fixed version is published for this vulnerability.

Tip — Not sure whether your app is affected? Vulert can check the versions your app actually runs. Scan free →

Workaround

If updating the safe-obj package is not immediately feasible, a temporary workaround can be implemented. One possible workaround is to validate and sanitize user input before using it with safe-obj. By ensuring that only trusted and properly validated data is passed to safe-obj, the risk of exploitation can be reduced. Here is an example of input validation and sanitization in JavaScript:

function sanitizeInput(input) {
  // Perform input validation and sanitization
  // ... 
  return sanitizedInput;
}

const safeObj = require('safe-obj');

const userInput = req.body.userInput;
const sanitizedInput = sanitizeInput(userInput);

const result = safeObj.get(sanitizedInput, 'some.property');

Conclusion

The prototype pollution vulnerability in safe-obj versions 1.0.0 through 1.0.2 poses a significant risk to applications using this package. It is crucial to update to safe-obj version 1.0.3 or higher to mitigate the vulnerability. If immediate updating is not possible, implementing input validation and sanitization can provide a temporary workaround. For further support on vulnerability remediation, you can contact DevNack.com.

See every vulnerability recorded for safe-obj →

Share this vulnerability

FAQ

Prototype pollution is a vulnerability that occurs when an attacker can modify the prototype of an object, leading to unexpected behavior and potential security issues. By manipulating the prototype, an attacker can modify the behavior of an object and potentially execute arbitrary code.

The safe-obj package provides a safe way to access and manipulate JavaScript objects by implementing strict checks and preventing prototype pollution attacks. However, versions 1.0.0 through 1.0.2 of safe-obj have a vulnerability that allows for prototype pollution.

The prototype pollution vulnerability in safe-obj can lead to a denial of service and remote code execution. An attacker could exploit this vulnerability to gain unauthorized access, leak sensitive data, or compromise the entire system.

Yes, the maintainers of safe-obj have released a patch in version 1.0.3 that addresses the prototype pollution vulnerability. It is recommended to update to safe-obj version 1.0.3 or higher to mitigate the risk.

You can use Vulert's playground at Vulert Scanner to check if your application is affected by this vulnerability. Vulert monitors and alerts in real-time for open-source vulnerabilities, using just the package-lock.json file without requiring access to the code or installation.

How To Fix

No fixed version is published for this vulnerability.

Tip — Not sure whether your app is affected? Vulert can check the versions your app actually runs. 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