GHSA-fjx5-qpf4-xjf2
JSON

medium

Parsing borsh messages with ZST which are not-copy/clone is unsound

Severity
medium rating by GitHub
Published
Last changed
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.

Affected

Product or packageVersionsReported by
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.1GitHub Advisory Database, RustSec Advisory Database

What each source says

GitHub Advisory Database

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.

RustSec Advisory Database

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 not ZST are used for serialization, then you are not affected by this issue.

References

Sources

SourceRecordLicence
GitHub Advisory DatabaseGHSA-fjx5-qpf4-xjf2 changed 2024-09-23CC-BY-4.0
RustSec Advisory DatabaseRUSTSEC-2023-0033 changed 2024-09-23CC0-1.0