# GHSA-wwq9-3cpr-mm53: Borsh serialization of HashMap is non-canonical

> Non-canonical HashMap serialization in Borsh can cause consensus splits and treat equivalent objects as distinct, impacting blockchain or distributed systems.

- **Severity:** Not scored
- **Exploited in the wild:** Not known
- **Login needed:** Not needed
- **Attackable:** Over the internet
- **Victim action needed:** Not needed
- **Fix available:** Yes
- **Published:** 11 Oct 2024
- **Also known as:** RUSTSEC-2024-0402

## What is GHSA-wwq9-3cpr-mm53?

GHSA-wwq9-3cpr-mm53 is a vulnerability in hashbrown, published on 11 Oct 2024. An attacker can exploit it over the internet without logging in, with no action from the victim.

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

## Which versions are affected by GHSA-wwq9-3cpr-mm53?

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


| Package | Ecosystem | Affected | Fixed in |
| --- | --- | --- | --- |
| `hashbrown` | crates.io | From 0.15.0 | 0.15.1 |
| `hashbrown` | crates.io | From 0.15.0 | 0.15.1 |
| `hashbrown` | crates.io | From 0.15.0 | 0.15.1 |

## How do I fix GHSA-wwq9-3cpr-mm53?

Upgrade hashbrown to 0.15.1 or later.

## Is GHSA-wwq9-3cpr-mm53 being exploited?

There is no known exploitation of GHSA-wwq9-3cpr-mm53 in the wild and no public exploit code.

## Fix prompt for AI coding agents

```text
Check this codebase for GHSA-wwq9-3cpr-mm53 and fix it if it is affected.

What it is: GHSA-wwq9-3cpr-mm53 is a vulnerability in hashbrown, published on 11 Oct 2024. An attacker can exploit it over the internet without logging in, with no action from the victim.
Exploitation: There is no known exploitation of GHSA-wwq9-3cpr-mm53 in the wild and no public exploit code.

Affected packages and fixed versions:
- hashbrown (crates.io): affected from 0.15.0; fixed in 0.15.1
- hashbrown (crates.io): affected from 0.15.0; fixed in 0.15.1
- hashbrown (crates.io): affected from 0.15.0; fixed in 0.15.1

Task:
1. Search the dependency manifests and lockfiles (for example package.json, package-lock.json, requirements.txt, poetry.lock, uv.lock, pom.xml, build.gradle, go.mod, Cargo.lock, Gemfile.lock) and any Dockerfiles for the affected packages, including transitive dependencies.
2. If an affected version is in use, upgrade it to the fixed version for its release line with the project's package manager, so the lockfile is regenerated. Prefer the smallest upgrade that fixes it.
3. If there is no fix, or the upgrade would break the build, do not guess: explain the risk and the safest workaround instead.
4. Run the tests and summarise what changed and why.
5. If nothing in the project is affected, say so and change nothing.

Reference: https://insights.sbomify.com/GHSA-wwq9-3cpr-mm53/ (Markdown: https://insights.sbomify.com/GHSA-wwq9-3cpr-mm53/index.md)
```

## Sources

- OSV: https://osv.dev/vulnerability/GHSA-wwq9-3cpr-mm53

---
From sbomify Insights: https://insights.sbomify.com/GHSA-wwq9-3cpr-mm53/
Summaries are generated and may contain mistakes; the official description above is the record.
