{"cve":"CVE-2022-36078","nvd":{"published":"2022-09-02T13:15:08.930","modified":"2026-06-17T04:52:52.237","status":"Modified","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.","cvss_v4":null,"cvss_v3":{"version":"3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H","score":7.5},"cwes":["CWE-1284","CWE-789"],"references":["https://github.com/gagliardetto/binary/pull/7","https://github.com/gagliardetto/binary/releases/tag/v0.7.1","https://github.com/gagliardetto/binary/security/advisories/GHSA-4p6f-m4f9-ch88","https://github.com/gagliardetto/binary/pull/7","https://github.com/gagliardetto/binary/releases/tag/v0.7.1"],"products":["binary_project:binary"],"source":"nvd","synced_at":"2026-10-19T21:35:14.992143698+00:00"},"epss":{"cve":"CVE-2022-36078","score":0.01207,"percentile":0.6835,"date":"2026-10-31"},"kev":null,"osv":[{"id":"GHSA-4p6f-m4f9-ch88","url":"https://osv.dev/vulnerability/GHSA-4p6f-m4f9-ch88","summary":"Binary vulnerable to Slice Memory Allocation with Excessive Size Value","modified":"2023-11-08T04:09:59.881854Z","packages":[{"ecosystem":"Go","name":"github.com/gagliardetto/binary","purl":"pkg:golang/github.com/gagliardetto/binary","ranges":["<0.7.1"],"fixed":["0.7.1"]}]},{"id":"GO-2022-0963","url":"https://osv.dev/vulnerability/GO-2022-0963","summary":"Resource exhaustion in github.com/gagliardetto/binary","modified":"2024-05-20T16:03:47Z","packages":[{"ecosystem":"Go","name":"github.com/gagliardetto/binary","purl":"pkg:golang/github.com/gagliardetto/binary","ranges":["<0.7.1"],"fixed":["0.7.1"]}]}],"attribution":["This product uses the NVD API but is not endorsed or certified by the NVD.","EPSS scores: FIRST Exploit Prediction Scoring System, https://www.first.org/epss","Known exploited vulnerabilities: CISA Known Exploited Vulnerabilities Catalog, https://www.cisa.gov/known-exploited-vulnerabilities-catalog","Package advisories: OSV (https://osv.dev), from the GitHub Advisory Database, PyPA, Go, RustSec and other ecosystem databases, under CC-BY 4.0 or CC0","CVE records: the CVE Program's CVE List (https://www.cve.org), under its terms of use (https://www.cve.org/Legal/TermsOfUse). CVE is a registered trademark of The MITRE Corporation; this product is not affiliated with the CVE Program."]}