# RUSTSEC-2024-0402: Borsh serialization of HashMap is non-canonical

- Database: RustSec
- Published: 2024-10-11
- Modified: 2025-10-28

## Also published as

- [GHSA-WWQ9-3CPR-MM53](https://cve.now/GHSA-WWQ9-3CPR-MM53.md) (GitHub)

## Affected versions

- hashbrown (crates.io): from 0.15.0, fixed in 0.15.1

## Description

The borsh serialization of the HashMap did not follow the borsh specification.
It potentially produced non-canonical encodings dependent on insertion order.
It also did not perform canonicty checks on decoding.

This can result in consensus splits and cause equivalent objects to be
considered distinct.

This was patched in 0.15.1.

## References

- https://crates.io/crates/hashbrown
- https://rustsec.org/advisories/RUSTSEC-2024-0402.html
- https://github.com/rust-lang/hashbrown/issues/576

Page: https://cve.now/RUSTSEC-2024-0402

Wrong or missing data? Send feedback: POST https://cve.now/api/v1/feedback (see https://cve.now/agents#feedback).
