🛡️ GHSA-5jg4-p4qw-cgfr — cbor

🟠 CVSS 8.0 — High ✅ No Known Exploit CWE-674 OSV
8.0
CVSS Score
0 Low4 Medium7 High9 Critical10

Description

@stablelib/cbor: Stack exhaustion Denial of Service via deeply nested CBOR arrays, maps, or tags

Summary

@stablelib/cbor decodes nested CBOR structures recursively and does not enforce a maximum nesting depth. A sufficiently deep attacker-controlled CBOR payload can therefore crash decoding with RangeError: Maximum call stack size exceeded.

Details

The decoder processes arrays, maps, and tagged values through recursive calls. Each nested container causes another descent into _decodeValue() until a leaf value is reached.

There is no depth limit, no iterative fallback, and no protection against pathological nesting. An attacker can therefore supply a payload made of thousands of nested arrays, maps, or tags and force the decoder to recurse until the JavaScript call stack is exhausted.

PoC

```js

import { decode } from "@stablelib/cbor";

const depth = 12000;

const payload = new Uint8Array(depth + 1);

// Build [[[...[null]...]]]

payload.fill(0x81, 0, depth); // array(1)

payload[depth] = 0xf6; // null

decode(payload);

// RangeError: Maximum call stack size exceeded

```

Impact

Any application that decodes attacker-controlled CBOR can be forced into a reliable denial of service with a single crafted payload.

The immediate result is an exception during decoding. In services that do not catch that exception safely, the request fails and the worker or process handling the decode may terminate.

Solution

Upgrade to version 2.0.4. The stack is limited to 128 by default, but can be configured using the maxDepth option. Catch the CBORMaxDepthExceededError exception.

How this vulnerability can be exploited

This issue can be reached over the network, attack complexity is low, an attacker needs no privileges on the target. No user interaction is required. Rated impact: confidentiality none, integrity none, availability high.

Weakness class

GHSA-5jg4-p4qw-cgfr is classified as CWE-674: Uncontrolled Recursion. The product does not properly control the amount of recursion that takes place, consuming excessive resources, such as allocated memory or the program stack.

Affected software

GHSA-5jg4-p4qw-cgfr is recorded against 1 package.

  • @stablelib/cbor

Timeline and source

Published on 4 April 2026 and last revised on 7 April 2026. No public exploit is currently recorded for this entry. Record sourced from OSV.

References

github.com (Web)
github.com (Web)
github.com (Package)

Details

Severity HIGH
CVSS Score 8.0
CVSS Vector CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:N/VI:N/VA:H/SC:N/SI:N/SA:N
CWE CWE-674
Public Exploit ✅ No
Source OSV
Published 2026-04-04
Updated 2026-08-20
Modified 2026-04-07
Fix URL N/A

Affected Packages

Software From version Fixed in
@stablelib/cbor

Similar Threats

Site Security Check

Is cbor part of your stack?

GHSA-5jg4-p4qw-cgfr is rated CVSS 8.0 High. BotEraser scans your installation against known CVE records and tells you whether this vulnerability applies to the versions you actually run.

Scan My Site Free →

No credit card required  ·  Results in minutes

ⓘ Data Notice: The information presented above has been compiled from publicly available internet sources. Boteraser aggregates this data solely for informational purposes and does not independently classify, evaluate, or endorse any findings about the vulnerabilities listed. The accuracy and completeness of this information is the sole responsibility of the original publishers. Boteraser and its operators accept no liability for any decisions made based on this data.

Browse related advisories

All advisoriesGitHub AdvisoryGitHub Advisory Undated