GHSA-378j-3jfj-8r9f

Suggest an improvement
Source
https://github.com/advisories/GHSA-378j-3jfj-8r9f
Import Source
https://github.com/github/advisory-database/blob/main/advisories/github-reviewed/2026/04/GHSA-378j-3jfj-8r9f/GHSA-378j-3jfj-8r9f.json
JSON Data
https://api.osv.dev/v1/vulns/GHSA-378j-3jfj-8r9f
Aliases
  • CVE-2026-35480
Related
Published
2026-04-06T23:08:24Z
Modified
2026-04-07T20:18:55.275084Z
Severity
  • 6.2 (Medium) CVSS_V3 - CVSS:3.1/AV:L/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H CVSS Calculator
Summary
go-ipld-prime: DAG-CBOR decoder unbounded memory allocation from CBOR headers
Details

The DAG-CBOR decoder uses collection sizes declared in CBOR headers as Go preallocation hints for maps and lists. The decoder does not cap these size hints or account for their cost in its allocation budget, allowing small payloads to cause excessive memory allocation.

A CBOR map or list header can declare an arbitrarily large number of entries, causing the decoder to preallocate proportionally large backing structures before any entries are actually read. Because the allocation budget is only decremented as entries are decoded (not when sizes are declared), this cost is effectively invisible to the budget system. This is compounded by nesting: each level of a nested structure triggers its own unchecked preallocation while consuming minimal budget (one entry per parent level), so a payload under 100 bytes with 10 levels of nesting can cause over 9GB of allocation.

Schema-free decoding (i.e. using basicnode.Prototype.Any) allows arbitrary nesting depth. Schema-bound decoding limits nesting to the schema's structure, but any field typed as Any in the schema permits unconstrained nesting within that field.

The fix caps the preallocation size hint to 1024 entries and decrements the allocation budget when collection sizes are declared. The declared length is still used for entry-count validation, and collections grow dynamically as entries are decoded, so correctly-formed data is unaffected, even beyond the preallocation limit.

Database specific
{
    "cwe_ids": [
        "CWE-770"
    ],
    "github_reviewed_at": "2026-04-06T23:08:24Z",
    "nvd_published_at": "2026-04-07T15:17:45Z",
    "severity": "MODERATE",
    "github_reviewed": true
}
References

Affected packages

Go / github.com/ipld/go-ipld-prime

Package

Name
github.com/ipld/go-ipld-prime
View open source insights on deps.dev
Purl
pkg:golang/github.com/ipld/go-ipld-prime

Affected ranges

Type
SEMVER
Events
Introduced
0Unknown introduced version / All previous versions are affected
Fixed
0.22.0

Database specific

source
"https://github.com/github/advisory-database/blob/main/advisories/github-reviewed/2026/04/GHSA-378j-3jfj-8r9f/GHSA-378j-3jfj-8r9f.json"