# GHSA-FJX5-QPF4-XJF2: Parsing borsh messages with ZST which are not-copy/clone is unsound

- Database: GitHub
- Severity: medium (stated by ghsa, no CVSS score)
- Published: 2023-04-17
- Modified: 2024-09-23

## Also published as

- [RUSTSEC-2023-0033](https://cve.now/RUSTSEC-2023-0033.md) (RustSec)

## Affected versions

- borsh (crates.io): fixed in 1.0.0-alpha.1

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

## References

- https://github.com/near/borsh-rs/issues/19
- https://github.com/near/borsh-rs
- https://rustsec.org/advisories/RUSTSEC-2023-0033.html

Page: https://cve.now/GHSA-FJX5-QPF4-XJF2

Wrong or missing data? Send feedback: POST https://cve.now/api/v1/feedback (see https://cve.now/agents#feedback).
