Skip to main content

flat-to-nested CVE-2026-55091

| EUVDEUVD-2026-77691 HIGH
Improperly Controlled Modification of Dynamically-Determined Object Attributes (CWE-915)
2026-06-19 https://github.com/joaonuno/flat-to-nested-js GHSA-hp36-v28f-w3r4
7.5
CVSS 3.1 · Vendor: https://github.com/joaonuno/flat-to-nested-js
View

Attack ChainAIDerived

Hypothetical attack flow derived from CVE metadata – not a confirmed exploit chain

  1. Access
    Identify endpoint feeding convert()
  2. Delivery
    Submit record with parent='__proto__'
  3. Exploit
    Trigger temp['__proto__'] prototype lookup
  4. Execution
    initPush writes to Object.prototype
  5. Persist
    Subsequent code reads polluted property
  6. Impact
    Logic bypass or downstream RCE gadget

Vulnerability Assessment

Weakness
CWE
OWASP Top 10:2025
A08:2025 - Software or Data Integrity Failures
ASVS 5.0
V4 - API and Web Service Object attribute protection
Exploitation Conditions

The consuming application must call FlatToNested.prototype.convert() on records whose parent or id field is attacker-influenced (typical for the library's documented purpose - building trees from user, REST, or database input). Affected versions are <= 1.1.1 of npm flat-to-nested running on Node.js. No authentication, no user interaction, and no non-default configuration of the library are required; the malicious value '__proto__' is ordinary input data. The practical limit on severity is downstream: the pollution only escalates beyond logic corruption when the same process later reads the polluted property through a sink (template engine option, auth flag, command argument), so impact depends on the host application's code paths rather than on flat-to-nested itself.

Impact

The CVSS 3.1 vector AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:H/A:N (7.5 High) reflects integrity-only impact reachable over the network without authentication or interaction, which matches the library's use as a data-shaping utility in web back-ends. There is no EPSS, KEV, or SSVC data provided, and no evidence of active exploitation; the practical risk is heavily dependent on whether downstream code uses polluted prototype properties as gadgets (template engines, option-merging, auth checks) - without such a gadget, impact is limited to logic corruption. Note the input lists CWE-915 while the advisory body calls out CWE-1321; both are in the prototype-pollution family but defenders tracking by CWE-1321 should be aware of the discrepancy. Overall this is a credible supply-chain integrity issue that should be patched promptly, but not an emergency in the absence of a known downstream RCE gadget in the specific consumer.

Exploit ScenarioDerived

A Node.js service exposes an endpoint that ingests JSON records (for example, a hierarchical category import or org-chart upload) and passes them to flat-to-nested's convert() to build a tree. An attacker submits a record like {id: 1, parent: '__proto__', isAdmin: true}; after the call, every newly created plain object in the process inherits an attacker-controlled property, which a downstream check such as if (user.isAdmin) or a templating engine's option merge can then honor - escalating from data corruption to authorization bypass or RCE depending on the gadget. A working proof-of-concept is published in the GHSA advisory itself.

This Week Schedule remediation this week. Why: HIGH severity (CVSS 7.0-8.9).
Patch available 0.4% exploitation probability (EPSS)

Get an e-mail when this CVE is exploited, patched or re-scored. Free account.

Alert me

AnalysisAIv1 – Jun 19, 2026

Prototype pollution in the npm package flat-to-nested (versions <= 1.1.1) lets attackers who control input records pollute Object.prototype by supplying a record with parent set to the string '__proto__'. The convert() function uses plain objects as lookup tables and writes attacker-controlled data through the prototype chain via initPush(), affecting any application that feeds untrusted flat records (REST input, DB rows, user-supplied data) into the library. No CISA KEV listing and no public exploit identified at time of analysis beyond the proof-of-concept embedded in the GitHub Security Advisory.

RemediationAI

Vendor-released patch: upgrade flat-to-nested to 1.1.2 or later, which replaces the plain-object lookup tables with Object.create(null) so that '__proto__', 'constructor', and 'prototype' become harmless own keys rather than prototype-chain references (commit 680a5ebe1194edda16fa93baaa56ff14fe0e3d7f, advisory GHSA-hp36-v28f-w3r4). If upgrading is not immediately possible, pre-sanitize input records before calling convert() by rejecting or stripping any record whose id or parent equals '__proto__', 'constructor', or 'prototype' - note this is a strict allowlist on key strings and will reject any legitimate record that happens to use those exact identifiers. As an additional defense, run the consumer process under Node's --frozen-intrinsics flag or call Object.freeze(Object.prototype) at startup; this blocks the write but will break any library that legitimately augments Object.prototype, so test thoroughly before enabling in production.

Affected VersionsENISA

flat-to-nested-js < 1.1.2

Affected Packages

npm flat-to-nested fix: 1.1.2
euvd flat_to_nested_js fix: 1.1.2

Source: OSV (Open Source Vulnerabilities)

Affects your stack

Affects 2 packages in npm, euvd

Checking this CVE against your own stacks and servers is part of the Basic plan and up.

Technical ContextAI · show details

flat-to-nested is a small JavaScript utility (pkg:npm/flat-to-nested) that converts flat parent/child records into a nested tree. In index.js, convert() initializes temp = {} and pendingChildOf = {} as plain objects that inherit from Object.prototype, then uses each record's id and parent fields directly as dynamic object keys without any allowlist or denylist. When parent === '__proto__', temp['__proto__'] resolves to Object.prototype and initPush() writes children data onto the global prototype. The root cause class is CWE-1321 / CWE-915 (improperly controlled modification of object prototype attributes), a well-known JavaScript sink-pattern where unsanitized strings used as keys cross the boundary between own properties and inherited prototype properties.

Know when the next one hits your stack

  • Watch products and get an email when something new is published
  • Check this CVE against your own stack and servers
  • Exploit and PoC references, threat intelligence from 22 sources

No credit card · 7-day full trial

Severity by source

Vendor (https://github.com/joaonuno/flat-to-nested-js) PRIMARY 7.5 HIGH
AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:H/A:N
vuln.today AI 8.2 HIGH

Library is typically reached via network-fed records with no auth or interaction; integrity is high (arbitrary prototype writes), with low availability impact from likely logic crashes and no direct confidentiality loss.

3.1 AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:H/A:L
4.0 AV:N/AC:L/AT:N/PR:N/UI:N/VC:N/VI:H/VA:L/SC:N/SI:N/SA:N

Primary rating from Vendor (https://github.com/joaonuno/flat-to-nested-js).

CVSS VectorVendor: https://github.com/joaonuno/flat-to-nested-js

Attack Vector
Network
Attack Complexity
Low
Privileges Required
None
User Interaction
None
Scope
Unchanged
Confidentiality
None
Integrity
High
Availability
None

DescriptionCVE.org

Summary

convert() builds the nested tree by using each flat record's id and parent field values directly as object keys, with no guard against __proto__ / constructor / prototype. A record whose parent is the string "__proto__" makes temp[parent] resolve to Object.prototype, and the following initPush(...) writes attacker-controlled data onto the global prototype. Any application that passes attacker-influenced records to convert() is affected, and the base prototype methods stay intact so the pollution is stealthy.

Details

In index.js, convert() (FlatToNested.prototype.convert):

  • temp = {} (line 45) and pendingChildOf = {} (line 46) are plain objects, so they inherit from Object.prototype.
  • For each record, parent = flatEl[this.config.parent] (line 51) is taken verbatim from input.
  • Line 57: if (temp[parent] ! undefined) - when parent = "__proto__", temp["__proto__"] resolves via the prototype chain to Object.prototype, which is !== undefined, so the

branch is taken.

  • Line 59: initPush(this.config.children, temp[parent], flatEl) → effectively initPush("children", Object.prototype, flatEl).
  • initPush (lines 4-9): Object.prototype["children"] = [] then Object.prototype["children"].push(flatEl) - attacker-controlled data is written onto the global Object.prototype.

There is no sanitization of id / parent anywhere; they flow straight into temp[id], temp[parent], and pendingChildOf[parent] as dynamic keys.

PoC

js
  const FlatToNested = require('flat-to-nested');

  new FlatToNested().convert([
    { id: 1, parent: '__proto__', polluted: 'PWNED' }
  ]);

  console.log(({}).children); // => [ { id: 1, polluted: 'PWNED' } ]
  A freshly-created, unrelated object {} now carries an attacker-controlled children property. ({}).toString === Object.prototype.toString remains true, so existing methods are untouched (stealthy). If the consumer configures a custom children key, that arbitrary prototype property is polluted instead.

Impact

Prototype pollution (CWE-1321). Any service that builds a tree from attacker-influenced flat records (the package's core purpose - e.g. records derived from a DB/REST/user input) can have Object.prototype polluted. Consequences range from application-logic corruption and denial of service to serving as a gadget toward privilege escalation or RCE depending on downstream sinks. No special privileges or user interaction required; the malicious value is ordinary input data.

Suggested fix

Use prototype-less lookup tables so inherited keys like __proto__ cannot be reached: var temp = Object.create(null); var pendingChildOf = Object.create(null); (Optionally also reject id/parent values equal to __proto__, constructor, or prototype.) Verified: with Object.create(null) for both temp and pendingChildOf, the PoC no longer pollutes Object.prototype and normal nesting output is unchanged. A patch with a regression test is ready.

Executive ViewAI

Why It Matters

The flat-to-nested npm package versions 1.1.1 and earlier contain a prototype pollution vulnerability that allows attackers processing untrusted data to inject malicious objects into applications' core data structures. Any organization using this library to process REST API input, database records, or user-supplied data faces immediate risk of data corruption and potential cascading security failures. Patch availability makes remediation straightforward, but affected systems must be identified and updated urgently.

Business Impact: High
Compensating Controls

Apply vendor patch.

Threat Intelligence Overview

EPSS Score
0.4%
Top 71% exploitable
Threat Intel
1
1 source
Social Media
1
Sightings
Data Quality
5 sources
Confidence: Medium

How this decision was reached

The engine reads each signal below and applies a fixed list of rules from top to bottom. The first rule that matches sets the recommended action – like a statement, every line is shown.

SignalValue
Severity HIGH
CISA KEV No
Public POC No
EPSS 0.4%
Patch available Yes
Active threat No
Deciding rule
HIGH severity (CVSS 7.0-8.9)
What every action level means
Emergency Immediate action required. Criteria: CRITICAL + in CISA KEV (actively exploited) without patch, OR CRITICAL + EPSS > 30% without patch, OR CRITICAL + active threat signals without patch.
Act Now Prioritize within 24-48h. Criteria: in KEV with patch available, OR CRITICAL + public POC, OR HIGH + EPSS > 10%, OR CRITICAL + active threat, OR any CRITICAL severity.
This Week Schedule remediation this week. Criteria: HIGH severity (CVSS 7.0-8.9). Patch within normal change window.
This Month Plan within 30 days. Criteria: MEDIUM severity (CVSS 4.0-6.9), lower exploitation probability. Include in regular patch cycle.
Monitor Track and reassess. Criteria: LOW severity (CVSS 0.1-3.9), minimal exploitation risk. No immediate action needed.

SSVC AssessmentENISA

SSVC Decision· derived
Scheduled
Exploitation· derived
None
System Exposure· derived
Open
Automatable· derived
Yes
Human Impact
High

Priority Score

38
Low Medium High Critical
KEV: 0
EPSS: 0
CVSS: +38
PoC: 0
Weaponized: 0
Threat intel: 0
Gov advisory: 0

Attack Technique

Privilege escalation occurs when an attacker leverages flaws in access control mechanisms to gain permissions beyond what they were originally granted.

Denial of Service attacks render applications or systems unavailable by overwhelming resources or triggering failure conditions.

This site uses cookies essential for authentication and security. No tracking or analytics cookies are used. Privacy Policy