GitHub Advisoryadvisory · npm

GHSA-rf6f-7fwh-wjgh Prototype Pollution via parse() in NodeJS flatted

HIGH Published 2026-03-19 Modified 2026-10-05 Official page ↗
Aliases
CVE-2026-33228
Ecosystem
npm
Packages
flatted
Severity
High
CVSS vector
CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N/E:P
Weaknesses
CWE-1321, CWE-915
Reviewed
2026-03-19

Affected packages

• npm flatted: < 3.4.2 → fixed in 3.4.2

Description

--- Summary The parse() function in flatted can use attacker-controlled string values from the parsed JSON as direct array index keys, without validating that they are numeric. Since the internal input buffer is a JavaScript Array, accessing it with the key "\_\_proto\_\_" returns Array.prototype via the inherited getter. This object is then treated as a legitimate parsed value and assigned as a property of the output object, effectively leaking a live reference to Array.prototype to the consumer. Any code that subsequently writes to that property will pollute the global prototype. --- Root Cause File: esm/index.js:29 (identical in cjs/index.js) ``` const resolver = (input, lazy, parsed, $) => output => { for (let ke = keys(output), {length} = ke, y = 0; y = 0 && idx < input.length) ? input[idx] : undefined;

Related

Alias · CVE (1)

Weakness · CWE (2)

  • CWE-1321 Improperly Controlled Modification of Object Prototype Attributes weakness
  • CWE-915 Improperly Controlled Modification of Dynamically-Determined Object Attributes weakness

References