RUSTSEC-2023-0033
MEDIUMParsing borsh messages with ZST which are not-copy/clone is unsound
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.
- Published
- 12 Apr 2023
- Last modified
- 23 Sep 2024
- Also known as
- GHSA-fjx5-qpf4-xjf2
- Sources
- OSV GHSA-fjx5-qpf4-xjf2JSONOSVJSON
Affected
| Source | Vendor / ecosystem | Product / package | Affected versions | Fixed in |
|---|---|---|---|---|
| OSV | crates.io | borsh | < 1.0.0-alpha.1 | 1.0.0-alpha.1 |
| OSV | crates.io | borsh | >= 0.0.0-0, < 0.10.4; >= 0.11.0-0, < 1.0.0-alpha.1 | 0.10.4, 1.0.0-alpha.1 |
References
- https://github.com/near/borsh-rs/issues/19 · WEB, REPORT
- https://github.com/near/borsh-rs · PACKAGE
- https://rustsec.org/advisories/RUSTSEC-2023-0033.html · WEB, ADVISORY
- https://crates.io/crates/borsh · PACKAGE
- https://github.com/near/borsh-rs/pull/136 · WEB
History
- 25 Nov 2026 20:14 UTC · OSV: first stored (published 12 Apr 2023)
- 25 Nov 2026 20:14 UTC · OSV: first stored (published 17 Apr 2023)