# CVE-2022-36078: Slice Memory Allocation with Excessive Size Value in binary

- Severity: High 8.8 (CVSS:3.1, scored by GitHub_M) `CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H`
- Known to be exploited: not in CISA's catalogue, which lists only what CISA has confirmed
- Likelihood of exploitation in the next 30 days (EPSS): 1.24%, higher than 70% of CVEs (2026-12-02)
- Public exploit code or proof of concept: one link below, marked "exploit"
- Published: 2022-09-02T12:15:14.000Z
- Modified: 2026-06-17T04:52:52.237Z
- Also known as: GHSA-4p6f-m4f9-ch88, GO-2022-0963
- Weaknesses: CWE-400, CWE-789, CWE-1284
- SSVC (CISA-ADP): exploitation poc, automatable no, technical impact total
- Assigned by: GitHub_M

## 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.

(As written by CVE List.)

## Affected

- gagliardetto binary: < 0.7.1
- github.com/gagliardetto/binary (Go): before 0.7.1
- binary_project binary: before 0.7.1

## Every score

- GitHub_M: CVSS:3.1 8.8 High `CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H`
- GitHub: CVSS:3.1 8.8 High `CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H`
- NVD: CVSS:3.1 7.5 High `CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H`

## References

- <https://github.com/gagliardetto/binary/security/advisories/GHSA-4p6f-m4f9-ch88> (exploit, advisory, mitigation, third-party-advisory, web)
- <https://github.com/gagliardetto/binary/pull/7> (fix, issue-tracking, patch, third-party-advisory, web)
- <https://github.com/gagliardetto/binary/releases/tag/v0.7.1> (release-notes, third-party-advisory, web)
- <https://nvd.nist.gov/vuln/detail/CVE-2022-36078> (advisory)
- <https://github.com/gagliardetto/binary> (package)
- <https://pkg.go.dev/vuln/GO-2022-0963> (web)

## Sources

- CVE List: [CVE-2022-36078](https://www.cve.org/CVERecord?id=CVE-2022-36078), CVE Terms of Use, modified 2025-04-22
- GitHub Advisory Database: [GHSA-4p6f-m4f9-ch88](https://github.com/advisories/GHSA-4p6f-m4f9-ch88), CC-BY-4.0, modified 2023-11-08
- Go Vulnerability Database: [GO-2022-0963](https://pkg.go.dev/vuln/GO-2022-0963), CC-BY-4.0, modified 2024-05-20
- NVD: [CVE-2022-36078](https://nvd.nist.gov/vuln/detail/CVE-2022-36078), Public domain, modified 2026-06-17

---

Page: https://cve.day/CVE-2022-36078 · Whole record: https://cve.day/CVE-2022-36078.json · Rebuilt by cve.day 2026-11-25T22:58:14.645Z
