Advisory

RUSTSEC-2023-0033

Also known as: GHSA-fjx5-qpf4-xjf2

Summary

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

Details

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.

Severity

Not rated by the source.

Dates

Published
2023-04-12 12:00 UTC
Modified
2024-09-23 15:02 UTC

Affected packages and fixes

borsh

crates.io · All systems

Affected

  • introduced 0.0.0-0, fixed 0.10.4, introduced 0.11.0-0, fixed 1.0.0-alpha.1 (semver)

Fixed versions

0.10.4, 1.0.0-alpha.1

Fix

  • Fixed version 0.10.4
    cargo update -p borsh --precise 0.10.4
  • Fixed version 1.0.0-alpha.1
    cargo update -p borsh --precise 1.0.0-alpha.1

Fix commands are the export's own generic commands. Ojuju never runs them. Check them against your setup first.

Check your own computer: guard packages check

View this record on OSV.dev

Source

Source: RustSec Advisory Database · CC0-1.0

Sources & licences