CVE-2024-7884

Memory leak when calling a canister method via `ic_cdk::call`

7.5 high EPSS 0.69%

Published 5 Sep 2024 Updated 5 Sep 2024 CNA: Dfinity

Check your servers for CVE-2024-7884

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-7884 affects ic-cdk, 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 a canister method is called via ic_cdk::call* , a new Future CallFuture is created and can be awaited by the caller to get the execution result. Internally, the state of the Future is tracked and stored in a struct called CallFutureState. A bug in the polling implementation of the CallFuture allows multiple references to be held for this internal state and not all references were dropped before the Future is resolved. Since we have unaccounted references held, a copy of the internal state ended up being persisted in the canister's heap and thus causing a memory leak. Impact Canisters built in Rust with ic_cdk and ic_cdk_timers are affected. If these canisters call a canister method, use timers or heartbeat, they will likely leak a small amount of memory on every such operation. In the worst case, this could lead to heap memory exhaustion triggered by an attacker. Motoko based canisters are not affected by the bug. PatchesThe patch has been backported to all minor versions between >= 0.8.0, <= 0.15.0. The patched versions available are 0.8.2, 0.9.3, 0.10.1, 0.11.6, 0.12.2, 0.13.5, 0.14.1, 0.15.1 and their previous versions have been yanked. WorkaroundsThere are no known workarounds at the moment. Developers are recommended to upgrade their canister as soon as possible to the latest available patched version of ic_cdk to avoid running out of Wasm heap memory. Upgrading the canisters (without updating `ic_cdk`) also frees the leaked memory but it's only a temporary solution.

Severity (CVSS)

7.5 high CVSS 3.1 from Dfinity (CNA)
CVSS:3.1/AV:N/AC:L/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
low: an attack works without special conditions
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.69%: the probability of exploitation activity in the next 30 days, from the EPSS model of FIRST. The score is higher than 54.1% of all scored CVEs. Scores of 1 Dec 2026.

The assessment of CISA (SSVC, 5 Sep 2024):

Exploitation
none: CISA did not find evidence of exploitation or a public proof of concept
Automatable
yes: an attacker can automate the attack across many targets
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-cdk
package ic-cdk
affected from 0.8.0, before 0.8.2 (unaffected from 0.8.2)
affected from 0.9.0, before 0.9.3 (unaffected from 0.9.3)
affected from 0.10.0, before 0.10.1 (unaffected from 0.10.1)
affected from 0.11.0, before 0.11.5 (unaffected from 0.11.6)
affected from 0.12.0, before 0.12.2 (unaffected from 0.12.2)
affected from 0.13.0, before 0.13.4 (unaffected from 0.13.5)
affected from 0.14.0, before 0.14.1 (unaffected from 0.14.1)
affected from 0.15.0, before 0.15.1 (unaffected from 0.15.1)
Other versions: unaffected

Is my server affected?

Find the installed version of ic-cdk 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-cdk
# packages whose changelog names the CVE (fixed in the installed version)
zgrep -l CVE-2024-7884 /usr/share/doc/*/changelog.Debian.gz
# Ubuntu
pro fix CVE-2024-7884

RHEL, Rocky, Alma, Fedora

rpm -q ic-cdk
# lists the advisory while the fix is not installed
dnf updateinfo list --cve CVE-2024-7884

Alpine

apk list --installed | grep -i ic-cdk

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-7884
trivy image --scanners vuln IMAGE | grep CVE-2024-7884

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