CVE-2024-4435

BTreeMap memory leak when deallocating nodes with overflows

5.9 medium EPSS 0.52%

Published 21 May 2024 Updated 1 Aug 2024 CNA: Dfinity

Check your servers for CVE-2024-4435

The Vulnpocalypse collector sends the package list of each Linux server and of its container images once a day. Vulnpocalypse shows every server where CVE-2024-4435 affects ic-stable-structures, with the command that installs the fix. The free plan covers one server and one domain and does not need a credit card.

Check my servers

Description

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.

Severity (CVSS)

5.9 medium CVSS 3.1 from Dfinity (CNA)
CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:N/I:N/A:H
Attack vector
network: an attacker can reach the vulnerable part over the network, often from the internet
Attack complexity
high: an attack depends on conditions outside the control of the attacker, such as a race
Privileges required
none: the attacker does not need an account
User interaction
none: nobody has to click or open anything
Scope
unchanged: the damage stays inside the vulnerable component
Impact
confidentiality none, integrity none, availability high: what an attacker can read (confidentiality), change (integrity) or stop (availability)

Exploitation

EPSS 0.52%: the probability of exploitation activity in the next 30 days, from the EPSS model of FIRST. The score is higher than 45.3% of all scored CVEs. Scores of 1 Dec 2026.

The assessment of CISA (SSVC, 23 May 2024):

Exploitation
none: CISA did not find evidence of exploitation or a public proof of concept
Automatable
no: each attack takes manual steps
Technical impact
partial: limited control or limited data

Weakness

  • CWE-401 Missing Release of Memory after Effective Lifetime

Affected products

As the CNA lists them.

ProductVersions
ic-stable-structures
package ic-stable-structures
affected from 0.6.0, before 0.6.4
Other versions: unaffected

Is my server affected?

Find the installed version of ic-stable-structures and compare it with the fixed version of your distribution. Distributions often fix a CVE in a package version of their own, so the version number of the upstream project can mislead.

Debian, Ubuntu

dpkg -l | grep -i ic-stable-structures
# packages whose changelog names the CVE (fixed in the installed version)
zgrep -l CVE-2024-4435 /usr/share/doc/*/changelog.Debian.gz
# Ubuntu
pro fix CVE-2024-4435

RHEL, Rocky, Alma, Fedora

rpm -q ic-stable-structures
# lists the advisory while the fix is not installed
dnf updateinfo list --cve CVE-2024-4435

Alpine

apk list --installed | grep -i ic-stable-structures

With Trivy, on the host and for a container image. When a package is affected, it prints the installed and the fixed version:

trivy rootfs --scanners vuln / | grep CVE-2024-4435
trivy image --scanners vuln IMAGE | grep CVE-2024-4435

Vulnpocalypse makes this comparison every day for the package lists of your servers and container images, including language packages (npm, PyPI, Go, Maven and others), and sends the command that installs the fix. Start free with one server and one domain or read how to install the collector.

References

Other references

Source: the record CVE-2024-4435 of the CVE List (CVE Program), CVE Terms of Use; the CISA KEV catalog and the CISA ADP container; EPSS of FIRST; the CWE catalog of MITRE, CWE Terms of Use. The text of the record is shown as published. Data sources and licences.