# GHSA-fjx5-qpf4-xjf2: Parsing borsh messages with ZST which are not-copy/clone is unsound

- Severity: Medium (rating, scored by GitHub)
- Known to be exploited: not in CISA's catalogue, which lists only what CISA has confirmed
- Published: 2023-04-12T12:00:00.000Z
- Modified: 2024-09-23T16:34:09.000Z
- Also known as: RUSTSEC-2023-0033

## Description

Affected versions of borsh cause undefined behavior when zero-sized-types (ZST) are parsed and the Copy/Clone traits are not implemented/derived. For instance if 1000 instances of a ZST are deserialized, and the ZST is not copy (this can be achieved through a singleton), then accessing/writing to deserialized data will cause a segmentation fault.

There is currently no way for borsh to read data without also providing a Rust type. Therefore, if you are not using ZST for serialization, then you are not affected by this issue.

(As written by GitHub Advisory Database.)

## Affected

- borsh (crates.io): before 1.0.0-alpha.1; from 0.0.0-0 before 0.10.4; from 0.11.0-0 before 1.0.0-alpha.1

## References

- <https://github.com/near/borsh-rs/issues/19> (report, web)
- <https://github.com/near/borsh-rs> (package)
- <https://rustsec.org/advisories/RUSTSEC-2023-0033.html> (advisory, web)
- <https://crates.io/crates/borsh> (package)
- <https://github.com/near/borsh-rs/pull/136> (web)

## Sources

- GitHub Advisory Database: [GHSA-fjx5-qpf4-xjf2](https://github.com/advisories/GHSA-fjx5-qpf4-xjf2), CC-BY-4.0, modified 2024-09-23
- RustSec Advisory Database: [RUSTSEC-2023-0033](https://rustsec.org/advisories/RUSTSEC-2023-0033.html), CC0-1.0, modified 2024-09-23

---

Page: https://cve.day/GHSA-fjx5-qpf4-xjf2 · Whole record: https://cve.day/GHSA-fjx5-qpf4-xjf2.json · Rebuilt by cve.day 2026-11-25T22:56:43.146Z
