CVE-2024-4435Dfinity Stable Structures
High 7.5 No auth needed
Follow: this CVE · Dfinity · Dfinity Stable Structures We alert you by email or Slack (account required).
- Priority
- 60
- CVSS 3.1
- 7.5
- EPSS
- 1.0% probability of exploitation in 30 days · percentile 63
- Auth required
- No
- Published
- May 21, 2024
- Updated
- Jun 17, 2026
- Category
- Application · Cross-platform
- Weakness (CWE)
- CWE-401
- SSVC (CISA)
- Exploitation: none · Automatable: no · Technical impact: partial
- Vector
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H
What happens
When storing unbounded types in a BTreeMap, a node is represented as a linked list of "memory chunks". It was discovered recently that when we deallocate a node, in some cases only the first memory chunk is deallocated, and the rest of the memory chunks remain (incorrectly) allocated, causing a memory leak. In the worst case, depending on how a canister uses the BTreeMap, an adversary could interact with the canister through its API and trigger interactions with the map that keep consuming memory due to the memory leak. This could potentially lead to using an excessive amount of memory, or even running out of memory.
This issue has been fixed in #212 https://github.com/dfinity/stable-structures/pull/212 by changing the logic for deallocating nodes to ensure that all of a node's memory chunks are deallocated and users are asked to upgrade to version 0.6.4.. Tests have been added to prevent regressions of this nature moving forward. Note: Users of stable-structure < 0.6.0 are not affected.
Users who are not storing unbounded types in BTreeMap are not affected and do not need to upgrade. Otherwise, an upgrade to version 0.6.4 is necessary.
What to do
- Apply the vendor's security update for Stable Structures.
- It can be exploited without authentication: if you cannot patch now, restrict Internet access to the affected service.
Affected packages
| Ecosystem | Package | Affected versions | Fixed in | How to upgrade |
|---|---|---|---|---|
| crates.io | ic-stable-structures |
≥ 0.6.0 < 0.6.4 |
0.6.4 |
cargo update -p ic-stable-structures --precise 0.6.4 |
| crates.io | ic-stable-structures |
≥ 0.6.0 < 0.6.4 |
0.6.4 |
cargo update -p ic-stable-structures --precise 0.6.4 |
Per OSV / GitHub Advisories (GHSA-3rcq-39xp-7xjp, RUSTSEC-2024-0406). Check the version in your lockfile before upgrading.
Affected products (CPE)
| Vendor | Product | Versions |
|---|---|---|
| dfinity | stable_structures | < 0.6.0 |
Official sources
References
Links published by the sources. Open them with care.
- docs.rs Product
- github.com Issue Tracking Patch
- internetcomputer.org Product