CVE-2026-33228: flatted: Prototype Pollution via parse()

Published Mar 19, 2026
·
Updated

--- 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 < length; y++) { const k = ke[y]; const value = output[k]; if (value instanceof Primitive) { const tmp = input[value]; // Bug is here

No validation that value is a safe numeric index input is built as a plain Array. JavaScript's property lookup on arrays traverses the prototype chain for non-numeric keys. The key "\\proto\\" resolves to Array.prototype, which:

- has type "object" → passes the typeof tmp === object guard at line 30 - is not in the parsed Set yet → passes the !parsed.has(tmp) guard. - The reference to Array.prototype is then enqueued in lazy and later unconditionally assigned to the output object. --- Replication Steps const Flatted = require('flatted'); const parsed = Flatted.parse('[{"x":"proto"}]'); parsed.x.polluted = 'pwned'; console.log([].polluted); // Returns true --- Impact An attacker can supply a crafted flatted string to parse() that causes the returned object to hold a live reference to Array.prototype, enabling any downstream code that writes to that property to pollute the global prototype chain, potentially causing denial of service or code execution.

Recommended solution Validate that the index string represents an integer within the bounds of input before accessing it:

// Before (vulnerable) const tmp = input[value];

// After (safe) const idx = +value; // coerce boxed String → number const tmp = (Number.isInteger(idx) && idx >= 0 && idx < input.length) ? input[idx] : undefined;

Other sources

flatted is a circular JSON parser. Prior to version 3.4.2, 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. This issue has been patched in version 3.4.2.

MITRE

Affected Software

3 affected componentsFixes available
npm/flatted<=3.4.1
3.4.2
Webreflection Flatted Node.js<3.4.2
IBM watsonx.data intelligence<=5.2.0, 5.2.1, 5.3.0, 5.3.1

Remediation

Recommended actions to resolve this vulnerability, in priority order.

  1. Upgrade

    Upgrade npm/flatted to a version that resolves this vulnerability.

    Fixed in 3.4.2
  2. Upgrade

    Upgrade flatted to a version that resolves this vulnerability.

    Fixed in 3.4.2
  3. Configuration

    In flatted's resolver used by parse() (esm/index.js:29 and cjs/index.js), change the logic that currently does `tmp = input[value]` (where `value` comes from parsed JSON) to first validate `value` as an integer index within bounds of the input array, and only then access the array (e.g., use `const tmp = (Number.isInteger(idx) && idx >= 0 && idx < input.length) ? input[value] : ...`).

    flatted parse() index key validation before accessing input buffer = Validate that the index string represents an integer within bounds (Number.isInteger(idx) && idx >= 0 && idx < input.length) before using it as an array index; do not use the unvalidated array index access `tmp = input[value]` for attacker-controlled `value`.

Event History

Mar 19, 2026
Advisory Published
via GitHub·05:43 PM
Data Sourced
via GitHub·05:43 PM
DescriptionWeaknessAffected Software
Mar 20, 2026
CVE Published
via MITRE·11:06 PM
Data Sourced
via MITRE·11:06 PM
DescriptionWeakness
Data Sourced
via NVD·11:16 PM
RemedyDescriptionSeverityWeaknessAffected Software
Mar 21, 2026
Data Sourced
via Red Hat·12:02 AM
DescriptionSeverityAffected Software
Apr 27, 2026
Data Sourced
via IBM·12:00 AM
DescriptionAffected Software

Parent advisories

This vulnerability appears in the following advisories.

Free Weekly Intel

Don't miss critical vulnerabilities

Join thousands of security professionals who receive our weekly digest of trending CVEs, zero-days, and exploited vulnerabilities.

No spam. Unsubscribe anytime.

Frequently Asked Questions

1

What is the severity of CVE-2026-33228?

CVE-2026-33228 is rated as a high severity vulnerability due to its potential for prototype pollution attacks.

2

What is the impact of CVE-2026-33228?

CVE-2026-33228 allows an attacker to manipulate internal JavaScript object structures, potentially leading to denial of service or arbitrary code execution.

3

How do I fix CVE-2026-33228?

To remediate CVE-2026-33228, upgrade to version 3.4.2 or newer of the flatted package.

4

Which versions of flatted are affected by CVE-2026-33228?

CVE-2026-33228 affects all versions of flatted prior to 3.4.2.

5

What kind of attack can exploit CVE-2026-33228?

CVE-2026-33228 can be exploited through prototype pollution via malicious JSON strings passed to the parse() function.

Contact

SecAlerts Pty Ltd.
132 Wickham Terrace
Fortitude Valley,
QLD 4006, Australia
info@secalerts.co
By using SecAlerts services, you agree to our services end-user license agreement. This website is safeguarded by reCAPTCHA and governed by the Google Privacy Policy and Terms of Service. All names, logos, and brands of products are owned by their respective owners, and any usage of these names, logos, and brands for identification purposes only does not imply endorsement. If you possess any content that requires removal, please get in touch with us.
© 2026 SecAlerts Pty Ltd.
ABN: 70 645 966 203, ACN: 645 966 203