GHSA-fjx5-qpf4-xjf2 Parsing borsh messages with ZST which are not-copy/clone is unsound

Not scored Published

Attackers can cause segmentation faults or potential code execution by deserializing zero-sized types that lack Copy/Clone traits in the borsh library.

Exploited in the wild
Not known
Login needed
Not needed
Attackable
Over the internet
Victim action needed
Not needed
Fix
Available

What is GHSA-fjx5-qpf4-xjf2?

GHSA-fjx5-qpf4-xjf2 is a memory corruption vulnerability in borsh, published on 12 Apr 2023. An attacker can exploit it over the internet without logging in, with no action from the victim.

Official 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.

Which versions are affected by GHSA-fjx5-qpf4-xjf2?

3 open source packages ship an affected version, including borsh.

PackageAffectedFixed in
borsh crates.ioAll versions1.0.0-alpha.1
borsh crates.ioAll versions1.0.0-alpha.1
borsh crates.ioFrom 0.0.0-00.10.4, 1.0.0-alpha.1

How do I fix GHSA-fjx5-qpf4-xjf2?

Upgrade borsh to a fixed version for your release line: 1.0.0-alpha.1 or 0.10.4.

Upgrade to the fixed version. Memory-safe languages, compiler hardening and fuzzing prevent most new cases. More about Memory corruption.

Is GHSA-fjx5-qpf4-xjf2 being exploited?

There is no known exploitation of GHSA-fjx5-qpf4-xjf2 in the wild and no public exploit code.

Sources

Also known as RUSTSEC-2023-0033.

Is GHSA-fjx5-qpf4-xjf2 in your software?

Upload an SBOM and sbomify checks it against every vulnerability here, every day.

Check your SBOMs for free