CVE-2026-33228
JSON

8.9high

flatted: Prototype Pollution via parse()

Severity
8.9high CVSS:4.0 by GitHub_M
Exploit likelihood
0.94% (higher than 61% of CVEs; EPSS, by FIRST)
Published
Last changed
Assigned by
GitHub_M
Also known as
GHSA-rf6f-7fwh-wjgh

Description

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.

Affected

Product or packageVersionsReported by
WebReflection flatted< 3.4.2, before 3.4.2CVE List, NVD
cluster-observability-operator/logging-console-plugin-pf4-rhel9Not specified
Not affected: from 1782839279 before *
CVE List
cluster-observability-operator/logging-console-plugin-pf5-rhel9Not specified
Not affected: from 1782840539 before *
CVE List
cluster-observability-operator/troubleshooting-panel-console-plugin-pf6-rhel9Not specified
Not affected: from 1782839996 before *
CVE List
rhdh/rhdh-hub-rhel9Not specified
Not affected: from 1776784286 before *, from 1777903262 before *
CVE List
io.cryostat-cryostatNot specifiedCVE List
openshift-logging/elasticsearch6-rhel9Not specifiedCVE List
openshift-logging/elasticsearch-operator-bundleNot specifiedCVE List
openshift-logging/elasticsearch-proxy-rhel9Not specifiedCVE List
openshift-logging/elasticsearch-rhel9-operatorNot specifiedCVE List
openshift-logging/kibana6-rhel8Not specifiedCVE List
openshift-logging/logging-curator5-rhel9Not specifiedCVE List

All scores

GitHub_M8.9high CVSS:4.0CVSS: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
redhat-SADP9.8critical CVSS:3.1CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H
GitHubhigh CVSS:4.0CVSS: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
NVD9.8critical CVSS:3.1CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H

Classification

CWE-915CWE-1321

SSVC (CISA-ADP): exploitation poc, automatable yes, technical impact total.

What each source says

CVE List

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.

GitHub Advisory Database

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;

NVD (es)

flatted es un analizador de JSON circular. Antes de la versión 3.4.2, la función parse() en flatted puede usar valores de cadena controlados por el atacante del JSON analizado como claves de índice de array directas, sin validar que sean numéricos. Dado que el búfer de entrada interno es un Array de JavaScript, acceder a él con la clave '__proto__' devuelve Array.prototype a través del getter heredado. Este objeto es entonces tratado como un valor analizado legítimo y asignado como una propiedad del objeto de salida, filtrando efectivamente una referencia en vivo a Array.prototype al consumidor. Cualquier código que posteriormente escriba en esa propiedad contaminará el prototipo global. Este problema ha sido parcheado en la versión 3.4.2.

References

Sources

SourceRecordLicence
CVE ListCVE-2026-33228 changed 2026-09-07CVE Terms of Use
GitHub Advisory DatabaseGHSA-rf6f-7fwh-wjgh changed 2026-10-05CC-BY-4.0
NVDCVE-2026-33228 changed 2026-09-04Public domain