Unratedcrates.ioPublished
Parsing borsh messages with ZST which are not-copy/clone is unsound
GHSA-fjx5-qpf4-xjf2
- Affected
- crates.io borsh <= 0.10.3
- Fixed in
- 1.0.0-alpha.1· Vendor fix available
- Issue
- 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.
Recommended action: Upgrade to 1.0.0-alpha.1 (pre-release) or later, then redeploy and verify.A vendor fix does not resolve your finding until you verify it in your own systems.