Prototype Pollution in flat-wrap

flat-wrap Updated 02 Oct 2025

Summary

04/09/2020
HIGH
No i
High
Not published

GHSA-g7h8-p22m-2rvx: Prototype Pollution in flat-wrap. Affects flat-wrap 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 Penetration testing for web, API and mobile Manual testing by engineers who build software, not an auditor's checklist. Trusted by teams at Swift and Google Talk to Devnack

Background

The flat-wrap package is an npm package that provides a function called unflatten. This function is used to convert a flattened object back into its original nested structure. It is commonly used in JavaScript applications to manipulate and transform data. However, all versions of flat-wrap are vulnerable to prototype pollution.

Vulnerability Detail

Prototype pollution is a vulnerability that occurs when an attacker can modify the prototype of an object. In the case of flat-wrap, the unflatten function does not restrict the modification of an object's prototype. This allows an attacker to add or modify properties that will exist on all objects. This can lead to various security issues, such as remote code execution, information disclosure, or denial of service attacks.

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 your own version of the unflatten function with proper prototype checks and restrictions. Here is an example of a modified unflatten function that includes prototype protection:

function unflatten(obj) {
  if (typeof obj !== 'object' || obj === null) {
    return obj;
  }

  const result = {};

  for (const key in obj) {
    if (Object.prototype.hasOwnProperty.call(obj, key)) {
      const keys = key.split('.');
      let currentObj = result;

      for (let i = 0; i < keys.length - 1; i++) {
        const currentKey = keys[i];

        if (!currentObj[currentKey] || typeof currentObj[currentKey] !== 'object') {
          currentObj[currentKey] = {};
        }

        currentObj = currentObj[currentKey];
      }

      const lastKey = keys[keys.length - 1];
      currentObj[lastKey] = obj[key];
    }
  }

  return result;
}

Conclusion

The flat-wrap package is vulnerable to prototype pollution, which can have serious security implications. It is recommended to use an alternative package or implement a modified version of the unflatten function with prototype protection. For further support on vulnerability remediation, please contact DevNack.com.

See every vulnerability recorded for flat-wrap →

Share this vulnerability

FAQ

Prototype pollution is a vulnerability that allows an attacker to modify the prototype of an object, leading to various security issues.

The unflatten function in flat-wrap does not restrict the modification of an object's prototype, making it vulnerable to prototype pollution.

The prototype pollution vulnerability in flat-wrap can potentially result in remote code execution, information disclosure, or denial of service attacks.

Currently, there is no fix available for this vulnerability in the flat-wrap package. It is recommended to use an alternative package.

A possible workaround is to implement a modified version of the unflatten function with proper prototype checks and restrictions.

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