Prototype Pollution in unflatten

unflatten Updated 02 Oct 2025

Summary

04/09/2020
HIGH
No i
High
Not published

GHSA-6fh5-8wq8-w3wr: Prototype Pollution in unflatten. Affects unflatten versions >= 0.0.0. 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

The package under scrutiny is unflatten, an npm package. It provides a function called unflatten that is used to convert a flattened object into a nested object. This package is vulnerable to prototype pollution, which means that the function does not properly restrict the modification of an object's prototype. This vulnerability can allow an attacker to add or modify properties on all objects, potentially leading to unauthorized access or manipulation of data.

Vulnerability Detail

The vulnerability in unflatten is due to the lack of proper validation and restriction on the modification of an object's prototype. This allows an attacker to inject or modify properties that will exist on all objects. This can lead to various security issues such as unauthorized access, data manipulation, or even remote code execution. The impact of this vulnerability depends on how the affected package is used within an application and the sensitivity of the data being manipulated.

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

As there is no fix available, a possible workaround is to implement input validation and sanitization before using the unflatten function. This can help mitigate the risk of prototype pollution by ensuring that only valid and expected data is processed. Here's an example of how input validation can be implemented in JavaScript:

function validateInput(obj) {
  if (typeof obj !== 'object' || obj === null) {
    throw new Error('Invalid input: object expected');
  }
}

// Usage
const input = { key: 'value' };

try {
  validateInput(input);
  const result = unflatten(input);
  // Continue with the processing
} catch (error) {
  console.error('Input validation failed:', error);
}

Conclusion

In conclusion, the unflatten package is vulnerable to prototype pollution, which can lead to various security issues. Currently, there is no fix available, so it is recommended to consider using an alternative package and implement input validation to mitigate the risk. For further support on vulnerability remediation, you can reach out to DevNack.com.

See every vulnerability recorded for unflatten →

Share this vulnerability

FAQ

Prototype pollution is a vulnerability that occurs when an application allows the modification of an object's prototype. This can lead to unexpected behavior and security issues, as properties added or modified on the prototype can affect all instances of that object.

An attacker can exploit prototype pollution by injecting or modifying properties on an object's prototype. This can lead to unauthorized access, data manipulation, or even remote code execution, depending on how the affected object is used within the application.

The consequences of prototype pollution can vary depending on the context of the vulnerability. It can lead to unauthorized access to sensitive data, manipulation of data integrity, or even remote code execution, which can further compromise the security of the application and its users.

Yes, all versions of unflatten are vulnerable to prototype pollution. There is currently no fix available, so it is recommended to consider using an alternative package until a fix is made available.

To stay updated on the status of this vulnerability, you can monitor the official repository or package manager for any updates or patches that may address this issue. Additionally, you can use tools like Vulert (https://vulert.com) to receive real-time alerts for open-source vulnerabilities in your software.

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