CVE-2022-36078

Slice Memory Allocation with Excessive Size Value in binary

HIGH
7.5
CVSS Score
Published: September 2, 2022 at 12:15 PM UTC
Updated: June 17, 2026 at 04:52 AM UTC
2 products affected across 2 vendorsBinaryProject Binary

Using binary by gagliardetto?

Get instant alerts when new vulnerabilities affect binary - before attackers find them.

Real-time alertsTrack your software stackFree plan available
Severity
HIGH7.5
Exploit prediction
EPSS 1%
SSVC
PoC

Description

Binary provides encoding/decoding in Borsh and other formats. The vulnerability is a memory allocation vulnerability that can be exploited to allocate slices in memory with (arbitrary) excessive size value, which can either exhaust available memory or crash the whole program. When using `github.com/gagliardetto/binary` to parse unchecked (or wrong type of) data from untrusted sources of input (e.g. the blockchain) into slices, it's possible to allocate memory with excessive size. When `dec.Decode(&val)` method is used to parse data into a structure that is or contains slices of values, the length of the slice was previously read directly from the data itself without any checks on the size of it, and then a slice was allocated. This could lead to an overflow and an allocation of memory with excessive size value. Users should upgrade to `v0.7.1` or higher. A workaround is not to rely on the `dec.Decode(&val)` function to parse the data, but to use a custom `UnmarshalWithDecoder()` method that reads and checks the length of any slice.

Affected

Our own answer: ranges merged, affected separated from platform-only, with confidence and review flags.

v < 0.7.1
Affected range stops below 0.7.1, so it looks safe — our inference, not a vendor statement
v < 0.7.1
Affected range stops below 0.7.1, so it looks safe — our inference, not a vendor statement

Remediation

No guide yet

No remediation guidance has been written for this CVE yet. What the record does show:

References (3)

x_refsource_MISCIssue TrackingPatchThird Party Advisory
https://github.com/gagliardetto/binary/pull/7
x_refsource_MISCRelease NotesThird Party Advisory
https://github.com/gagliardetto/binary/releases/tag/v0.7.1
x_refsource_CONFIRMExploitMitigationThird Party Advisory
https://github.com/gagliardetto/binary/security/advisories/GHSA-4p6f-m4f9-ch88

SSVC — Action Prioritization

SSVCPoCNot automatableTotal impact

SSVC signals action urgency (what to patch first), separate from CVSS which measures severity.

CVSS

Attack Vector
NETWORK
Complexity
LOW
Privileges
NONE
User Interaction
NONE
Scope
UNCHANGED
Confidentiality
NONE
Integrity
NONE
Availability
HIGH
Vector?

Quick Info

StatusMODIFIED
CWE
CWE-789CWE-1284

Get alerted

Stop reading CVE feeds looking for your own stack

Track the products you run and VulnTracker tells you when a new CVE affects them — with what is known about fixing it, and nothing about the rest.

Free plan, no card