{"id":"GHSA-fjx5-qpf4-xjf2","aliases":["RUSTSEC-2023-0033"],"status":"published","title":"Parsing borsh messages with ZST which are not-copy/clone is unsound","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.\n\nThere 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.","facts":{"in_kev":false,"known_exploited":false,"public_exploit":false,"fix_available":true},"published":"2023-04-12T12:00:00Z","modified":"2024-09-23T16:34:09Z","fixes":[{"ecosystem":"crates.io","package":"borsh","fixed_in":["1.0.0-alpha.1","0.10.4"],"sources":["ghsa","osv"]}],"affected":[{"source":"ghsa","ecosystem":"crates.io","package":"borsh","ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"0"},{"last_affected":"0.10.3"},{"fixed":"1.0.0-alpha.1"}]}]},{"source":"osv","ecosystem":"crates.io","package":"borsh","ranges":[{"type":"SEMVER","events":[{"introduced":"0"},{"fixed":"1.0.0-alpha.1"}]}]},{"source":"osv","ecosystem":"crates.io","package":"borsh","ranges":[{"type":"SEMVER","events":[{"introduced":"0.0.0-0"},{"fixed":"0.10.4"},{"introduced":"0.11.0-0"},{"fixed":"1.0.0-alpha.1"}]}]}],"references":[{"url":"https://github.com/near/borsh-rs/issues/19","tags":["web","report"]},{"url":"https://rustsec.org/advisories/RUSTSEC-2023-0033.html","tags":["web","advisory"]},{"url":"https://github.com/advisories/GHSA-fjx5-qpf4-xjf2"},{"url":"https://github.com/near/borsh-rs","tags":["package"]},{"url":"https://crates.io/crates/borsh","tags":["package"]},{"url":"https://github.com/near/borsh-rs/pull/136","tags":["web"]}],"sources":{"ghsa":[{"id":"GHSA-fjx5-qpf4-xjf2","title":"Parsing borsh messages with ZST which are not-copy/clone is unsound","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.\n\nThere 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. \n","status":"published","published":"2023-04-17T16:32:26Z","modified":"2023-09-29T18:12:12Z","updated_at":"2026-11-02T14:37:06.913882Z"}],"osv":[{"id":"GHSA-fjx5-qpf4-xjf2","title":"Parsing borsh messages with ZST which are not-copy/clone is unsound","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.\n\nThere 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. \n","status":"published","published":"2023-04-17T16:32:26Z","modified":"2024-09-23T16:34:09Z","updated_at":"2026-11-02T15:46:46.760785Z"},{"id":"RUSTSEC-2023-0033","title":"Parsing borsh messages with ZST which are not-copy/clone is unsound","description":"Affected versions of borsh cause undefined behavior when zero-sized-types (ZST) \nare parsed and the Copy/Clone traits are not implemented/derived.\nFor instance if 1000 instances of a ZST are deserialized, and the ZST is not copy \n(this can be achieved through a singleton), then accessing/writing to deserialized \ndata will cause a segmentation fault.\n\nThere is currently no way for borsh to read data without also providing a Rust type. \nTherefore, if not ZST are used for serialization, then you are not affected by this issue.","status":"published","published":"2023-04-12T12:00:00Z","modified":"2024-09-23T15:02:17Z","updated_at":"2026-11-02T15:53:39.971022Z"}]}}
